71442023-12-31 13:25:58IgnácProgramtermék verseny (70 pont)cpp17Accepted 70/7037ms4812 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> p(n + 1);
	for (int i = 1; i <= n; i++){
		cin >> p[i];
	}

	int jobb = 0;
	int arany = 0, ezust = 0, bronz = 0;
	for (int i = 1; i <= n; i++) {
		if (p[i] > p[k]) jobb++;
		if (jobb < n / 12) arany = i;
		if (jobb < n / 4 && jobb >= n / 12) ezust = i;
		if (jobb < n / 2 && jobb >= n / 4) bronz = i;
	}

	if (arany < k) arany = 0;
	if (ezust < k) ezust = 0;
	if (bronz < k) bronz = 0;
	cout << arany << "\n" << ezust << "\n" << bronz << "\n";
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms1816 KiB
2Accepted0/03ms2052 KiB
3Accepted0/037ms2972 KiB
4Accepted3/33ms2328 KiB
5Accepted3/33ms2524 KiB
6Accepted3/33ms2776 KiB
7Accepted3/33ms2984 KiB
8Accepted3/33ms3092 KiB
9Accepted3/33ms3052 KiB
10Accepted3/33ms3036 KiB
11Accepted3/33ms3152 KiB
12Accepted3/33ms3288 KiB
13Accepted3/33ms3260 KiB
14Accepted4/44ms3264 KiB
15Accepted4/419ms3596 KiB
16Accepted4/423ms3976 KiB
17Accepted4/427ms3980 KiB
18Accepted4/46ms3876 KiB
19Accepted4/48ms4036 KiB
20Accepted4/413ms4160 KiB
21Accepted4/437ms4812 KiB
22Accepted4/437ms4808 KiB
23Accepted4/432ms4416 KiB