Submission #1034060

#TimeUsernameProblemLanguageResultExecution timeMemory
1034060fv3Teams (IOI15_teams)C++17
0 / 100
4099 ms16332 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; struct range { int l, r; bool operator<(const range other) const { return r < other.r; } }; int N; vector<range> v; void init(int N_, int A[], int B[]) { N = N_; v.resize(N); for (int i = 0; i < N; i++) { v[i] = {A[i], B[i]}; } sort(v.begin(), v.end()); } int can(int M, int K_[]) { vector<int> K(M); for (int i = 0; i < M; i++) K[i] = K_[i]; sort(K.begin(), K.end()); int l = 0; int remaining = K[0]; for (int i = 0; i < N; i++) { if (v[i].r >= K[l] && v[i].l <= K[l]) remaining--; if (!remaining) { l++; if (l == M) return 1; remaining = K[l]; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...