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;
int n;
vector <pair <int, int>> v;
void init(int N, int A[], int B[]) {
n = N;
for(int i = 0;i < n;i++){
v.push_back({B[i], A[i]});
}
sort(v.begin(), v.end());
for(auto &x : v){
swap(x.first, x.second);
}
// for(auto x : v){
// cout << x << ' ';
// }
}
int can(int M, int K[]) {
int m = M;
vector <int> k;
for(int i = 0;i < m;i++) k.push_back(K[i]);
sort(k.begin(), k.end());
reverse(k.begin(), k.end());
int l = n-1;
for(auto x : k){
int cnt = x;
while(cnt > 0){
if(l < 0) return 0;
// cout << v[l].first << ' ' << v[l].second << ' ' << x << endl;
if(v[l].first <= x and x <= v[l].second){
cnt--;
}
l--;
}
}
return 1;
}
# | 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... |