# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
116826 |
2019-06-14T01:53:21 Z |
minhcool |
Doktor (COCI17_doktor) |
C++17 |
|
144 ms |
37980 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n, a[500001], pre[500001], mx = -1, ans1, ans2;
vector<int> change[500001];
signed main(){
ios_base::sync_with_stdio(0);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
pre[i] = pre[i - 1];
if(a[i] == i) pre[i]++;
if((a[i] + i) % 2) continue;
change[(a[i] + i) / 2].push_back(abs(a[i] - i) / 2);
}
for(int i = 1; i <= n; i++){
sort(change[i].begin(), change[i].end());
for(int j = change[i].size() - 1; j >= 0; j--){
if(mx < (j + 1 - pre[change[i][j] + i] + pre[i - change[i][j] - 1])){
mx = j + 1 - pre[change[i][j] + i] + pre[i - change[i][j] - 1];
ans1 = a[i - change[i][j]];
ans2 = a[i + change[i][j]];
}
}
}
cout << ans1 << " " << ans2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
12076 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
12160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
12100 KB |
Output is correct |
2 |
Incorrect |
12 ms |
12160 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
12160 KB |
Output is correct |
2 |
Correct |
12 ms |
12160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
12288 KB |
Output is correct |
2 |
Correct |
12 ms |
12176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
12288 KB |
Output is correct |
2 |
Incorrect |
12 ms |
12288 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
12416 KB |
Output is correct |
2 |
Incorrect |
43 ms |
18780 KB |
Integer 0 violates the range [1, 300000] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
15096 KB |
Output is correct |
2 |
Incorrect |
22 ms |
14200 KB |
Integer 0 violates the range [1, 100000] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
144 ms |
28908 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
22044 KB |
Output is correct |
2 |
Correct |
101 ms |
37980 KB |
Output is correct |