제출 #1013260

#제출 시각아이디문제언어결과실행 시간메모리
1013260d4xn팀들 (IOI15_teams)C++17
34 / 100
4027 ms34364 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int N = 5e5+5; int n; vector<int> lp[N]; void init(int nn, int a[], int b[]) { n = nn; for (int i = 0; i < n; i++) { lp[a[i]].push_back(b[i]); } } int can(int m, int k[]) { sort(k, k+m); int L = 0; int ok = 1; priority_queue<int> pq; for (int i = 1; i <= n; i++) { for (int& j : lp[i]) { pq.push(-j); } while (L < m && k[L] == i) { int c = k[L]; while (!pq.empty() && c) { pq.pop(); c--; } if (c) { ok = 0; break; } L++; } if (L == m) break; while (!pq.empty() && -pq.top() <= i) pq.pop(); } //cerr << ok << endl; return ok; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...