# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77237 | farukkastamonuda | Untitled (POI11_tem) | C++14 | 382 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[1000000], e[1000000], x[1000000], v[1000000], mn, c[1000000], 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);
}
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... |