Submission #1131807

#TimeUsernameProblemLanguageResultExecution timeMemory
1131807lopkusAdvertisement 2 (JOI23_ho_t2)C++20
0 / 100
24 ms2372 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<int,int>> a(n + 1); for(int i = 1; i <= n; i++) { int u, v; cin >> u >> v; a[i] = {u - v, u + v}; } sort(a.begin(), a.end(), [&](pair<int, int> x, pair<int, int> y) { if (x.first == y.first) return x.second > y.second; return x.first < y.first; }); int ans = 0, best = - 1; for(int i = 1; i <= n; i++) { if(best < a[i].second) { best = a[i].second; ans += 1; } } 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...