# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133190 | ckodser | Teams (IOI15_teams) | C++14 | 4035 ms | 80148 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 ll long long
#define F first
#define S second
#define pb push_back
#define pii pair<ll,ll>
#define mp make_pair
using namespace :: std;
const ll maxn=5e5+500;
const ll inf=1e9+900;
vector<ll> sar[maxn];;
vector<ll> tah[maxn];
ll s[maxn];
ll e[maxn];
pii tmp[maxn];
void init(int n, int a[], int b[]) {
for(ll i=0;i<n;i++){
tmp[i]=mp(b[i],a[i]);
}
sort(tmp,tmp+n);
for(ll i=0;i<n;i++){
s[i]=tmp[i].S;
e[i]=tmp[i].F;
sar[s[i]].pb(i);
tah[e[i]].pb(i);
}
}
int can(int m, int k[]) {
sort(k,k+m);
ll last=0;
multiset<ll> st;
for(ll j=0;j<m;j++){
ll v=k[j];
if(last!=v){
for(ll i=last;i<v;i++){
for(auto e:tah[i]){
auto it=st.find(e);
if(it!=st.end())
st.erase(it);
}
for(auto e:sar[i+1]){
st.insert(e);
}
}
last=v;
}
for(ll i=0;i<v;i++){
if(st.empty()){
return 0;
}
st.erase(st.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... |