Submission #1195093

#TimeUsernameProblemLanguageResultExecution timeMemory
1195093n3rm1nTeams (IOI15_teams)C++20
34 / 100
4091 ms27152 KiB
#include "teams.h" #include <bits/stdc++.h> #define pb push_back using namespace std; const int maxn = 5e5 + 10; int n, a[maxn], b[maxn]; vector < int > hasr[maxn]; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; ++ i) { hasr[A[i]].pb(B[i]); } } int can(int M, int K[]) { int m = M; sort(K, K+m); int active = 0, pre = 0; priority_queue < int > q; for (int i = 0; i < m; ++ i) { // cout << " -- > " << K[i] << endl; while(!q.empty()) { int w = -q.top(); if(w >= K[i])break; q.pop(); } for (int j = pre + 1; j <= K[i]; ++ j) { for (auto x: hasr[j]) { if(x >= K[i])q.push(-x); } } int cnt = K[i]; while(cnt --) { if(q.size() == 0)return 0; int w = -q.top(); // cout << w << endl; q.pop(); } pre = K[i]; } // cout << "here " << endl; 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...