# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
381377 |
2021-03-25T07:06:33 Z |
IldarKA |
Doktor (COCI17_doktor) |
C++14 |
|
624 ms |
32492 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 = -1;
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 |
1 ms |
504 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 |
4 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 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 |
95 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
72 ms |
4844 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
624 ms |
24812 KB |
Output is correct |
2 |
Correct |
166 ms |
2412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
314 ms |
14700 KB |
Output is correct |
2 |
Correct |
290 ms |
32492 KB |
Output is correct |