Submission #810706

#TimeUsernameProblemLanguageResultExecution timeMemory
810706_martynasAdvertisement 2 (JOI23_ho_t2)C++11
100 / 100
373 ms18184 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(a) (a).begin(), (a).end() using pii = pair<int, int>; const int mxn = 5e5+5; int n; int X[mxn], E[mxn]; int main() { cin >> n; for(int i = 0; i < n; i++) cin >> X[i] >> E[i]; vector<pii> A; for(int i = 0; i < n; i++) { A.pb({X[i]-E[i], -(X[i]+E[i])}); } sort(all(A)); int mxr = -2e9-1; int cnt = 0; for(auto p : A) { int l = p.fi, r = -p.se; if(mxr >= r) continue;; cnt++, mxr = r; } cout << cnt << "\n"; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:28:13: warning: unused variable 'l' [-Wunused-variable]
   28 |         int l = p.fi, r = -p.se;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...