This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |