Submission #473210

#TimeUsernameProblemLanguageResultExecution timeMemory
473210_L__Doktor (COCI17_doktor)C++17
30 / 100
1095 ms4044 KiB
// This code is written by _L__ #include <bits/stdc++.h> using namespace std; #define endl '\n' #define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); typedef long long ll; typedef long double ld; const int mod = 1e9+7, N = 2e5+13, inf = 1e9+1; const ld E = 1e-6; #define ff first #define ss second int main(void){ F_word; int n; cin >> n; int sum = 0, ans1 = 1, ans2 = 1; int a[n+2] = {}, doc[n+4] = {}; for(int i = 1; i <= n; ++i){cin >> a[i]; doc[a[i]] = a[i]-i;} for(int i = 1; i <= n; ++i){ for(int j = i; j <= n; ++j){ reverse(a+i, a+j+1); ll x = 0; for(int k = 1; k <= n; ++k) x += (a[k] == k); if(x >= sum){ ans1 = i, ans2 = j, sum = x; } reverse(a+i, a+j+1); } } cout << a[ans1] << ' ' << a[ans2] << 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...