Submission #619598

#TimeUsernameProblemLanguageResultExecution timeMemory
619598MounirTeams (IOI15_teams)C++14
34 / 100
4027 ms28692 KiB
#include "teams.h" #include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define chmax(x, v) x = max(x, v) #define chmin(x, v) x = min(x, v) #define pii pair<int, int> #define pb push_back #define sz(x) (int)x.size() #define x first #define y second //#define int long long using namespace std; const int N_ELEVES = 3e5; int nInters; vector<int> fins[N_ELEVES]; void init(int N, int A[], int B[]) { nInters = N; for (int i = 0; i < N; ++i) fins[A[i]].pb(B[i]); nInters++; } int can(int M, int K[]) { int nReqs[nInters]; for (int i = 0; i < nInters; ++i) nReqs[i] = 0; for (int iReq = 0; iReq < M; ++iReq) nReqs[K[iReq]]++; priority_queue<int> actus; for (int i = 0; i < nInters; ++i){ for (int fin : fins[i]) actus.push(-fin); while (nReqs[i]--){ int nb = 0; while (!actus.empty() && nb != i){ nb += (-actus.top() >= i); actus.pop(); } if (nb < 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...