제출 #488459

#제출 시각아이디문제언어결과실행 시간메모리
488459blue팀들 (IOI15_teams)C++17
34 / 100
4091 ms14896 KiB
#include "teams.h" #include <vector> #include <algorithm> #include <set> #include <queue> #include <iostream> using namespace std; using pii = pair<int, int>; using vpii = vector<pii>; using vi = vector<int>; int N; vpii PG; void init(int N_, int A[], int B[]) { N = N_; for(int i = 0; i < N; i++) PG.push_back({A[i], B[i]}); sort(PG.begin(), PG.end(), [] (pii p, pii q) { return p.second < q.second; }); } int can(int M, int K[]) { sort(K, K+M); vpii P = PG; vi done(M, 0); int i = 0; vi used(N, 0); for(int t = 0; t < M; t++) { // cerr << "t = " << t << '\n'; for(int i = 0; i < N; i++) { if(done[t] == K[t]) break; if(used[i]) continue; // cerr << i << ' ' << used[i] << '\n'; if(!(P[i].first <= K[t] && K[t] <= P[i].second)) continue; // cerr << "? " << P[i].first << ' ' << K[t] << ' ' << P[i].second << "\n"; done[t]++; used[i]++; } if(done[t] != K[t]) return 0; } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:41:17: warning: declaration of 'i' shadows a previous local [-Wshadow]
   41 |         for(int i = 0; i < N; i++)
      |                 ^
teams.cpp:34:9: note: shadowed declaration is here
   34 |     int i = 0;
      |         ^
teams.cpp:34:9: warning: unused variable 'i' [-Wunused-variable]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...