# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831747 | jlallas384 | Teams (IOI15_teams) | C++17 | 4040 ms | 38392 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;
vector<pair<int,int>> seg;
void init(int N, int A[], int B[]) {
for(int i = 0; i < N; i++){
seg.emplace_back(A[i], B[i]);
}
sort(seg.begin(), seg.end());
}
int can(int m, int K[]) {
vector<int> k;
for(int i = 0; i < m; i++){
k.push_back(K[i]);
}
sort(k.begin(), k.end());
multiset<int> ms;
int ptr = 0;
for(int x: k){
while(ptr < seg.size() && seg[ptr].first <= x){
ms.insert(seg[ptr++].second);
}
while(ms.size() && *ms.begin() < x){
ms.erase(ms.find(*ms.begin()));
}
if(ms.size() < x) return 0;
for(int it = 0; it < x; it++){
ms.erase(ms.find(*ms.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... |