Submission #381366

#TimeUsernameProblemLanguageResultExecution timeMemory
381366IldarKADoktor (COCI17_doktor)C++14
70 / 100
674 ms35692 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...