Submission #227646

#TimeUsernameProblemLanguageResultExecution timeMemory
227646AutoratchLightning Rod (NOI18_lightningrod)C++14
66 / 100
2092 ms72476 KiB
#include <bits/stdc++.h> using namespace std; int n,x,y; stack<pair<int,int> > a; int main() { scanf("%d",&n); for(int i = 0;i < n;i++) { scanf("%d%d",&x,&y); while(!a.empty() and abs(a.top().first-x)<=y-a.top().second) a.pop(); if(a.empty() or abs(a.top().first-x)>a.top().second-y) a.push({x,y}); } printf("%d",(int)a.size()); }

Compilation message (stderr)

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