Submission #200043

#TimeUsernameProblemLanguageResultExecution timeMemory
200043wilwxkLightning Rod (NOI18_lightningrod)C++14
66 / 100
2071 ms131800 KiB
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > st; int n; int main() { scanf("%d", &n); for(int i = 1; i <= n; i++) { int a, b; scanf("%d %d", &a, &b); if(st.size() && a-st.back().first <= abs(b-st.back().second) && st.back().second >= b) continue; while(st.size() && a-st.back().first <= abs(b-st.back().second)) st.pop_back(); st.push_back({a, b}); } printf("%d\n", int(st.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...