# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
782822 | Lyrically | Teams (IOI15_teams) | C++17 | 4035 ms | 11480 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>
using namespace std;
#define pii pair<int,int>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int read(){int x;scanf("%d",&x);return x;}
void print(int x){printf("%d\n",x);}
void file(string s)
{
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
const int mod=998244353;
int n;
struct Item
{
int a,b;
bool operator < (Item c) const
{
return a==c.a?b<c.b:a<c.a;
}
}p[200005];
void init(int N,int A[],int B[])
{
n=N;
rep(i,n){p[i+1].a=A[i];}
rep(i,n){p[i+1].b=B[i];}
sort(p+1,p+n+1);
}
bool can(int m,int t[])
{
sort(t,t+m);
multiset<pii> st;
rep1(i,n)
{
st.insert({p[i].a,p[i].b});
}
vector<pii> v;
rep1(i,n)
{
v.pb({p[i].b,p[i].a});
}
sort(v.begin(),v.end());
rep(i,n){swap(v[i].first,v[i].second);}
int l=0;
//p[i].a<=t[i]<=p[i].b
rep(i,m)
{
if(st.empty()){return 0;}
while(l<n&&v[l].second<t[i])
{
if(st.find(v[l])!=st.end()){st.erase(v[l]);}
l++;
}
if(!st.empty()&&(*st.begin()).first>t[i]){return 0;}
while(!st.empty()&&((*(st.begin())).second)<t[i]){st.erase(st.begin());}
if(st.empty()){return 0;}
rep(j,t[i])
{
if(st.empty()){return 0;}
pii x=*st.begin();
if(x.first<=t[i]&&t[i]<=x.second){st.erase(st.begin());continue;}
return 0;
}
}
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... |