Submission #200042

#TimeUsernameProblemLanguageResultExecution timeMemory
200042wilwxkLightning Rod (NOI18_lightningrod)C++14
7 / 100
2071 ms132092 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e7+7; 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; if(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: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...