Submission #1125608

#TimeUsernameProblemLanguageResultExecution timeMemory
1125608salmonAdvertisement 2 (JOI23_ho_t2)C++20
100 / 100
148 ms4580 KiB
#include <bits/stdc++.h> using namespace std; int N; vector<pair<int,int>> v; int X,E; const int inf = 1.01e9; int main(){ scanf(" %d",&N); for(int i = 0; i < N; i++){ scanf(" %d",&X); scanf(" %d",&E); v.push_back({X - E, -X - E}); } sort(v.begin(),v.end()); int cont = 0; int r = -inf * 2; for(int i = 0; i < N; i++){ if(-v[i].second > r){ cont++; r = -v[i].second; } } printf("%d",cont); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
Main.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf(" %d",&X);
      |         ~~~~~^~~~~~~~~~
Main.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf(" %d",&E);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...