# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77228 | farukkastamonuda | Untitled (POI11_tem) | C++14 | 354 ms | 33792 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;
int n,s[1000005],e[1000005],x[1000005],v[1000005],mn,c[1000005],ans,ds,de;
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d",&s[i],&e[i]);
}
ds=de=n;
for(int i=0;i<n;i++){
int cmn=i;
while(ds<de && s[x[ds]]<s[i]){
cmn=min(cmn,v[x[ds]]);
c[v[x[ds]]]=0;
ds++;
}
c[cmn]=1;
while(ds<de && s[x[de-1]]>e[i]){
de--;
c[v[x[de]]]=0;
while(!c[mn]) mn++;
}
x[--ds]=i;
v[i]=cmn;
ans=max(ans,i-mn+1);
}
printf("%d\n",ans);
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... |
# | 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... |
# | 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... |