Submission #364684

#TimeUsernameProblemLanguageResultExecution timeMemory
364684BartolMTeams (IOI15_teams)C++17
34 / 100
4057 ms10220 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; const int INF=0x3f3f3f3f; const int MAXN=1e5+5; int n; pii p[MAXN]; multiset <int> S; void init(int N, int A[], int B[]) { n=N; for (int i=0; i<n; ++i) p[i]=mp(A[i], B[i]); sort(p, p+n); } int can(int M, int K[]) { S.clear(); sort(K, K+M); int ind=0; for (int i=0; i<M; ++i) { while (ind<n && p[ind].X<=K[i]) S.insert(p[ind++].Y); while (!S.empty() && *S.begin()<K[i]) S.erase(S.begin()); while (K[i] && !S.empty()) { S.erase(S.begin()); K[i]--; } if (K[i]) return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...