Submission #784090

# Submission time Handle Problem Language Result Execution time Memory
784090 2023-07-15T16:23:57 Z rainboy Lightning Rod (NOI18_lightningrod) C
100 / 100
1786 ms 225936 KB
#include <stdio.h>

#define N	10000000

int main() {
	static int qu[N], ll[N], rr[N];
	int n, cnt, i, x, y;

	scanf("%d", &n);
	cnt = 0;
	for (i = 0; i < n; i++) {
		scanf("%d%d", &x, &y);
		ll[i] = x - y, rr[i] = x + y;
		if (cnt == 0 || rr[qu[cnt - 1]] < rr[i]) {
			while (cnt && ll[qu[cnt - 1]] >= ll[i])
				cnt--;
			qu[cnt++] = i;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Compilation message

lightningrod.c: In function 'main':
lightningrod.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
lightningrod.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d%d", &x, &y);
      |   ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1276 ms 114096 KB Output is correct
2 Correct 1311 ms 225936 KB Output is correct
3 Correct 1302 ms 219860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 300 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 300 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 32 ms 1996 KB Output is correct
15 Correct 32 ms 2076 KB Output is correct
16 Correct 34 ms 2400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1423 ms 102708 KB Output is correct
2 Correct 1511 ms 198600 KB Output is correct
3 Correct 1438 ms 193752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1276 ms 114096 KB Output is correct
2 Correct 1311 ms 225936 KB Output is correct
3 Correct 1302 ms 219860 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 1 ms 292 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 292 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 32 ms 1996 KB Output is correct
18 Correct 32 ms 2076 KB Output is correct
19 Correct 34 ms 2400 KB Output is correct
20 Correct 1423 ms 102708 KB Output is correct
21 Correct 1511 ms 198600 KB Output is correct
22 Correct 1438 ms 193752 KB Output is correct
23 Correct 1786 ms 222736 KB Output is correct
24 Correct 1622 ms 205708 KB Output is correct
25 Correct 1678 ms 186792 KB Output is correct