Submission #356691

#TimeUsernameProblemLanguageResultExecution timeMemory
356691urd05Teams (IOI15_teams)C++14
34 / 100
4035 ms11756 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; int n; int a[100000]; int b[100000]; typedef pair<int,int> P; P ind[100000]; int k[100000]; int m; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<n;i++) { a[i]=A[i]; b[i]=B[i]; ind[i]=P(a[i],i); } sort(ind,ind+n); } int can(int M, int K[]) { m=M; for(int i=0;i<m;i++) { k[i]=K[i]; } sort(k,k+m); int in=0; priority_queue<int,vector<int>,greater<int>> pq; for(int i=0;i<m;i++) { while (in<n&&ind[in].first<=k[i]) { pq.push(b[ind[in].second]); in++; } for(int j=0;j<k[i];j++) { while (!pq.empty()&&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...