제출 #541443

#제출 시각아이디문제언어결과실행 시간메모리
541443MohamedFaresNebili마상시합 토너먼트 (IOI12_tournament)C++14
17 / 100
1089 ms1964 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("Ofast") #pragma GCC target ("avx2") using namespace std; using ll = long long; using ii = pair<ll, ll>; #define ff first #define ss second #define pb push_back /// #define int ll const int MOD = 1e9 + 7; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { int res = 0, curr = 0; for(int l = 0; l < N; l++) { vector<int> arr; for(int i = 0; i < l; i++) arr.pb(K[i]); arr.pb(R); for(int i = l; i < N - 1; i++) arr.pb(K[i]); int calc = 0; for(int i = 0; i < C; i++) { int lf = S[i], rf = E[i]; vector<int> new_arr; for(int j = 0; j < lf; j++) new_arr.pb(arr[j]); int mx = -1; for(int j = lf; j <= rf; j++) mx = max(mx, arr[j]); if(mx == R) calc++; new_arr.pb(mx); for(int j = rf + 1; j < arr.size(); j++) new_arr.pb(arr[j]); swap(arr, new_arr); } if(calc > curr) { curr = calc, res = l; } } return res; }

컴파일 시 표준 에러 (stderr) 메시지

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