Submission #166014

#TimeUsernameProblemLanguageResultExecution timeMemory
166014theStaticMindDoktor (COCI17_doktor)C++14
70 / 100
480 ms34396 KiB
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("q.gir","r",stdin); // freopen("q.cik","w",stdout); int n; cin>>n; vector<int> arr(n+1); for(int i=1;i<=n;i++)cin>>arr[i]; map<double,int>data; for(int i=1;i<=n;i++){ data[(double)((double)arr[i]+i)/2.0]++; } double mx=0; int cnt=0; for(map<double,int>::iterator itr=data.begin();itr!=data.end();itr++){ if(itr->second>cnt){ cnt=itr->second; mx=itr->first; } } int l=(double)mx-min((double)n-mx,(double)mx-1.0),r=(double)mx+min((double)n-mx,(double)mx-1.0); cout<<arr[l]<<" "<<arr[r]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...