85272024-01-21 12:31:28BakosCsongorA Barbárcpp17Wrong answer 0/1003ms4896 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("input1.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] << " ";
            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
1Wrong answer3ms1808 KiB
2Wrong answer3ms2060 KiB
subtask20/12
3Wrong answer3ms2256 KiB
4Wrong answer3ms2608 KiB
5Wrong answer3ms2488 KiB
6Wrong answer3ms2724 KiB
7Wrong answer3ms2760 KiB
8Wrong answer2ms2732 KiB
9Wrong answer3ms2960 KiB
10Wrong answer3ms3216 KiB
11Wrong answer2ms3156 KiB
12Wrong answer3ms3388 KiB
subtask30/28
13Wrong answer2ms3368 KiB
14Wrong answer3ms3596 KiB
15Wrong answer3ms3580 KiB
16Wrong answer3ms3680 KiB
17Wrong answer3ms3640 KiB
18Wrong answer3ms3644 KiB
19Wrong answer3ms3652 KiB
20Wrong answer3ms3752 KiB
21Wrong answer3ms3648 KiB
subtask40/35
22Wrong answer3ms3644 KiB
23Wrong answer3ms3652 KiB
24Wrong answer3ms3876 KiB
25Wrong answer3ms3776 KiB
26Wrong answer3ms3772 KiB
27Wrong answer3ms3780 KiB
28Wrong answer3ms4004 KiB
29Wrong answer3ms4216 KiB
30Wrong answer3ms4240 KiB
31Wrong answer3ms4376 KiB
subtask50/25
32Wrong answer3ms4240 KiB
33Wrong answer3ms4240 KiB
34Wrong answer3ms4476 KiB
35Wrong answer3ms4452 KiB
36Wrong answer3ms4516 KiB
37Wrong answer3ms4408 KiB
38Wrong answer3ms4412 KiB
39Wrong answer3ms4636 KiB
40Wrong answer3ms4672 KiB
41Wrong answer3ms4620 KiB
42Wrong answer3ms4624 KiB
43Wrong answer3ms4624 KiB
44Wrong answer3ms4620 KiB
45Wrong answer3ms4628 KiB
46Wrong answer3ms4624 KiB
47Wrong answer3ms4756 KiB
48Wrong answer3ms4872 KiB
49Wrong answer3ms4896 KiB
50Wrong answer3ms4704 KiB