Submission #798943

#TimeUsernameProblemLanguageResultExecution timeMemory
798943vjudge1Advertisement 2 (JOI23_ho_t2)C++14
100 / 100
159 ms12280 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define fi first #define se second #define ll long long using namespace std ; using namespace __gnu_pbds; const int N = 5e5 ; int n, ans ; pair<int, int> p[N + 1] ; signed main() { ios_base::sync_with_stdio( 0 ) ; cin.tie( 0 ) ; cout.tie( 0 ) ; cin >> n ; for(int i = 1 ; i <= n ; i++) cin >> p[i].fi >> p[i].se ; sort(p + 1, p + n + 1) ; vector<pair<int, int>> abu ; for(int i = 1 ; i <= n ; i++) { if(abu.size() && p[i].fi - abu.back().fi <= abu.back().se - p[i].se) continue ; while(abu.size() && p[i].fi - abu.back().fi <= p[i].se - abu.back().se) abu.pop_back() ; abu.push_back(p[i]) ; } cout << abu.size() ; return 0 ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...