제출 #619440

#제출 시각아이디문제언어결과실행 시간메모리
619440Hazem팀들 (IOI15_teams)C++14
34 / 100
4088 ms11436 KiB
#include <bits/stdc++.h> using namespace std; const int S = 2e5+10; pair<int,int>p[S]; int n; void init(int N, int A[], int B[]) { n = N; for(int i=1;i<=N;i++) p[i] = {A[i-1],B[i-1]}; sort(p+1,p+n+1); } int can(int M, int K[]) { sort(K,K+M); int cur = 1; multiset<int>st; for(int i=0;i<M;i++){ while(cur<=n) if(p[cur].first<=K[i]) st.insert(p[cur++].second); else break; while(!st.empty()){ auto it = st.begin(); if(*it<K[i]) st.erase(*it); else break; } int cnt = 0; while(!st.empty()){ if(cnt==K[i]) break; auto it = st.lower_bound(K[i]); if(it==st.end()) break; st.erase(st.find(*it)); cnt++; } if(cnt!=K[i]) 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...