답안 #137682

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137682 2019-07-28T08:32:29 Z ekrem Lightning Rod (NOI18_lightningrod) C++17
80 / 100
2000 ms 79972 KB
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define coc g[mode][i]
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)>>1)
#define mod 1000000007
#define inf 1000000009
#define N 5000005

using namespace std;

typedef long long ll;
typedef pair < int , int > ii;
typedef pair < double , double > dd;

int n, m, result;
char ch;
ii a;
stack < ii > s;

int readInt () {
	result = 0;
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	return result;
}

int main(){
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	n = readInt();
	for(int i = 1; i <= n; i++){
		// scanf("%d %d",&a.st ,&a.nd);
		a.st = readInt();
		a.nd = readInt();
		while(!s.empty() and abs(s.top().st - a.st) <= a.nd - s.top().nd)
			s.pop();
		if(!s.empty() and abs(s.top().st - a.st) <= s.top().nd - a.nd)
			continue;
		s.push(a);
	}
	printf("%d\n", (int)s.size());
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1737 ms 79972 KB Output is correct
2 Correct 1737 ms 79576 KB Output is correct
3 Correct 1704 ms 77512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 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 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 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 256 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 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 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 256 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 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 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 256 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 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 55 ms 376 KB Output is correct
15 Correct 53 ms 376 KB Output is correct
16 Correct 45 ms 1016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1546 ms 51292 KB Output is correct
2 Correct 1553 ms 51348 KB Output is correct
3 Correct 1514 ms 50376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1737 ms 79972 KB Output is correct
2 Correct 1737 ms 79576 KB Output is correct
3 Correct 1704 ms 77512 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 256 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 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 3 ms 256 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 55 ms 376 KB Output is correct
18 Correct 53 ms 376 KB Output is correct
19 Correct 45 ms 1016 KB Output is correct
20 Correct 1546 ms 51292 KB Output is correct
21 Correct 1553 ms 51348 KB Output is correct
22 Correct 1514 ms 50376 KB Output is correct
23 Execution timed out 2032 ms 620 KB Time limit exceeded
24 Halted 0 ms 0 KB -