제출 #830879

#제출 시각아이디문제언어결과실행 시간메모리
830879drdilyor팀들 (IOI15_teams)C++17
0 / 100
4066 ms18268 KiB
#include<bits/stdc++.h> #include "teams.h" using namespace std; using ll = long long; int n; vector<pair<int,int>> arr; void init(int n, int* a, int* b) { ::n = n; arr.resize(n); for( int i = 0; i < n; i++) arr[i] = {a[i], b[i]}; } int can(int m, int* ts) { sort(ts, ts + m, greater()); sort(arr.begin(), arr.end(), greater()); vector<int> used(n); int team = 0; while (team < m) { int cnt = 0; for (int student = 0; student < n; student++) { if (used[student]) continue; auto [l,r] = arr[student]; if (l <= ts[team] && ts[team] <= r) { used[student] = 1; cnt++; } } if (cnt == ts[team]) team++; else break; } return team == m; }

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

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:8:15: warning: declaration of 'n' shadows a global declaration [-Wshadow]
    8 | void init(int n, int* a, int* b) {
      |           ~~~~^
teams.cpp:6:5: note: shadowed declaration is here
    6 | int n;
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...