全TLE!!!!!!!!!
查看原帖
全TLE!!!!!!!!!
1044048
Algorithm_ZRF楼主2023/8/3 19:17
#include <bits/stdc++.h>
using namespace std;
int main() {
	priority_queue <int, vector<int>, greater<int>> q;
	int n, k, cnt = 1, b;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		int a;
		cin >> a;
		q.push(a);
	}
	b = q.top();
	if (k > n) {
		cout << "NO RESULT";
		return 0;
	}
	int i = 1;
	while (cnt <= k) {
		if (q.top() == b) {
			if (i != 1) {
				cnt++;
				b = q.top();
			}
		}
		q.pop();
		i++;
	}
	cout << b;
	return 0;
}
2023/8/3 19:17
加载中...