제출 #285748

#제출 시각아이디문제언어결과실행 시간메모리
285748DystoriaX팀들 (IOI15_teams)C++14
0 / 100
4065 ms17356 KiB
#include "teams.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; int n; int st[500010], en[500010]; int pt[500010]; void init(int N, int A[], int B[]) { n = N; for(int i = 0; i < n; i++) st[A[i]]++, en[B[i]]++; } 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; for(int i = 0; i < M; i++) pt[K[i]] += K[i]; long long cur, dec; cur = dec = 0; for(int i = 1; i <= n; i++){ cur += st[i]; if(cur < pt[i]) return 0; cur -= pt[i]; dec += pt[i]; if(dec >= en[i]) dec -= en[i]; else cur -= en[i] - dec, dec = 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...