Submission #60738

#TimeUsernameProblemLanguageResultExecution timeMemory
60738istleminTeams (IOI15_teams)C++14
0 / 100
4065 ms42108 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = a; i<int(b);++i) #define all(v) v.begin(),v.end() #define sz(v) v.size() #define trav(a,c) for(auto a: c) typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; ll n; vi a; vi b; void init(int N, int A[], int B[]) { n = N; a.resize(n); b.resize(n); rep(i,0,n) { a[i] = A[i]-1; b[i] = B[i]-1; } } int can(int M, int K[]) { vi k; k.assign(n,0); rep(i,0,M) k[K[i]-1] += K[i]; vi add(n+1); vector<vi> ends(n); rep(i,0,n){ ends[a[i]].push_back(b[i]+1); add[a[i]]++; add[b[i]+1]--; } ll sum = 0; multiset<ll> currEnds; rep(i,0,n){ sum+=add[i]; rep(j,0,ends[i].size()) currEnds.insert(ends[i][j]); if(k[i]>sum) { cout<<0<<endl; return 0; } sum-=k[i]; rep(j,0,k[i]){ add[*currEnds.begin()]++; currEnds.erase(currEnds.begin()); } } cout<<1<<endl; 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...