제출 #363038

#제출 시각아이디문제언어결과실행 시간메모리
363038casperwang마상시합 토너먼트 (IOI12_tournament)C++14
17 / 100
1080 ms1512 KiB
#include <bits/stdc++.h> #define pb emplace_back #define pii pair<int,int> #define ff first #define ss second using namespace std; #define debug(args...) kout("[ " + string(#args) + " ]", args) void kout() { cerr << endl; } template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); } template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; } int solve(int id, int N, int C, int R, int *K, int *S, int *E) { vector <int> now; for (int i = 0; i+1 < N; i++) { if (now.size() == id) now.pb(R); now.pb(K[i]); } if (now.size() == id) now.pb(R); // pary(now.begin(), now.end()); vector <int> tmp; int cnt = 0; for (int i = 0; i < C; i++) { pii mmax = pii(-1, -1); for (int j = S[i]; j <= E[i]; j++) mmax = max(mmax, pii(now[j], j)); if (mmax.ff == R) cnt++; for (int j = 0; j < now.size(); j++) if (j < S[i] || j > E[i] || j == mmax.ss) tmp.pb(now[j]); // pary(tmp.begin(), tmp.end()); now = tmp; tmp.clear(); } // debug(id, cnt); return cnt; } int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { pii ans = pii(0, 0); for (int i = 0; i < N; i++) ans = max(ans, pii(solve(i, N, C, R, K, S, E), -i)); return -ans.ss; }

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

tournament.cpp: In function 'int solve(int, int, int, int, int*, int*, int*)':
tournament.cpp:15:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |     if (now.size() == id) now.pb(R);
      |         ~~~~~~~~~~~^~~~~
tournament.cpp:18:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |   if (now.size() == id) now.pb(R);
      |       ~~~~~~~~~~~^~~~~
tournament.cpp:27:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for (int j = 0; j < now.size(); j++)
      |                     ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...