제출 #863784

#제출 시각아이디문제언어결과실행 시간메모리
863784sunwukong123팀들 (IOI15_teams)C++14
0 / 100
4022 ms31756 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #ifdef LOCAL void debug_out() {cerr<<endl;} template <typename Head, typename... Tail> void debug_out(Head _H, Tail... _T) {cerr<<" "<<to_string(_H);debug_out(_T...);} #define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__) #else #define debug(...) #endif const int MAXN = 200005; const int inf=1000000500ll; const long long oo =1000000000000000500ll; const int MOD = (int)1e9 + 7; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef pair<int,int> pi; vector<pi> vec; int n; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<n;i++){ vec.push_back({A[i],B[i]}); } sort(vec.begin(),vec.end()); } int can(int m, int K[]) { int tot=0; for(int i=0;i<m;i++){ tot+=K[i]; } if(tot>n)return 0; priority_queue<int,vector<int>,greater<int>> pq; vector<pi> events; for(auto x:vec){ events.push_back({x.first,x.second}); } for(int i=0;i<m;i++){ for(int j=0;j<K[i];j++){ events.push_back({K[i],inf}); } } sort(events.begin(),events.end()); for(auto x:events){ while(pq.size() && pq.top() < x.first)continue; if(x.second==inf){ if(pq.empty())return 0; else pq.pop(); } else{ pq.push(x.second); } } 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...