# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396333 | definitelynotmee | Teams (IOI15_teams) | C++98 | 4078 ms | 19856 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 "teams.h"
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INFL = (1LL<<62)-1;
const int INF = (1<<30)-1;
const int MAXN = 500001;
int n;
pii v [MAXN];
void init (int N, int A[], int B[]){
n = N;
for(int i = 0; i < n; i++){
v[i] = {A[i], B[i]};
}
sort(v, v+n);
}
int can (int m, int k[]){
sort(k, k+m);
multiset<int> active;
int p1 = 0, p2 = 0;
for(int i = 1; i <= n && p2 < m; i++){
while(p1 < n && v[p1].ff == i){
active.insert(v[p1].ss);
p1++;
}
while(p2 < m && k[p2] == i){
if(active.size() < k[p2])
return 0;
for(int j = 0; j < k[p2]; j++)
active.erase(active.begin());
p2++;
}
while(!active.empty() && *active.begin() == i)
active.erase(active.begin());
}
return 1;
}
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... |