답안 #152139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152139 2019-09-06T15:16:25 Z gs18103 XCorr (KOI18_XCorr) C++14
100 / 100
185 ms 20812 KB
#include <bits/stdc++.h>

using namespace std;

long long X[303030], Y[303030], Xi[303030], Yi[303030], SY[303030];

int main() {
	ios::sync_with_stdio(false); cin.tie(0);

	int n, m, a, b;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> Xi[i] >> X[i];
	}
	cin >> m;
	for(int i = 1; i <= m; i++) {
		cin >> Yi[i] >> Y[i];
	}
	cin >> a >> b;

	for(int i = 1; i <= m; i++) {
		SY[i] = SY[i-1] + Y[i];
	}

	long long ans = 0;
	for(int i = 1; i <= n; i++) {
		int l, r;
		r = upper_bound(Yi+1, Yi+m+1, Xi[i]+b)-Yi-1;
		l = lower_bound(Yi+1, Yi+m+1, Xi[i]+a)-Yi-1;
		ans += X[i] * (SY[r]-SY[l]);
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 4 ms 632 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 504 KB Output is correct
13 Correct 4 ms 632 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 4 ms 632 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 504 KB Output is correct
13 Correct 4 ms 632 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
16 Correct 94 ms 10708 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 161 ms 18680 KB Output is correct
19 Correct 3 ms 504 KB Output is correct
20 Correct 4 ms 504 KB Output is correct
21 Correct 3 ms 504 KB Output is correct
22 Correct 2 ms 420 KB Output is correct
23 Correct 5 ms 504 KB Output is correct
24 Correct 158 ms 17252 KB Output is correct
25 Correct 148 ms 18908 KB Output is correct
26 Correct 183 ms 18700 KB Output is correct
27 Correct 4 ms 504 KB Output is correct
28 Correct 3 ms 504 KB Output is correct
29 Correct 2 ms 380 KB Output is correct
30 Correct 145 ms 18680 KB Output is correct
31 Correct 4 ms 504 KB Output is correct
32 Correct 152 ms 17788 KB Output is correct
33 Correct 144 ms 18680 KB Output is correct
34 Correct 65 ms 9976 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 162 ms 18724 KB Output is correct
37 Correct 52 ms 5496 KB Output is correct
38 Correct 4 ms 504 KB Output is correct
39 Correct 141 ms 17564 KB Output is correct
40 Correct 4 ms 660 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 3 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 4 ms 632 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 504 KB Output is correct
13 Correct 4 ms 632 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
16 Correct 94 ms 10708 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 161 ms 18680 KB Output is correct
19 Correct 3 ms 504 KB Output is correct
20 Correct 4 ms 504 KB Output is correct
21 Correct 3 ms 504 KB Output is correct
22 Correct 2 ms 420 KB Output is correct
23 Correct 5 ms 504 KB Output is correct
24 Correct 158 ms 17252 KB Output is correct
25 Correct 148 ms 18908 KB Output is correct
26 Correct 183 ms 18700 KB Output is correct
27 Correct 4 ms 504 KB Output is correct
28 Correct 3 ms 504 KB Output is correct
29 Correct 2 ms 380 KB Output is correct
30 Correct 145 ms 18680 KB Output is correct
31 Correct 4 ms 504 KB Output is correct
32 Correct 152 ms 17788 KB Output is correct
33 Correct 144 ms 18680 KB Output is correct
34 Correct 65 ms 9976 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 162 ms 18724 KB Output is correct
37 Correct 52 ms 5496 KB Output is correct
38 Correct 4 ms 504 KB Output is correct
39 Correct 141 ms 17564 KB Output is correct
40 Correct 4 ms 660 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 3 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
44 Correct 88 ms 10660 KB Output is correct
45 Correct 3 ms 484 KB Output is correct
46 Correct 156 ms 18724 KB Output is correct
47 Correct 3 ms 504 KB Output is correct
48 Correct 124 ms 15224 KB Output is correct
49 Correct 55 ms 8128 KB Output is correct
50 Correct 3 ms 504 KB Output is correct
51 Correct 3 ms 508 KB Output is correct
52 Correct 2 ms 376 KB Output is correct
53 Correct 3 ms 504 KB Output is correct
54 Correct 156 ms 17392 KB Output is correct
55 Correct 153 ms 18964 KB Output is correct
56 Correct 165 ms 20812 KB Output is correct
57 Correct 149 ms 18680 KB Output is correct
58 Correct 167 ms 20636 KB Output is correct
59 Correct 3 ms 504 KB Output is correct
60 Correct 2 ms 376 KB Output is correct
61 Correct 4 ms 504 KB Output is correct
62 Correct 161 ms 20572 KB Output is correct
63 Correct 177 ms 20644 KB Output is correct
64 Correct 3 ms 376 KB Output is correct
65 Correct 167 ms 20704 KB Output is correct
66 Correct 144 ms 18680 KB Output is correct
67 Correct 185 ms 19608 KB Output is correct
68 Correct 4 ms 504 KB Output is correct
69 Correct 152 ms 17912 KB Output is correct
70 Correct 79 ms 8284 KB Output is correct
71 Correct 167 ms 20092 KB Output is correct
72 Correct 143 ms 18740 KB Output is correct
73 Correct 66 ms 9976 KB Output is correct
74 Correct 2 ms 376 KB Output is correct
75 Correct 159 ms 18680 KB Output is correct
76 Correct 49 ms 5496 KB Output is correct
77 Correct 4 ms 580 KB Output is correct
78 Correct 139 ms 17656 KB Output is correct
79 Correct 2 ms 376 KB Output is correct
80 Correct 4 ms 632 KB Output is correct
81 Correct 2 ms 376 KB Output is correct
82 Correct 172 ms 20600 KB Output is correct
83 Correct 3 ms 504 KB Output is correct
84 Correct 2 ms 376 KB Output is correct
85 Correct 169 ms 20000 KB Output is correct