제출 #389771

#제출 시각아이디문제언어결과실행 시간메모리
389771PedroBigManTeams (IOI15_teams)C++14
34 / 100
4083 ms44076 KiB
#include "teams.h" /* Author of all code: Pedro BIGMAN Dias Last edit: 15/02/2021 */ #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <deque> #include <list> #include <iomanip> #include <stdlib.h> #include <time.h> #include <cstring> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define whole(x) x.begin(),x.end() #define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl #define INF 500000000LL #define EPS 0.00000001 #define pi 3.14159 ll mod=1000000007LL; template<class A=ll> void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;} template<class A=ll> void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}} ll N; vector<pl> p; void init(int n, int A[], int B[]) { N = (ll) n; REP(i,0,N) {p.pb({(ll) A[i], (ll) B[i]});} return; } int can(int M, int k[]) { vector<pl> mp; vector<ll> K; REP(i,0,M) {K.pb((ll) k[i]);} sort(whole(K)); REP(i,0,N) { ll l = (ll) (lower_bound(whole(K),p[i].ff) - K.begin()); ll r = (ll) (upper_bound(whole(K),p[i].ss) - K.begin()) - 1LL; if(l>r) {mp.pb({-1,-1});} else {mp.pb({l,r});} } sort(whole(mp)); multiset<ll> ends; ll val; ll ind=0LL; REP(i,0,M) { while(ind<N && mp[ind].ff<=i) { ends.insert(mp[ind].ss); ind++; } ll needed=K[i]; while(needed>0 && ends.size()>0) { val=*ends.begin(); if(val>=i) {needed--;} ends.erase(ends.begin()); } if(needed>0) {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...