# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
772392 | phoebe | Teams (IOI15_teams) | C++17 | 4062 ms | 136308 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"
using namespace std;
#define ll long long
#define pii pair<int, int>
#define F first
#define S second
#define FOR(i, n) for (int i = 0; i < n; i++)
#define PB push_back
const int maxn = 5e5 + 10;
int n;
map<int, vector<pii>> add, addnt;
bool cmp(pii a, pii b){
return a.S < b.S;
}
void init(int N, int A[], int B[]){
n = N;
FOR(i, n){
add[A[i]].PB({B[i], i});
addnt[B[i]].PB({B[i], i});
}
}
int can(int m, int k[]){
map<int, int> need;
FOR(i, m) need[k[i]] += k[i];
set<pii> s;
for (int i = 1; i <= n; i++){
for (auto x : add[i]) s.insert(x);
if (s.size() < need[i]) return 0;
FOR(_, need[i]) s.erase(s.begin());
for (auto x : addnt[i]){
if (s.count(x)) s.erase(x);
}
}
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... |