Submission #483597

#TimeUsernameProblemLanguageResultExecution timeMemory
483597blueJousting tournament (IOI12_tournament)C++17
17 / 100
1094 ms1224 KiB
#include <vector> #include <iostream> #include <algorithm> using namespace std; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { int best_p = -1; int rounds = -1; for(int p = 0; p < N; p++) { // cerr << "\n\n\n\n p= " << p << '\n'; int this_ans = 0; vector<int> original; for(int i = 0; i < p; i++) original.push_back(K[i]); original.push_back(R); for(int i = p; i < N-1; i++) original.push_back(K[i]); // for(int o: original) cerr << o << ' '; // cerr << '\n'; vector<int> nw; for(int c = 0; c < C; c++) { // cerr << S[c] << ' ' << E[c] << " -> "; nw.clear(); original.clear(); for(int i = 0; i < S[c]; i++) nw.push_back(original[i]); int y = -1; for(int i = S[c]; i <= E[c]; i++) y = max(y, original[i]); if(y == R) this_ans++; nw.push_back(y); for(int i = E[c]+1; i < N; i++) nw.push_back(original[i]); swap(original, nw); // cerr << "! "; // for(int o: original) cerr << o << ' '; // cerr << '\n'; } if(this_ans > rounds) { rounds = this_ans; best_p = p; } // cerr << p << ' ' << this_ans << '\n'; } return best_p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...