답안 #363592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363592 2021-02-06T16:34:32 Z keta_tsimakuridze Lightning Rod (NOI18_lightningrod) C++14
80 / 100
2000 ms 154840 KB
#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;
const int N=1e7+5,mod=1e9+7;
int t,x[N],y[N],n;
stack<int> s; 
 main(){
 	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
		cin>>n;
		for(int i=1;i<=n;i++){
			cin>>x[i]>>y[i];
			while(s.size() && x[s.top()]-y[s.top()]>=x[i]-y[i]) s.pop();
			if(!s.size() || x[s.top()]+y[s.top()]<x[i]+y[i]) s.push(i);
		}
		cout<<s.size();
}

Compilation message

lightningrod.cpp:8:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 |  main(){
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1837 ms 148448 KB Output is correct
2 Correct 1822 ms 154840 KB Output is correct
3 Correct 1779 ms 147164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 45 ms 1772 KB Output is correct
15 Correct 46 ms 1900 KB Output is correct
16 Correct 48 ms 2156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1861 ms 120456 KB Output is correct
2 Correct 1860 ms 132304 KB Output is correct
3 Correct 1802 ms 128984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1837 ms 148448 KB Output is correct
2 Correct 1822 ms 154840 KB Output is correct
3 Correct 1779 ms 147164 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 45 ms 1772 KB Output is correct
18 Correct 46 ms 1900 KB Output is correct
19 Correct 48 ms 2156 KB Output is correct
20 Correct 1861 ms 120456 KB Output is correct
21 Correct 1860 ms 132304 KB Output is correct
22 Correct 1802 ms 128984 KB Output is correct
23 Execution timed out 2041 ms 120244 KB Time limit exceeded
24 Halted 0 ms 0 KB -