# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30072 | tlwpdus | Untitled (POI11_tem) | C++11 | 439 ms | 12604 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;
typedef pair<int,int> pii;
int n;
int S[1000100], E[1000100];
deque<pii> dq;
void push(pii a) {
while(!dq.empty()&&dq.back().second<=a.second) dq.pop_back();
dq.push_back(a);
}
int main() {
int i, j, res = 1;
scanf("%d",&n);
for (i=0;i<n;i++) scanf("%d%d",&S[i],&E[i]);
i = 0; j = -1;
for (;i<n;i++) {
if (!dq.empty()&&dq.front().first<i) dq.pop_front();
if (j<i) {j=i;push(pii(j,S[j]));}
for (;j+1<n;) {
if (dq.front().second<=E[j+1]) {j++;push(pii(j,S[j]));}
else break;
}
res = max(res,j-i+1);
}
printf("%d\n",res);
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... |