Submission #1281796

#TimeUsernameProblemLanguageResultExecution timeMemory
1281796hynmjAdvertisement 2 (JOI23_ho_t2)C++20
0 / 100
37 ms4208 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const long long N = 2e5 + 5; struct home { int e, x; }; home a[N]; void solve() { int n; cin >> n; vector<int> stak; for (int i = 0; i < n; i++) { cin >> a[i].x >> a[i].e; } sort(a, a + n, [&](home a, home b) { return a.x < b.x; }); for (int i = 0; i < n; i++) { int e = a[i].x - a[i].e; // cout << e << endl; while (stak.size() and e <= stak.back()) { stak.pop_back(); } // e = +a[i].x - a[i].e; stak.push_back(e); } cout << stak.size() << endl; } signed main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { // cout << "Case #" << i << ':' << ' '; solve(); cout << endl; } 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...