Submission #473166

#TimeUsernameProblemLanguageResultExecution timeMemory
473166Ahmed_SolymanDoktor (COCI17_doktor)C++14
10 / 100
1098 ms4044 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n;cin>>n; vector<ll>arr(n); for(auto &i:arr)cin>>i; int x=1,y=1; int mx=0; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ reverse(arr.begin()+i,arr.begin()+j+1); ll cnt=0; for(ll k=i;k<=j;k++){ cnt+=(arr[k]==i+1); } if(cnt>mx){ x=arr[i];y=arr[j]; mx=cnt; } reverse(arr.begin()+i,arr.begin()+j+1); } } cout<<arr[x]<<" "<<arr[y]<<endl; }
#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...