제출 #59480

#제출 시각아이디문제언어결과실행 시간메모리
59480ngkan146팀들 (IOI15_teams)C++11
34 / 100
4061 ms12788 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; #define l first #define r second int n; ii range[500000]; void init(int N, int A[], int B[]) { n = N; for(int i=0;i<n;i++) range[i] = {A[i], B[i]}; sort(range, range+n); } int can(int m, int lst[]) { set <int> s; int tmp = 0; for(int i=0;i<m && tmp <= n && s.size() <= 448;i++){ tmp = min(n+1, tmp + lst[i]); s.insert(lst[i]); } if (s.size() > 448 || tmp > n) return 0; int newM = 0; int ask[s.size()+5] = {}, askTimes[s.size()+5] = {}; for(set<int>::iterator it = s.begin(); it != s.end(); it++){ ask[newM++] = *it; } for(int i=0;i<m;i++){ askTimes[lower_bound(ask,ask+newM,lst[i]) - ask] ++; } priority_queue <int,vector<int>,greater<int> > current; int pivot = 0; for(int i=0;i<newM;i++){ while(pivot < n && range[pivot].l <= ask[i]){ current.push(range[pivot++].r); } while(current.size() && current.top() < ask[i]) current.pop(); if ((int)current.size() < ask[i] * askTimes[i]) return 0; int mjk = ask[i] * askTimes[i]; for(int _=0;_<mjk;_++) current.pop(); } 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...