제출 #448011

#제출 시각아이디문제언어결과실행 시간메모리
448011dxz05마상시합 토너먼트 (IOI12_tournament)C++14
17 / 100
1086 ms1740 KiB
#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; for (int j = S[it]; j <= E[it]; j++){ mx = max(mx, a[j]); } if (mx == R) ans[i]++; 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...