Submission #586362

# Submission time Handle Problem Language Result Execution time Memory
586362 2022-06-30T07:24:10 Z krit3379 Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1996 ms 93380 KB
#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

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 time Memory Grader output
1 Correct 1522 ms 76188 KB Output is correct
2 Correct 1558 ms 76616 KB Output is correct
3 Correct 1558 ms 74584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 39 ms 1760 KB Output is correct
15 Correct 40 ms 1752 KB Output is correct
16 Correct 41 ms 1740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1665 ms 79476 KB Output is correct
2 Correct 1703 ms 93380 KB Output is correct
3 Correct 1649 ms 89784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1522 ms 76188 KB Output is correct
2 Correct 1558 ms 76616 KB Output is correct
3 Correct 1558 ms 74584 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 39 ms 1760 KB Output is correct
18 Correct 40 ms 1752 KB Output is correct
19 Correct 41 ms 1740 KB Output is correct
20 Correct 1665 ms 79476 KB Output is correct
21 Correct 1703 ms 93380 KB Output is correct
22 Correct 1649 ms 89784 KB Output is correct
23 Correct 1996 ms 92608 KB Output is correct
24 Correct 1791 ms 85740 KB Output is correct
25 Correct 1757 ms 80908 KB Output is correct