Submission #786098

#TimeUsernameProblemLanguageResultExecution timeMemory
78609812345678Advertisement 2 (JOI23_ho_t2)C++17
100 / 100
130 ms17180 KiB
#include <bits/stdc++.h> using namespace std; int n, x, y, h; stack<pair<int, int>> s; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; vector<pair<int, int>> v(n); for (auto &[x, y]:v) cin>>x>>y; sort(v.begin(), v.end()); for (auto [x, y]:v) { if (s.empty()) { s.push({x, y}); continue; } if (s.top().second-y>=x-s.top().first) continue; while (!s.empty()&&y-s.top().second>=x-s.top().first) s.pop(); s.push({x, y}); } cout<<s.size(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...