Submission #602031

#TimeUsernameProblemLanguageResultExecution timeMemory
602031AmirElarbiTeams (IOI15_teams)C++14
0 / 100
4083 ms16316 KiB
#include <bits/stdc++.h> #define vi vector<int> #define gi greater<int> #define gr greater #define ve vector #define ll long long #define vf vector<float> #define vll vector<pair<ll,ll>> #define ii pair<int,int> #define pll pair<ll,ll> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define mp make_pair #define fi first #define se second #define INF 1e9 #define eps 1e-7 #define eps1 1e-2 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MAX_A 2e5+5 using namespace std; const int MOD = 1e9+7; const int nax = 2e5+5; typedef complex<int> Point; #define X real() #define Y imag() #include "teams.h" vii s; int n; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < N; ++i) { s.pb({A[i], B[i]}); } sort(s.begin(), s.end()); } int can(int M, int K[]) { priority_queue<int> pq; vii k; for (int i = 0; i < M; ++i) { k.pb({K[i], K[i]}); } sort(k.begin(), k.end()); int j = 0; for (int i = 0; i < n; ++i) { if(s[i].fi <= k[j].fi){ pq.push(s[i].se); } else { return 0; } while(!pq.empty() && pq.top() < k[j].fi){ pq.pop(); } while(j < M){ while(!pq.empty() && pq.top() >= k[j].fi && k[j].se != 0){ pq.pop(); k[j].se--; } if(!k[j].se) j++; else break; } if(j == M) break; } 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...