Submission #1153087

#TimeUsernameProblemLanguageResultExecution timeMemory
1153087julia_08Jousting tournament (IOI12_tournament)C++20
17 / 100
1095 ms632 KiB
#include <bits/stdc++.h> using namespace std; int GetBestPosition(int n, int c, int r, int *k, int *s, int *e){ pair<int, int> best = {-1, 0}; for(int i=0; i<n; i++){ vector<int> cur_k; for(int j=0; j<i; j++) cur_k.push_back(k[j]); cur_k.push_back(r); for(int j=i; j<n-1; j++) cur_k.push_back(k[j]); int ans = 0; for(int j=0; j<c; j++){ int max_r = 0; for(int l=s[j]; l<=e[j]; l++){ max_r = max(max_r, cur_k[l]); } if(r == max_r) ans ++; vector<int> new_k; for(int l=0; l<s[j]; l++) new_k.push_back(cur_k[l]); new_k.push_back(max_r); for(int l=e[j]+1; l<(int) cur_k.size(); l++) new_k.push_back(cur_k[l]); cur_k = new_k; } if(ans > best.first){ best = {ans, i}; } else if(ans == best.first){ if(i < best.second){ best = {ans, i}; } } } return best.second; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...