Submission #138934

#TimeUsernameProblemLanguageResultExecution timeMemory
138934thebesLightning Rod (NOI18_lightningrod)C++14
66 / 100
2069 ms81208 KiB
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native") #include <bits/stdc++.h> using namespace std; stack<pair<int,int>> mono; int n, i, x, y, f; int main(){ for(scanf("%d",&n),i=1;i<=n;i++){ scanf("%d%d",&x,&y); f=0; while(mono.size()){ if(x-mono.top().first<=mono.top().second-y) break; else if(y-mono.top().second>=x-mono.top().first) mono.pop(); else{f=1; break;} } if(mono.empty()||f) mono.push({x,y}); } printf("%d\n",mono.size()); return 0; }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:20:30: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::stack<std::pair<int, int> >::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n",mono.size());
                   ~~~~~~~~~~~^
lightningrod.cpp:11:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(scanf("%d",&n),i=1;i<=n;i++){
         ~~~~~~~~~~~~~~^~~~
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); f=0;
         ~~~~~^~~~~~~~~~~~~~
#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...