Submission #361719

#TimeUsernameProblemLanguageResultExecution timeMemory
361719wildturtleLightning Rod (NOI18_lightningrod)C++14
66 / 100
2068 ms73884 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,n; bool l; stack < pair <int , int > > st; int main() { //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); scanf ("%d",&n); for(int i=1;i<=n;i++) { scanf ("%d",&a); scanf ("%d",&b); l=0; while(!st.empty()) { c=st.top().first; d=st.top().second; if(a+b<=c+d) { l=1; break; } if(a-b<=c-d) st.pop(); else break; } if(l==0) st.push({a,b}); } cout<<st.size(); }

Compilation message (stderr)

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