답안 #137692

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137692 2019-07-28T08:34:39 Z ekrem Lightning Rod (NOI18_lightningrod) C++
100 / 100
596 ms 77636 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 10000005

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, s[N];

int readInt(){
    int res = 0;
    char ch = 0;
    while(ch < '0') ch = getchar_unlocked();
    for(; ch >= '0'; ch = getchar_unlocked()) res = res * 10 + ch - '0';
    return res;
}
 
void writeInt(int v){
    char buf[14];
    int p = 0;
    if(v == 0) buf[p++] = 0;
    for(; v; v /= 10) buf[p++] = v % 10;
    while(p--) putchar_unlocked(buf[p] + '0');
}

int main(){
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	n = readInt();
	for(int i = 1; i <= n; i++){
		a.st = readInt();
		a.nd = readInt();
		while(m and abs(s[m].st - a.st) <= a.nd - s[m].nd)
			m--;
		if(m and abs(s[m].st - a.st) <= s[m].nd - a.nd)
			continue;
		s[++m] = a;
	}
	writeInt(m);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 439 ms 76648 KB Output is correct
2 Correct 440 ms 77636 KB Output is correct
3 Correct 432 ms 75596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 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 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 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 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 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 376 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 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 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 376 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 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 16 ms 652 KB Output is correct
15 Correct 14 ms 504 KB Output is correct
16 Correct 14 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 426 ms 49412 KB Output is correct
2 Correct 411 ms 50444 KB Output is correct
3 Correct 398 ms 49400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 439 ms 76648 KB Output is correct
2 Correct 440 ms 77636 KB Output is correct
3 Correct 432 ms 75596 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 252 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 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 16 ms 652 KB Output is correct
18 Correct 14 ms 504 KB Output is correct
19 Correct 14 ms 1272 KB Output is correct
20 Correct 426 ms 49412 KB Output is correct
21 Correct 411 ms 50444 KB Output is correct
22 Correct 398 ms 49400 KB Output is correct
23 Correct 596 ms 5448 KB Output is correct
24 Correct 553 ms 1784 KB Output is correct
25 Correct 542 ms 3828 KB Output is correct