# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
710126 | 2023-03-15T04:56:56 Z | ToroTN | Lightning Rod (NOI18_lightningrod) | C++14 | 1941 ms | 247216 KB |
#include<bits/stdc++.h> using namespace std; #define X first #define Y second int n,x[10000005],y[10000005],hsh[10000005],ans=0; stack<pair<int,int> > stk; int main() { scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d%d",&x[i],&y[i]); for(int i=1;i<=n;i++) { while(!stk.empty()) { if(y[i]-x[i]>=stk.top().X) { stk.pop(); }else { break; } } stk.push({y[i]-x[i],i}); } while(!stk.empty()) { ++hsh[stk.top().Y]; stk.pop(); } for(int i=n;i>=1;i--) { while(!stk.empty()) { if(y[i]+x[i]>=stk.top().X) { stk.pop(); }else { break; } } stk.push({y[i]+x[i],i}); } while(!stk.empty()) { if(hsh[stk.top().Y]==1)++ans; stk.pop(); } printf("%d\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1644 ms | 193552 KB | Output is correct |
2 | Correct | 1642 ms | 236244 KB | Output is correct |
3 | Correct | 1652 ms | 222952 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 320 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 320 KB | Output is correct |
8 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 320 KB | Output is correct |
8 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 320 KB | Output is correct |
8 | Correct | 1 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 | 39 ms | 2380 KB | Output is correct |
15 | Correct | 44 ms | 2552 KB | Output is correct |
16 | Correct | 37 ms | 3276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1669 ms | 178472 KB | Output is correct |
2 | Correct | 1695 ms | 178480 KB | Output is correct |
3 | Correct | 1593 ms | 180348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1644 ms | 193552 KB | Output is correct |
2 | Correct | 1642 ms | 236244 KB | Output is correct |
3 | Correct | 1652 ms | 222952 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 | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 320 KB | Output is correct |
11 | Correct | 1 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 | 39 ms | 2380 KB | Output is correct |
18 | Correct | 44 ms | 2552 KB | Output is correct |
19 | Correct | 37 ms | 3276 KB | Output is correct |
20 | Correct | 1669 ms | 178472 KB | Output is correct |
21 | Correct | 1695 ms | 178480 KB | Output is correct |
22 | Correct | 1593 ms | 180348 KB | Output is correct |
23 | Correct | 1882 ms | 84548 KB | Output is correct |
24 | Correct | 1941 ms | 245440 KB | Output is correct |
25 | Correct | 1880 ms | 247216 KB | Output is correct |