Submission #534276

#TimeUsernameProblemLanguageResultExecution timeMemory
534276ac2huUntitled (POI11_tem)C++14
24 / 100
1093 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 = -1e9; 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; }
#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...