제출 #946067

#제출 시각아이디문제언어결과실행 시간메모리
946067itslq마상시합 토너먼트 (IOI12_tournament)C++17
17 / 100
1060 ms1492 KiB
#include <bits/stdc++.h> using namespace std; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { int M, X, ans = 0, ansind = 0; vector<int> remaining; for (int i = 0; i < N; i++) remaining.push_back(K[i]); for (int i = 0; i < N; i++) { X = 0; vector<int> knights = remaining; knights.insert(next(knights.begin(), i), R); for (int j = 0; j < C; j++) { M = 0; for (int k = S[j]; k <= E[j]; k++) M = max(M, knights[k]); knights.erase(next(knights.begin(), S[j]), next(knights.begin(), E[j] + 1)); knights.insert(next(knights.begin(), S[j]), M); if (M == R) X++; } if (X > ans) { ans = X; ansind = i; } } return ansind; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...