Submission #426259

#TimeUsernameProblemLanguageResultExecution timeMemory
426259AmylopectinLightning Rod (NOI18_lightningrod)C++14
0 / 100
2037 ms111424 KiB
#include <iostream> #include <stdio.h> using namespace std; const int mxn = 1e7 + 10; struct we { int xx,yy; }; struct we a[mxn] = {}; int main() { int i,j,n,m,ru = -1,cx,cy; scanf("%d",&n); for(i=0; i<n; i++) { scanf("%d %d",&cx,&cy); while(ru >= 0 && cx - a[ru].xx <= cy - a[ru].yy) { ru --; } if(cx - a[ru].xx > a[ru].yy - cy) { ru ++; a[ru] = {cx,cy}; } } printf("%d\n",ru + 1); return 0; }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:12:11: warning: unused variable 'j' [-Wunused-variable]
   12 |     int i,j,n,m,ru = -1,cx,cy;
      |           ^
lightningrod.cpp:12:15: warning: unused variable 'm' [-Wunused-variable]
   12 |     int i,j,n,m,ru = -1,cx,cy;
      |               ^
lightningrod.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
lightningrod.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d %d",&cx,&cy);
      |         ~~~~~^~~~~~~~~~~~~~~~~
#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...