Submission #138938

# Submission time Handle Problem Language Result Execution time Memory
138938 2019-07-31T01:34:36 Z thebes Lightning Rod (NOI18_lightningrod) C++14
80 / 100
2000 ms 76356 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

int n, i, x, y, f, a, b, sz=-1, X[10000005], Y[10000005];

int main(){
    scan(n);
    for(i=1;i<=n;i++){
        scan(x); scan(y); f=0;
        while(sz!=-1){
            if(x-X[sz]<=Y[sz]-y) break;
            else if(y-Y[sz]>=x-X[sz]) sz--;
            else{f=1; break;}
        }
        if(sz==-1||f){
            ++sz;
            X[sz] = x;
            Y[sz] = y;
        }
    }
    printf("%d\n",sz+1);
    return 0;
}

Compilation message

lightningrod.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
lightningrod.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# Verdict Execution time Memory Grader output
1 Correct 1695 ms 76356 KB Output is correct
2 Correct 1669 ms 76140 KB Output is correct
3 Correct 1639 ms 74000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 52 ms 376 KB Output is correct
15 Correct 49 ms 376 KB Output is correct
16 Correct 43 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1457 ms 49080 KB Output is correct
2 Correct 1487 ms 49148 KB Output is correct
3 Correct 1422 ms 47948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1695 ms 76356 KB Output is correct
2 Correct 1669 ms 76140 KB Output is correct
3 Correct 1639 ms 74000 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 52 ms 376 KB Output is correct
18 Correct 49 ms 376 KB Output is correct
19 Correct 43 ms 1016 KB Output is correct
20 Correct 1457 ms 49080 KB Output is correct
21 Correct 1487 ms 49148 KB Output is correct
22 Correct 1422 ms 47948 KB Output is correct
23 Execution timed out 2050 ms 1940 KB Time limit exceeded
24 Halted 0 ms 0 KB -