Submission #896301

#TimeUsernameProblemLanguageResultExecution timeMemory
896301Do_you_copyUntitled (POI11_tem)C++17
100 / 100
588 ms30032 KiB
#include <bits/stdc++.h> using namespace std; const int maxN = 1e6 + 10; const int inf = 0x3f3f3f3f; int a[maxN], b[maxN]; signed main(){ int n; cin >> n; for (int i = 1; i <= n; ++i){ cin >> a[i] >> b[i]; } deque <int> Q; int i = 1, j = 0; b[n + 1] = -inf; int ans = 1; while (i <= n){ while (!Q.empty() && Q.front() < i) Q.pop_front(); if (j < i){ j = i; Q.push_back(i); } while (j <= n && a[Q.front()] <= b[j + 1]){ ++j; while (!Q.empty() && a[Q.back()] <= a[j]) Q.pop_back(); Q.push_back(j); } ans = max(ans, j - i + 1); ++i; } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...