# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424886 | ollel | Teams (IOI15_teams) | C++14 | 0 ms | 0 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 <bits/stdc++.h>
#include <iostream>
#include "teams.h"
using namespace std;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
#define lso(x) x&(-x)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
struct seg {
int a, b;
bool marked = false;
seg(int A, int B) {a = A; b = B;}
}
vector<seg> s;
void init(int n, int a[], int b[]) {
s.resize(n);
rep(i,0,n) {
s[i].a = a[i];
s[i].b = b[i];
}
sort(s.begin(), s.end(), [](seg x, seg y) {
return x.b < y.b;
})
}
int can(int m, int k[]) {
vi p(m);
rep(i,0,m) p[i] = k[i];
sort(p.begin(), p.end());
rep(i,0,n) s[i].marked = false;
rep(i,0,m) {
int t = p[i], left = p[i];
rep(j, 0, n) {
if((!s[j].marked) && s[j].a <= t && s[j].b >= t) {
left--;
s[j].marked = true;
if (left == 0) break;
}
}
if (left > 0) return 0;
}
return 1;
}