Submission #1218509

#TimeUsernameProblemLanguageResultExecution timeMemory
1218509agrim_09Advertisement 2 (JOI23_ho_t2)C++20
100 / 100
104 ms8732 KiB
// #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define endl '\n'; #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); #define py cout << "YES" << endl; #define pn cout << "NO" << endl; #define all(x) (x).begin(), (x).end() #define pb push_back #define int long long typedef long long ll; typedef unsigned long long ull; const ll inf = 1e18; const ll mod = 1e9+7; // #ifndef ONLINE_JUDGE // #include "algo/Standard_Stuff/debug.cpp" // #else // #define debug(...) 42 // #endif // void judge(){ // srand(time(NULL)); // #ifndef ONLINE_JUDGE // freopen("1.txt","r",stdin); // freopen("2.txt","w",stdout); // #endif // } // Look for edge cases!!! signed main(){ fastio; //judge(); int n; cin >> n; vector<pair<int, int>>points; for(int i = 0;i<n;i++){ int a,b; cin >> a >> b; points.pb({a+b,b-a}); } sort(all(points),[](auto &i, auto &j){ if(i.first!=j.first){ return i.first > j.first; } return i.second > j.second; }); int ans = 0; int maxi = -1*inf; for(auto &[x,y]:points){ if(maxi<y){ ans++; maxi = y; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...