제출 #787068

#제출 시각아이디문제언어결과실행 시간메모리
787068GusterGoose27팀들 (IOI15_teams)C++17
34 / 100
4066 ms11884 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int MAXN = 1e5+5; pii students[MAXN]; int n; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) { students[i] = pii(A[i]-1, B[i]-1); } sort(students, students+n); } int can(int m, int k[]) { sort(k, k+m); int j = 0; priority_queue<int, vector<int>, greater<int>> active; for (int i = 0; i < m; i++) { k[i]--; while (j < n && students[j].first <= k[i]) { active.push(students[j++].second); } while (!active.empty() && active.top() < k[i]) active.pop(); for (int j = 0; j <= k[i]; j++) { if (active.empty()) return 0; active.pop(); } } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:31:12: warning: declaration of 'j' shadows a previous local [-Wshadow]
   31 |   for (int j = 0; j <= k[i]; j++) {
      |            ^
teams.cpp:23:6: note: shadowed declaration is here
   23 |  int j = 0;
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...