Submission #602044

#TimeUsernameProblemLanguageResultExecution timeMemory
602044AmirElarbiTeams (IOI15_teams)C++14
34 / 100
4085 ms12252 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,vi ,gi> 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 < M; ++i) { while(j < n && s[j].fi <= k[i].fi){ pq.push(s[j].se); j++; } while(!pq.empty() && pq.top() < k[i].fi){ pq.pop(); } while(!pq.empty() && pq.top() >= k[i].fi && k[i].se != 0){ pq.pop(); k[i].se--; } if(k[i].se) 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...