Submission #1218726

#TimeUsernameProblemLanguageResultExecution timeMemory
1218726viduxTeams (IOI15_teams)C++17
34 / 100
4094 ms12408 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef pair<ll, ll> pll; typedef vector<ll> vl; const ll LLINF = 1e18; vector<pii> a; int n; void init(int N, int A[], int B[]) { n = N; a.resize(n); for (int i = 0; i < n; i++) a[i].first = A[i], a[i].second = B[i]; sort(a.begin(), a.end()); } int can(int m, int t[]) { priority_queue<int, vi, greater<int>> pq; sort(t, t+m); bool ok = 1; for (int i = 0, j = 0; i < m && ok; i++) { int need = t[i]; while (j < n && a[j].first <= need) pq.push(a[j++].second); while ((int)pq.size() && pq.top() < need) pq.pop(); while (need && (int)pq.size()) { pq.pop(); need--; } if (need) ok = 0; } //cout << 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...