# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
712100 | 2023-03-18T06:30:02 Z | Pherokung | Lightning Rod (NOI18_lightningrod) | C++14 | 2000 ms | 153912 KB |
#include<bits/stdc++.h> using namespace std; #define MAXN 10000005 #define F first #define S second int n,a,b,x[MAXN],y[MAXN],rod[MAXN],ans=0; deque<int> dq; int main(){ scanf("%d",&n); ans = n; for(int i=1;i<=n;i++){ scanf("%d%d",&a,&b); rod[i] = 1; x[i] = b-a; y[i] = b+a; } for(int i=1;i<=n;i++){ while(!dq.empty()){ int p = dq.front(); if(x[i] >= x[p]){ if(rod[p] == 1){ rod[p] = 0; ans--; } dq.pop_front(); } else break; } dq.push_front(i); } while(!dq.empty()) dq.pop_front(); for(int i=n;i>=1;i--){ while(!dq.empty()){ int p = dq.front(); if(y[i] >= y[p]){ if(rod[p] == 1){ rod[p] = 0; ans--; } dq.pop_front(); } else break; } dq.push_front(i); } printf("%d",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1526 ms | 153912 KB | Output is correct |
2 | Correct | 1597 ms | 153320 KB | Output is correct |
3 | Correct | 1540 ms | 149424 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 50 ms | 2508 KB | Output is correct |
15 | Correct | 46 ms | 2500 KB | Output is correct |
16 | Correct | 38 ms | 2820 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1685 ms | 147932 KB | Output is correct |
2 | Correct | 1665 ms | 147768 KB | Output is correct |
3 | Correct | 1756 ms | 144360 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1526 ms | 153912 KB | Output is correct |
2 | Correct | 1597 ms | 153320 KB | Output is correct |
3 | Correct | 1540 ms | 149424 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 50 ms | 2508 KB | Output is correct |
18 | Correct | 46 ms | 2500 KB | Output is correct |
19 | Correct | 38 ms | 2820 KB | Output is correct |
20 | Correct | 1685 ms | 147932 KB | Output is correct |
21 | Correct | 1665 ms | 147768 KB | Output is correct |
22 | Correct | 1756 ms | 144360 KB | Output is correct |
23 | Execution timed out | 2032 ms | 106904 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |