# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
116900 |
2019-06-14T04:01:39 Z |
ntrung03 |
Doktor (COCI17_doktor) |
C++17 |
|
602 ms |
23656 KB |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
int n;
cin>>n;
vector<int> a(n+1);
for(int i=1;i<=n;i++) cin>>a[i];
vector<pair<int,int>> c;//radius, center
for(int i=1;i<=n;i++){
int cent = ceil((a[i]+i)/2.0);
c.push_back({abs(cent-i),cent});
}
map<int,pair<int,int>> cc;//center, count,radius
for(auto c:c){
auto p = cc[c.second];
p.first+=1;
p.second = max(p.second,c.first);
cc[c.second] = p;
}
auto r = make_pair(1,make_pair(1,0));//count,center,radius
for(auto c:cc){
r = max(r,make_pair(c.second.first,make_pair(c.first,c.second.second)));
}
cout<<a[r.second.first-r.second.second]<<' '<<a[r.second.first+r.second.second];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
512 KB |
Output is correct |
2 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
768 KB |
Output is correct |
2 |
Incorrect |
104 ms |
5760 KB |
Integer 0 violates the range [1, 300000] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
4588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
602 ms |
23656 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
305 ms |
14020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |