Submission #200035

#TimeUsernameProblemLanguageResultExecution timeMemory
200035wilwxkLightning Rod (NOI18_lightningrod)C++14
66 / 100
2017 ms164624 KiB
#include <bits/stdc++.h> using namespace std; set<pair<int, int> > s; int n; int main() { scanf("%d", &n); for(int i = 1; i <= n; i++) { int a, b; scanf("%d %d", &a, &b); int x = a+b; int y = b-a; auto sit = s.lower_bound({x, y}); if(sit != s.end() && sit->second >= y) continue; if(sit != s.end() && make_pair(x, y) > (*sit)) sit = prev(s.erase(sit)); while(sit != s.begin() && prev(sit)->second <= y) sit = s.erase(prev(sit)); s.insert({x, y}); } printf("%d\n", int(s.size())); }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
lightningrod.cpp:10: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...