Submission #116923

# Submission time Handle Problem Language Result Execution time Memory
116923 2019-06-14T04:28:04 Z ntrung03 Doktor (COCI17_doktor) C++17
10 / 100
722 ms 32604 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){
		if(r.first-r.second.second<c.second.first-c.second.second)
		{
			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 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 640 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 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 85 ms 6208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 722 ms 32604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 373 ms 19244 KB Output isn't correct
2 Halted 0 ms 0 KB -