제출 #1100740

#제출 시각아이디문제언어결과실행 시간메모리
1100740RiverFlow팀들 (IOI15_teams)C++14
34 / 100
4091 ms21328 KiB
#include <bits/stdc++.h> #define nl "\n" #define no "NO" #define yes "YES" #define fi first #define se second #define vec vector #define task "main" #define _mp make_pair #define ii pair<int, int> #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define evoid(val) return void(std::cout << val) #define FOR(i, a, b) for(int i = (a); i <= (b); ++i) #define FOD(i, b, a) for(int i = (b); i >= (a); --i) #define unq(x) sort(all(x)); x.resize(unique(all(x)) - x.begin()) using namespace std; template<typename U, typename V> bool maxi(U &a, V b) { if (a < b) { a = b; return 1; } return 0; } template<typename U, typename V> bool mini(U &a, V b) { if (a > b) { a = b; return 1; } return 0; } const int N = (int)2e5 + 9; const int mod = (int)1e9 + 7; void prepare(); void main_code(); int n, m; int a[N], b[N], k[N]; vector<int> ins[N]; void init(int N, int A[], int B[]) { n = N; FOR(i, 0, n - 1) { a[i] = A[i], b[i] = B[i]; ins[a[i]].push_back(i); } } int can(int M, int K[]) { priority_queue<int, vec<int>, greater<int>> pq; m = M; FOR(i, 0, m - 1) k[i] = K[i]; sort(k, k + m); for(int i = 0, lst = -1; i < m; ++i) { int x = k[i]; while (lst + 1 <= x) { ++lst; for(int j : ins[lst]) { pq.push(b[j]); } } int t = x; while (t > 0) { if (sz(pq) == 0) { t = -1; break ; } while (sz(pq) and pq.top() < x) { pq.pop(); } if (sz(pq)) { pq.pop(); --t; } } if (t == -1) { return 0; } lst = x; } return 1; } #ifdef LOCAL int aa[N], bb[N], kk[N]; int main() { freopen("main.inp", "r", stdin); freopen("main.out", "w", stdout); int n; cin >> n; FOR(i, 0, n - 1) cin >> aa[i] >> bb[i]; init(n, aa, bb); int q; cin >> q; while (q--) { int m; cin >> m; FOR(i, 0, m - 1) cin >> kk[i]; cout << can(m, kk) << nl; } } #endif

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

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:39:15: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   39 | void init(int N, int A[], int B[]) {
      |           ~~~~^
teams.cpp:28:11: note: shadowed declaration is here
   28 | const int N = (int)2e5 + 9;
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...