제출 #619071

#제출 시각아이디문제언어결과실행 시간메모리
6190711bin무제 (POI11_tem)C++14
100 / 100
278 ms23296 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 1e6 + 5; int n, mn, mx, ans, x; deque<pair<int, int>> dq; int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 0; i < n; i++){ cin >> mn >> mx; x = i; while(dq.size() && dq.front().fi > mx) dq.pop_front(); while(dq.size() && dq.back().fi <= mn) { x = dq.back().se; dq.pop_back(); } dq.emplace_back(mn, x); ans = max(ans, i - dq.front().se + 1); } cout << ans; return 0; }
#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...