86922024-01-25 12:30:41BakosCsongorA Barbárcpp17Wrong answer 12/1001.082s37700 KiB
// insert brief description of the solution here

#include <bits/stdc++.h>

using namespace std;

int main() {
    vector<array<int,2>> v;
    vector<array<int,2>> v_original;
    vector<array<int,2>>::iterator it;
    // uncomment the following lines if you want to read/write from files
    //ifstream cin("input0.txt");
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        int x;
        cin >> x;
        v.push_back({x,i});
        v_original.push_back({x,i});
    }
    it = v.begin();

    for(int i = 0; i < N; i++){
        int actual = i;
        for(int j = 0; j < N; j++){
            if(v.size() == 1)
                cout << v.at(0)[1] << "\t";
            else if(actual == 0){
                v.erase(it + (actual));
            }
            else if(actual == (v.size() - 1)){
                actual--;
                v.erase(it + (actual+1));
            }
            else if((v.at(actual)[0] - v.at(actual-1)[0]) < (v.at(actual+1)[0] - v.at(actual)[0])){
                actual--;
                v.erase(it + (actual+1));
            }
            else if((v.at(actual)[0] - v.at(actual-1)[0]) > (v.at(actual+1)[0] - v.at(actual)[0])){
                v.erase(it + (actual));
            }
            else{
                actual--;
                v.erase(it + (actual+1));
            }
        }
        v.clear();
        for(int i=0; i<v_original.size(); i++){
            v.push_back({v_original.at(i)[0], v_original.at(i)[1]});
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms2056 KiB
subtask212/12
3Accepted3ms2224 KiB
4Accepted3ms2436 KiB
5Accepted3ms2712 KiB
6Accepted3ms2836 KiB
7Accepted3ms3004 KiB
8Accepted3ms3000 KiB
9Accepted3ms3056 KiB
10Accepted3ms3304 KiB
11Accepted3ms3296 KiB
12Accepted3ms3460 KiB
subtask30/28
13Accepted32ms3568 KiB
14Accepted43ms3532 KiB
15Wrong answer54ms3548 KiB
16Wrong answer54ms3556 KiB
17Wrong answer71ms3908 KiB
18Accepted46ms4004 KiB
19Accepted68ms3920 KiB
20Wrong answer68ms3928 KiB
21Wrong answer71ms4148 KiB
subtask40/35
22Time limit exceeded1.065s5876 KiB
23Time limit exceeded1.052s6572 KiB
24Time limit exceeded1.072s7580 KiB
25Time limit exceeded1.065s8288 KiB
26Time limit exceeded1.044s8168 KiB
27Time limit exceeded1.072s9248 KiB
28Time limit exceeded1.065s9896 KiB
29Time limit exceeded1.074s10404 KiB
30Time limit exceeded1.077s10624 KiB
31Time limit exceeded1.074s10560 KiB
subtask50/25
32Time limit exceeded1.082s24472 KiB
33Time limit exceeded1.062s22940 KiB
34Time limit exceeded1.062s24764 KiB
35Time limit exceeded1.062s23280 KiB
36Time limit exceeded1.074s24412 KiB
37Time limit exceeded1.049s24964 KiB
38Time limit exceeded1.082s24680 KiB
39Time limit exceeded1.06s24940 KiB
40Time limit exceeded1.075s24860 KiB
41Time limit exceeded1.078s24976 KiB
42Time limit exceeded1.077s26360 KiB
43Time limit exceeded1.062s35928 KiB
44Time limit exceeded1.065s37400 KiB
45Time limit exceeded1.08s37524 KiB
46Time limit exceeded1.044s37584 KiB
47Time limit exceeded1.062s37668 KiB
48Time limit exceeded1.074s37604 KiB
49Time limit exceeded1.059s37600 KiB
50Time limit exceeded1.062s37700 KiB