Submission #549226

#TimeUsernameProblemLanguageResultExecution timeMemory
549226xdfactor2034Doktor (COCI17_doktor)C++17
30 / 100
1088 ms7372 KiB
#include<bits/stdc++.h> using namespace std; const int maxn = 5e5+5; int ar[maxn]; int lk[maxn]; signed main() { //freopen("a.in", "r", stdin); //freopen("a.out", "w", stdout); int N; cin >> N; int res = 0; int a = -1, b = -1; for(int i = 1; i <= N; i++) { cin >> ar[i]; lk[ar[i]] = i;} for(int i = 1; i <= N; i++) { for(int j = i; j <= N; j++) { reverse(ar+i, ar+j+1); int cnt = 0; for(int k = 1; k <= N; k++) if(ar[k] == k) cnt++; reverse(ar+i, ar+j+1); if(cnt > res) a = ar[i], b = ar[j], res = cnt; } } cout << a << ' ' << b << '\n'; }
#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...