70752023-12-29 18:41:36MagyarKendeSZLGProgramtermék verseny (70 pont)cpp17Accepted 70/7016ms4048 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;

using namespace std;

int N, K, A, E, B;

int main() {
    speed;

    cin >> N >> K;
    K--;
    vector<int> P(N);
    cinv(P);

    int better = 0, a_c = N / 12, e_c = N / 4, b_c = N / 2;
    for (int i = 0; i < K; i++) {
        better += (P[i] > P[K]);
    }

    if (better < a_c) A = K + 1;
    else if (better < e_c) E = K + 1;
    else if (better < b_c) B = K + 1;

    for (int i = K + 1; i < N; i++) {
        better += (P[i] > P[K]);

        if (better < a_c) A = i + 1;
        else if (better < e_c) E = i + 1;
        else if (better < b_c) B = i + 1;
    }

    cout << A << '\n' << E << '\n' << B;
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms1832 KiB
2Accepted0/03ms2020 KiB
3Accepted0/016ms3072 KiB
4Accepted3/33ms2496 KiB
5Accepted3/33ms2496 KiB
6Accepted3/33ms2596 KiB
7Accepted3/33ms2592 KiB
8Accepted3/33ms2600 KiB
9Accepted3/33ms2876 KiB
10Accepted3/33ms2844 KiB
11Accepted3/33ms2932 KiB
12Accepted3/33ms3128 KiB
13Accepted3/33ms3216 KiB
14Accepted4/43ms3368 KiB
15Accepted4/48ms3492 KiB
16Accepted4/49ms3496 KiB
17Accepted4/412ms3496 KiB
18Accepted4/44ms3240 KiB
19Accepted4/44ms3280 KiB
20Accepted4/46ms3460 KiB
21Accepted4/416ms4048 KiB
22Accepted4/416ms3992 KiB
23Accepted4/414ms3900 KiB