Submission #285748

#TimeUsernameProblemLanguageResultExecution timeMemory
285748DystoriaXTeams (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...