답안 #895282

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
895282 2023-12-29T17:38:29 Z rainboy XCorr (KOI18_XCorr) C
100 / 100
87 ms 13648 KB
#include <stdio.h>

#define N	300000
#define M	300000

int main() {
	static int ii[N], xx[N], jj[M], yy[M];
	int n, m, a, b, i, j, jl, jr, y;
	long long ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d%d", &ii[i], &xx[i]);
	scanf("%d", &m);
	for (j = 0; j < m; j++)
		scanf("%d%d", &jj[j], &yy[j]);
	scanf("%d%d", &a, &b);
	y = 0, ans = 0;
	for (i = 0, jl = 0, jr = 0; i < n; i++) {
		while (jr < m && jj[jr] <= ii[i] + b)
			y += yy[jr++];
		while (jl < m && jj[jl] < ii[i] + a)
			y -= yy[jl++];
		ans += (long long) xx[i] * y;
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

XCorr.c: In function 'main':
XCorr.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
XCorr.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &ii[i], &xx[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.c:14:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  scanf("%d", &m);
      |  ^~~~~~~~~~~~~~~
XCorr.c:16:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%d%d", &jj[j], &yy[j]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.c:17:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  scanf("%d%d", &a, &b);
      |  ^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2536 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2488 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2480 KB Output is correct
10 Correct 2 ms 2480 KB Output is correct
11 Correct 1 ms 2400 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2536 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2488 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2480 KB Output is correct
10 Correct 2 ms 2480 KB Output is correct
11 Correct 1 ms 2400 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 44 ms 7352 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 77 ms 11656 KB Output is correct
19 Correct 2 ms 2656 KB Output is correct
20 Correct 1 ms 2400 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 0 ms 2400 KB Output is correct
23 Correct 1 ms 2400 KB Output is correct
24 Correct 72 ms 10784 KB Output is correct
25 Correct 77 ms 11924 KB Output is correct
26 Correct 78 ms 11464 KB Output is correct
27 Correct 1 ms 2652 KB Output is correct
28 Correct 1 ms 2400 KB Output is correct
29 Correct 1 ms 2496 KB Output is correct
30 Correct 76 ms 11568 KB Output is correct
31 Correct 1 ms 2400 KB Output is correct
32 Correct 76 ms 11352 KB Output is correct
33 Correct 77 ms 11608 KB Output is correct
34 Correct 37 ms 6488 KB Output is correct
35 Correct 0 ms 2396 KB Output is correct
36 Correct 77 ms 11624 KB Output is correct
37 Correct 25 ms 5200 KB Output is correct
38 Correct 1 ms 2396 KB Output is correct
39 Correct 73 ms 11064 KB Output is correct
40 Correct 2 ms 2400 KB Output is correct
41 Correct 0 ms 2400 KB Output is correct
42 Correct 1 ms 2648 KB Output is correct
43 Correct 2 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2536 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2488 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2480 KB Output is correct
10 Correct 2 ms 2480 KB Output is correct
11 Correct 1 ms 2400 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 44 ms 7352 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 77 ms 11656 KB Output is correct
19 Correct 2 ms 2656 KB Output is correct
20 Correct 1 ms 2400 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 0 ms 2400 KB Output is correct
23 Correct 1 ms 2400 KB Output is correct
24 Correct 72 ms 10784 KB Output is correct
25 Correct 77 ms 11924 KB Output is correct
26 Correct 78 ms 11464 KB Output is correct
27 Correct 1 ms 2652 KB Output is correct
28 Correct 1 ms 2400 KB Output is correct
29 Correct 1 ms 2496 KB Output is correct
30 Correct 76 ms 11568 KB Output is correct
31 Correct 1 ms 2400 KB Output is correct
32 Correct 76 ms 11352 KB Output is correct
33 Correct 77 ms 11608 KB Output is correct
34 Correct 37 ms 6488 KB Output is correct
35 Correct 0 ms 2396 KB Output is correct
36 Correct 77 ms 11624 KB Output is correct
37 Correct 25 ms 5200 KB Output is correct
38 Correct 1 ms 2396 KB Output is correct
39 Correct 73 ms 11064 KB Output is correct
40 Correct 2 ms 2400 KB Output is correct
41 Correct 0 ms 2400 KB Output is correct
42 Correct 1 ms 2648 KB Output is correct
43 Correct 2 ms 2396 KB Output is correct
44 Correct 44 ms 7248 KB Output is correct
45 Correct 1 ms 2648 KB Output is correct
46 Correct 79 ms 11508 KB Output is correct
47 Correct 1 ms 2396 KB Output is correct
48 Correct 64 ms 10196 KB Output is correct
49 Correct 35 ms 5972 KB Output is correct
50 Correct 1 ms 2396 KB Output is correct
51 Correct 1 ms 2396 KB Output is correct
52 Correct 1 ms 2396 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 73 ms 10948 KB Output is correct
55 Correct 73 ms 11860 KB Output is correct
56 Correct 86 ms 13648 KB Output is correct
57 Correct 80 ms 11604 KB Output is correct
58 Correct 86 ms 13408 KB Output is correct
59 Correct 2 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 1 ms 2396 KB Output is correct
62 Correct 86 ms 13488 KB Output is correct
63 Correct 85 ms 13440 KB Output is correct
64 Correct 1 ms 2392 KB Output is correct
65 Correct 85 ms 13472 KB Output is correct
66 Correct 76 ms 11456 KB Output is correct
67 Correct 84 ms 13112 KB Output is correct
68 Correct 1 ms 2396 KB Output is correct
69 Correct 75 ms 11204 KB Output is correct
70 Correct 52 ms 7248 KB Output is correct
71 Correct 83 ms 13324 KB Output is correct
72 Correct 77 ms 11600 KB Output is correct
73 Correct 38 ms 6484 KB Output is correct
74 Correct 1 ms 2396 KB Output is correct
75 Correct 78 ms 11604 KB Output is correct
76 Correct 26 ms 5208 KB Output is correct
77 Correct 1 ms 2536 KB Output is correct
78 Correct 73 ms 11028 KB Output is correct
79 Correct 1 ms 2396 KB Output is correct
80 Correct 1 ms 2540 KB Output is correct
81 Correct 1 ms 2396 KB Output is correct
82 Correct 85 ms 13544 KB Output is correct
83 Correct 1 ms 2396 KB Output is correct
84 Correct 0 ms 2396 KB Output is correct
85 Correct 87 ms 13248 KB Output is correct