Submission #473206

#TimeUsernameProblemLanguageResultExecution timeMemory
473206BidoTeimaDoktor (COCI17_doktor)C++17
30 / 100
1099 ms2124 KiB
/// isA AC #include <bits/stdc++.h> using namespace std; using ll = long long; void ACPLS(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } #define tc int tttttt;cin>>tttttt;while(tttttt--) #define sumrange(l,r,arr) (l==0?arr[r]:arr[r]-arr[l-1]) #define all(v) v.begin(),v.end() int main(){ ACPLS(); int n; cin>>n; int a[n+5]; for(int i = 1; i <= n; i++){ cin>>a[i]; } int ans=0; pair<int,int> best={a[1],a[1]}; for(int i = 1; i <= n; i++){ for(int j = i+1; j <= n; j++){ int res=0; for(int k = i; k <= j; k++){ if(a[k]==k)--res; if(a[k]==j-k+i)++res; } if(res>ans){ ans=res; best={a[i],a[j]}; } } } cout<<best.first<<' '<<best.second; }
#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...