Submission #534264

#TimeUsernameProblemLanguageResultExecution timeMemory
534264ac2huUntitled (POI11_tem)C++14
0 / 100
1097 ms7244 KiB
#include <bits/stdc++.h> #ifdef DEBUG #include "../templates/debug.h" #else #define deb(x...) #endif using namespace std; signed main() { iostream::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr); int n;cin >> n; vector<pair<int,int>> a(n); for(auto &e : a)cin >> e.first >> e.second; int l = 1,r = n; auto check = [&](int mid) -> bool{ for(int i = 0;i<n - mid + 1;i++){ int cur = 0; int l = 0; for(int j = i;j<mid + i;j++){ cur = max(cur, a[j].first); if(cur > a[j].second){ break; } l++; } if(l == mid){ deb(i,mid); return true; } } return false; }; while(l < r){ int mid = (l + r + 1)/2; // cout << mid << "\n"; if(check(mid)){ l = mid; } else r = mid - 1; } cout << l << "\n"; }
#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...