제출 #1085952

#제출 시각아이디문제언어결과실행 시간메모리
1085952pokmui9909무제 (POI11_tem)C++17
50 / 100
148 ms38740 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; ll N, L[1000005], R[1000005]; int main(){ cin.tie(0) -> sync_with_stdio(0); cin >> N; for(ll i = 1; i <= N; i++){ cin >> L[i] >> R[i]; } ll Ans = 0; deque<ll> dq; for(ll i = 1, j = 1; i <= N; i++){ while(!dq.empty() && L[dq.back()] <= L[i]) dq.pop_back(); dq.push_back(i); while(j < N && (dq.empty() || R[j + 1] >= L[dq.front()])){ j++; while(!dq.empty() && L[dq.back()] <= L[j]) dq.pop_back(); dq.push_back(j); } while(!dq.empty() && dq.front() <= i) dq.pop_front(); Ans = max(Ans, j - i + 1); } 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...