Submission #381366

# Submission time Handle Problem Language Result Execution time Memory
381366 2021-03-25T07:02:54 Z IldarKA Doktor (COCI17_doktor) C++14
70 / 100
674 ms 35692 KB
#include <bits/stdc++.h>

using namespace std;
int n, a[500001];
map < pair < int, int >, int > m;
int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        int len = abs(a[i] - i);
        m[{(len + 1) / 2 + min(a[i], i), max(a[i], i) - (len + 1) / 2}]++;
    }
    int l = -1, r = -1;
    int mx = 0;
    for(auto it : m){
        if(it.second > mx){
            mx = it.second;
            l = it.first.first;
            r = it.first.second;
        }
    }
    int mn = min(l - 1, n - r);
    cout << a[l - mn] << " " << a[r + mn];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 492 KB Output is correct
2 Correct 2 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 876 KB Output is correct
2 Correct 102 ms 1532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 4880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 674 ms 24872 KB Output is correct
2 Correct 164 ms 5612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 321 ms 14828 KB Output is correct
2 Correct 293 ms 35692 KB Output is correct