제출 #285801

#제출 시각아이디문제언어결과실행 시간메모리
285801DystoriaX팀들 (IOI15_teams)C++14
0 / 100
4067 ms29944 KiB
#include "teams.h" #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <bitset> // #include <numeric> using namespace std; int n; vector<int> st[100010], en[100010]; int pt[100010]; bitset<100010> act; vector<int> a, b; void init(int N, int A[], int B[]) { n = N; a.resize(1), b.resize(1); a.insert(a.end(), A, A + n); b.insert(b.end(), B, B + n); for(int i = 0; i < n; i++) st[A[i]].emplace_back(i + 1), en[B[i]].emplace_back(i + 1); } int can(int M, int K[]) { long long sum = 0; for(int i = 0; i < M; i++) sum += K[i]; if(sum > n) return 0; for(int i = 1; i <= n; i++) pt[i] = 0, act[i] = 0; for(int i = 0; i < M; i++) pt[K[i]] += K[i]; priority_queue<pair<int, int> > pq; for(int i = 1; i <= n; i++){ for(auto &k : st[i]) pq.push({-b[k], k}), act[k] = true; while(pt[i] && !pq.empty()){ int x = pq.top().second; pq.pop(); if(!act[x]) continue; act[x] = false; pt[i]--; } if(pt[i] && pq.empty()) 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...