Submission #125584

#TimeUsernameProblemLanguageResultExecution timeMemory
125584baluteshihTeams (IOI15_teams)C++14
34 / 100
4051 ms29184 KiB
#include "teams.h" #include <bits/stdc++.h> #define pb push_back #define MP make_pair #define F first #define S second #define MEM(i,j) memset(i,j,sizeof i) #define ALL(v) v.begin(),v.end() #define ET cout << "\n" #define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;} using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; vector<int> v[500005]; void init(int N, int A[], int B[]) { for(int i=0;i<N;++i) v[A[i]].pb(B[i]); } int can(int M, int K[]) { priority_queue<int,vector<int>,greater<int>> pq; vector<int> query; for(int i=0;i<M;++i) query.pb(K[i]); sort(ALL(query)); for(int i=0,nw=1,cnt;i<M;++i) { for(;nw<=query[i];++nw) for(int j:v[nw]) pq.push(j); for(cnt=query[i];pq.size()&&cnt;pq.pop()) if(pq.top()>=query[i]) --cnt; if(cnt) return 0; } 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...