Submission #1135500

#TimeUsernameProblemLanguageResultExecution timeMemory
1135500UnforgettableplAdvertisement 2 (JOI23_ho_t2)C++20
100 / 100
100 ms16344 KiB
#include <bits/stdc++.h> using namespace std; #define int long long typedef double ld; const int INF = 1e10; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<int,int>> arr(n); for(auto&[a,b]:arr)cin>>a>>b; stack<pair<int,int>> ans; auto isSubsetAofB = [&](pair<int,int> a,pair<int,int> b) { return abs(a.first-b.first)<=b.second-a.second; }; sort(arr.begin(), arr.end()); for(auto&x:arr) { while(!ans.empty() and isSubsetAofB(ans.top(),x))ans.pop(); if(!ans.empty() and isSubsetAofB(x,ans.top()))continue; ans.emplace(x); } cout << ans.size() << '\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...