Submission #70692

#TimeUsernameProblemLanguageResultExecution timeMemory
70692NavickTeams (IOI15_teams)C++17
34 / 100
4098 ms26208 KiB
#include <bits/stdc++.h> #include "teams.h" #define pb push_back #define pii pair<int, int> #define pb push_back using namespace std; typedef long long ll; const int maxN = 1e5 + 10; vector <int> qu[maxN]; multiset <int> st; int n; void init(int N, int A[], int B[]) { for (int i=0; i<N; i++) qu[A[i]].pb(B[i]); n = N; } int can(int m, int k[]) { st.clear(); sort(k, k + m); int ptr = 0; for (int i=1; i<=n; i++) { for (auto R : qu[i]) st.insert(R); while(ptr < m && k[ptr] == i) { if((int)st.size() < k[ptr]) return 0; for (int j=0; j<k[ptr]; j++) st.erase(st.begin()); ptr ++; } while(st.size() && *st.begin() <= i) st.erase(st.begin()); } 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...