제출 #1025459

#제출 시각아이디문제언어결과실행 시간메모리
1025459vjudge1팀들 (IOI15_teams)C++17
34 / 100
4029 ms42544 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; struct fenwick_tree_2d{ map<int,int>data[500100]; } T; int N_; vector<pair<int,int>>stuff; void init(int N, int A[], int B[]) { N_=N; for(int i=0;i<N;i++) stuff.push_back({A[i],B[i]}); sort(stuff.begin(),stuff.end()); } int dobig(map<int,int>mp){ int pos=0; priority_queue<int>pq; for(auto[i,x]:mp){ while(pos<N_&&stuff[pos].first<=i) pq.push(-stuff[pos++].second); while(pq.size()&&-pq.top()<i) pq.pop(); while(x--){ if(pq.empty())return 0; pq.pop(); } } return 1; } int can(int M, int K[]) { map<int,int>REQ; int SM=0; for(int i=0;i<M;i++) SM+=K[i], REQ[K[i]]+=K[i],SM=min(N_+1,SM); if(SM>N_) return 0; return dobig(REQ); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...