Submission #586362

#TimeUsernameProblemLanguageResultExecution timeMemory
586362krit3379Lightning Rod (NOI18_lightningrod)C++17
100 / 100
1996 ms93380 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define N 10000005 struct A{ int x,y; }a[N]; bitset<N> vis; int main(){ int n,i,x,y,ma; scanf("%d",&n); for(i=1;i<=n;i++)scanf("%d %d",&x,&y),a[i].x=x+y,a[i].y=-x+y; ma=-1e9; for(i=1;i<=n;i++)if(a[i].x>ma)ma=a[i].x;else vis[i]=true; ma=-1e9; for(i=n;i;i--)if(a[i].y>ma)ma=a[i].y;else vis[i]=true; printf("%d",n-vis.count()); return 0; }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:21:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::size_t' {aka 'long unsigned int'} [-Wformat=]
   21 |     printf("%d",n-vis.count());
      |             ~^  ~~~~~~~~~~~~~
      |              |   |
      |              int std::size_t {aka long unsigned int}
      |             %ld
lightningrod.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
lightningrod.cpp:16:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     for(i=1;i<=n;i++)scanf("%d %d",&x,&y),a[i].x=x+y,a[i].y=-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...