# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67033 | nvmdava | 팀들 (IOI15_teams) | C++17 | 4032 ms | 14472 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
struct unit{
int l, r, L, R;
bool operator<(const unit& rhs) const {
if(L == rhs.L){
return R < rhs.R;
}
return L < rhs.L;
}
};
vector<unit> v;
void init(int N, int A[], int B[]) {
unit t;
for(int i = 0 ; i < N; i++){
t.l = A[i];
t.r = B[i];
v.push_back(t);
}
}
int can(int M, int K[]) {
vector<int> q;
for(int i = 0; i < M; i++){
q.push_back(K[i]);
}
sort(q.begin(), q.end());
int i = 0, t = q[0];
for(auto x : v){
x.L = lower_bound(q.begin(), q.end(), x.l) - q.begin();
x.R = upper_bound(q.begin(), q.end(), x.r) - q.begin() - 1;
}
sort(v.begin(), v.end());
for(auto x : v){
if(x.L > q[i]){
return 0;
}
if(x.R <= q[i]){
t--;
if(t == 0){
i++;
if(i == M){
return 1;
}
t = q[i];
}
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |