제출 #764423

#제출 시각아이디문제언어결과실행 시간메모리
764423SanguineChameleon팀들 (IOI15_teams)C++17
0 / 100
4081 ms59300 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int maxN = 5e5 + 20; vector<pair<int, int>> qadd[maxN]; vector<pair<int, int>> qrem[maxN]; int cnt[maxN]; int N; void init(int _N, int A[], int B[]) { N = _N; for (int i = 0; i < N; i++) { qadd[A[i]].emplace_back(B[i], i + 1); qrem[B[i]].emplace_back(B[i], i + 1); } } int can(int M, int K[]) { for (int i = 0; i < M; i++) { cnt[K[i]]++; } set<pair<int, int>> S; bool ok = true; for (int i = 1; i <= N; i++) { for (auto p: qadd[i]) { S.insert(p); } if ((int)S.size() < cnt[i]) { ok = false; break; } for (int j = 0; j < cnt[i]; j++) { S.erase(S.begin()); } for (auto p: qrem[i]) { S.erase(p); } } for (int i = 0; i < M; i++) { cnt[K[i]]--; } return ok; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...