Submission #777502

#TimeUsernameProblemLanguageResultExecution timeMemory
777502boris_mihovTeams (IOI15_teams)C++17
0 / 100
165 ms33056 KiB
#include "teams.h" #include <algorithm> #include <iostream> #include <numeric> #include <cassert> #include <vector> #include <queue> typedef long long llong; const int MAXN = 500000 + 10; const int INF = 1e9; int n; std::vector <int> v[MAXN]; void init(int N, int A[], int B[]) { n = N; for (int i = 1 ; i <= n ; ++i) { v[A[i]].push_back(B[i]); } } std::priority_queue <int> pq; int can(int M, int K[]) { while (!pq.empty()) { pq.pop(); } int ptr = 0; std::sort(K, K + M); for (int i = 0 ; i < M ; ++i) { while (ptr + 1 <= K[i]) { ptr++; for (const int &j : v[ptr]) { pq.push(-j); } } while (pq.size() && -pq.top() < K[i]) { pq.pop(); } if (pq.empty()) { return 0; } pq.pop(); } 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...