Submission #919627

#TimeUsernameProblemLanguageResultExecution timeMemory
919627andrei_iorgulescuAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
149 ms14160 KiB
#include <bits/stdc++.h> using namespace std; int n; pair<int,int> a[500005]; bool cmp(pair<int,int>A, pair<int,int>B) { if (A.first != B.first) return A.first < B.first; return A.second > B.second; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for (int i = 1; i <= n; i++) { int x,e; cin >> x >> e; a[i] = {x - e,x + e}; } sort(a + 1,a + n + 1,cmp); int ans = 0; int rmax = 0; for (int i = 1; i <= n; i++) { if (rmax < a[i].second) rmax = a[i].second,ans++; } cout << ans; return 0; } /** imi imaginez oamenii ca niste intervale X,E -> [X - E,X + E] un om a fost deja luat <=> intervalul lui e inclus in al altuia vreau sa vad efectiv cate intervale nu sunt incluse in alte intervale **/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...