Submission #639007

#TimeUsernameProblemLanguageResultExecution timeMemory
639007ggohTeams (IOI15_teams)C++14
34 / 100
4035 ms19044 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; #define sz(v) ((int)(v).size()) typedef long long lint; typedef pair<int,int> pii; int n; pii d[500003]; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<n;i++)d[i]={A[i],B[i]}; sort(d,d+n); } int can(int M, int K[]) { sort(K,K+M); int piv=0; int ans=1; priority_queue<int>P; for(int i=0;i<M;i++) { while(piv<n && d[piv].first<=K[i]) { P.push({-d[piv].second}); piv++; } int o=K[i]; while(o && !P.empty()) { int p=P.top();P.pop(); if(-p <K[i])continue; else o--; } if(o!=0) { ans=0; break; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...