Submission #116907

# Submission time Handle Problem Language Result Execution time Memory
116907 2019-06-14T04:11:41 Z ntrung03 Doktor (COCI17_doktor) C++17
80 / 100
731 ms 40108 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<double,double>> c;//radius, center
	for(int i=1;i<=n;i++){
		double cent = (a[i]+i)/2.0;
		c.push_back({abs(cent-i),cent});
	}
	map<double,pair<int,double>> 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,0.0));//count,center,radius
	for(auto c:cc){
		
		r = max(r,make_pair(c.second.first,make_pair(c.first,c.second.second)));
	}
	cout<<fixed<<setprecision(0)<<a[r.second.first-r.second.second]<<' '<<a[r.second.first+r.second.second];
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is 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 356 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 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1020 KB Output is correct
2 Correct 106 ms 9856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 6192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 731 ms 32552 KB Output is correct
2 Correct 176 ms 10724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 380 ms 19412 KB Output is correct
2 Correct 406 ms 40108 KB Output is correct