# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619428 | A_D | Teams (IOI15_teams) | C++14 | 4075 ms | 19336 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 "teams.h"
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+100;
int n;
vector<pair<int,int>> vec[N];
vector<pair<int,int>> vec2[N];
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<=n;i++){
vec[i].clear();
vec2[i].clear();
}
for(int i=0;i<n;i++){
vec[A[i]].push_back({B[i],i});
vec2[B[i]].push_back({B[i],i});
}
}
int can(int M, int K[]) {
set<pair<int,int>> st;
sort(K,K+M);
int j=0;
for(int i=1;i<=n;i++){
for(auto x:vec[i]){
st.insert(x);
}
if(j==M)break;
while(j!=M&&K[j]==i){
if(st.size()<K[j]){
return 0;
}
int h=K[j];
while(h--){
st.erase(*st.begin());
}
}
for(auto x:vec2[i]){
if(st.find(x)!=st.end()){
st.erase(x);
}
}
}
if(j==M)return 1;
else return 0;
}
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... |