Submission #116897

# Submission time Handle Problem Language Result Execution time Memory
116897 2019-06-14T03:58:07 Z ntrung03 Doktor (COCI17_doktor) C++17
10 / 100
664 ms 36292 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 = (a[i]+i)/2;
		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 2 ms 384 KB Integer 0 violates the range [1, 12]
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't 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 Incorrect 4 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 4588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 664 ms 23640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 318 ms 13920 KB Output is correct
2 Correct 443 ms 36292 KB Output is correct