제출 #1140368

#제출 시각아이디문제언어결과실행 시간메모리
1140368Juanchoki팀들 (IOI15_teams)C++20
0 / 100
4091 ms17044 KiB
#include "teams.h" #include <algorithm> #include <iostream> #include <queue> using namespace std; struct tpos { int l, r; }; bool operator < (const tpos &a, const tpos &b) { if (a.r == b.r) return a.l > b.l; return a.r > b.r; } tpos arr[1<<20]; int n; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < N; i++) { arr[i].l = A[i]; arr[i].r = B[i]; } sort(arr, arr + N); } int can(int M, int K[]) { sort(K, K+M); priority_queue<tpos> pq; for (int i = 0; i < n; i++) { pq.push(arr[i]); } int cnt; for (int i = 0; i < M; i++) { cnt=K[i]; while (!pq.empty()) { if(cnt==0) break; tpos t=pq.top(); if(t.r < K[i]) { pq.pop(); continue; } if(t.l > K[i]) return 0; pq.pop(); cnt--; } if(cnt==0) continue; 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...