Submission #448015

#TimeUsernameProblemLanguageResultExecution timeMemory
448015dxz05Jousting tournament (IOI12_tournament)C++14
17 / 100
1095 ms1148 KiB
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math") #pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt") #include <bits/stdc++.h> using namespace std; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { vector<int> ans(N, 0); for (int i = 0; i < N; i++){ vector<int> a; a.reserve(N); for (int j = 0; j < i; j++) a.push_back(K[j]); a.push_back(R); for (int j = i; j < N - 1; j++) a.push_back(K[j]); for (int it = 0; it < C; it++){ int mx = 0; bool hero = false; for (int j = S[it]; j <= E[it]; j++){ mx = max(mx, a[j]); if (a[j] == R) hero = true; } if (mx == R) ans[i]++; if (hero && mx > R) break; a[S[it]] = mx; a.erase(a.begin() + S[it] + 1, a.begin() + E[it] + 1); } } int pos = max_element(ans.begin(), ans.end()) - ans.begin(); return pos; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...