# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83610 | nikolapesic2802 | Untitled (POI11_tem) | C++14 | 1056 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;
#define ll long long
#define pb push_back
int main()
{
int n;
scanf("%i",&n);
vector<int> lo(n),hi(n);
for(int i=0;i<n;i++)
scanf("%i %i",&lo[i],&hi[i]);
int last;
multiset<int,greater<int> > mins;
int res=1;
int s=0;
mins.insert(lo[0]);
last=hi[0];
for(int i=1;i<n;i++)
{
if(lo[i]>last)
{
mins.clear();
mins.insert(lo[i]);
last=hi[i];
s=i;
continue;
}
while(mins.size()&&*mins.begin()>hi[i])
{
mins.erase(mins.find(lo[s]));
s++;
}
mins.insert(lo[i]);
res=max(res,i-s+1);
}
printf("%i\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... |