Submission #200040

#TimeUsernameProblemLanguageResultExecution timeMemory
200040wilwxkLightning Rod (NOI18_lightningrod)C++14
66 / 100
2037 ms131000 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e7+7; pair<int, int> v[MAXN]; int n; int main() { scanf("%d", &n); for(int i = 1; i <= n; i++) { int a, b; scanf("%d %d", &a, &b); v[i].first = a+b; v[i].second = b-a; } sort(v+1, v+1+n); int ans = 0; int mx = -(2e9+7); for(int i = n; i >= 1; i--) if(v[i].second > mx) mx = v[i].second, ans++; printf("%d\n", ans); }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
lightningrod.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d %d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...