Submission #830163

#TimeUsernameProblemLanguageResultExecution timeMemory
830163LiudasJousting tournament (IOI12_tournament)C++17
17 / 100
1091 ms2396 KiB
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <vector> #include <algorithm> //#include "tournament.h" using namespace std; int GetBestPosition(int N, int C, int R, int K[], int S[], int E[]){ vector<int> arr(N-1); int id = 0, ms = 0; for(int i = 0; i < N-1; i ++){ arr[i] = K[i]; } for(int i = 0; i < N; i ++){ vector<int> brr = arr; int score = 0; brr.insert(brr.begin()+i, R); for(int j = 0; j < C; j ++){ vector<int> crr; int s = S[j], e = E[j]; for(int k = 0; k < s; k ++){ crr.push_back(brr[k]); } for(int k = e + 1; k < brr.size(); k ++){ crr.push_back(brr[k]); } int maxi = *max_element(brr.begin() + s, brr.begin() + e + 1); if(maxi == R)score++; crr.insert(crr.begin() + s, maxi); swap(brr, crr); } if(score > ms){ ms = score; id = i; } } return id; }

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:24:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             for(int k = e + 1; k < brr.size(); k ++){
      |                                ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...