Submission #874190

#TimeUsernameProblemLanguageResultExecution timeMemory
874190MatjazJousting tournament (IOI12_tournament)C++14
0 / 100
1044 ms1884 KiB
#include <vector> #include <algorithm> #include <iostream> using namespace std; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { vector<int> p(K, K + N - 1); p.push_back(R); int best_position = N; int best_wins = 0; for (int tmp=N-1;tmp>=0;tmp--){ int wins = 0; vector<int> t(p); for (int i=0;i<C;i++){ int winner = t[S[i]]; for (int j=S[i];j<=E[j];j++){ winner = max(winner,t[j]); } if (winner == R) wins++; t[S[i]] = winner; for (int j=E[i]+1;j<N;j++){ t[S[i] + j - E[i]] = t[j]; } } if (wins >= best_wins){ best_wins = wins; best_position = tmp; } //cout << tmp << " " << wins << endl; if (tmp > 0) swap(p[tmp-1], p[tmp]); } return best_position; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...