# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62762 | 2018-07-30T02:19:44 Z | jjwdi0 | None (KOI18_XCorr) | C++11 | 314 ms | 19024 KB |
#include <bits/stdc++.h> using namespace std; using pr = pair<int, int>; using ll = long long; int N, M, idx[300005]; ll sum[300005]; vector<pr> v; ll ans; int main() { scanf("%d", &N); for(int i=0, x, y; i<N; i++) { scanf("%d %d", &x, &y); sum[i+1] = 1LL * y; idx[i+1] = x; } scanf("%d", &M); for(int i=0, x, y; i<M; i++) { scanf("%d %d", &x, &y); v.push_back(pr(x, y)); } int s, e; scanf("%d %d", &s, &e); for(int i=1; i<=N; i++) { sum[i] += sum[i-1]; } for(auto it : v) { int idx1 = lower_bound(idx+1, idx+N+1, it.first - e) - idx, idx2 = upper_bound(idx+1, idx+N+1, it.first - s) - idx; ans += 1LL * (1LL * sum[idx2-1] - 1LL * sum[idx1-1]) * it.second; } printf("%lld\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 612 KB | Output is correct |
3 | Correct | 4 ms | 612 KB | Output is correct |
4 | Correct | 3 ms | 612 KB | Output is correct |
5 | Correct | 3 ms | 724 KB | Output is correct |
6 | Correct | 5 ms | 728 KB | Output is correct |
7 | Correct | 4 ms | 800 KB | Output is correct |
8 | Correct | 6 ms | 904 KB | Output is correct |
9 | Correct | 3 ms | 904 KB | Output is correct |
10 | Correct | 5 ms | 1128 KB | Output is correct |
11 | Correct | 4 ms | 1128 KB | Output is correct |
12 | Correct | 4 ms | 1128 KB | Output is correct |
13 | Correct | 6 ms | 1128 KB | Output is correct |
14 | Correct | 4 ms | 1128 KB | Output is correct |
15 | Correct | 3 ms | 1176 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 612 KB | Output is correct |
3 | Correct | 4 ms | 612 KB | Output is correct |
4 | Correct | 3 ms | 612 KB | Output is correct |
5 | Correct | 3 ms | 724 KB | Output is correct |
6 | Correct | 5 ms | 728 KB | Output is correct |
7 | Correct | 4 ms | 800 KB | Output is correct |
8 | Correct | 6 ms | 904 KB | Output is correct |
9 | Correct | 3 ms | 904 KB | Output is correct |
10 | Correct | 5 ms | 1128 KB | Output is correct |
11 | Correct | 4 ms | 1128 KB | Output is correct |
12 | Correct | 4 ms | 1128 KB | Output is correct |
13 | Correct | 6 ms | 1128 KB | Output is correct |
14 | Correct | 4 ms | 1128 KB | Output is correct |
15 | Correct | 3 ms | 1176 KB | Output is correct |
16 | Correct | 120 ms | 8648 KB | Output is correct |
17 | Correct | 5 ms | 8648 KB | Output is correct |
18 | Correct | 165 ms | 18920 KB | Output is correct |
19 | Correct | 4 ms | 18920 KB | Output is correct |
20 | Correct | 5 ms | 18920 KB | Output is correct |
21 | Correct | 3 ms | 18920 KB | Output is correct |
22 | Correct | 3 ms | 18920 KB | Output is correct |
23 | Correct | 5 ms | 18920 KB | Output is correct |
24 | Correct | 196 ms | 18920 KB | Output is correct |
25 | Correct | 193 ms | 18920 KB | Output is correct |
26 | Correct | 171 ms | 18920 KB | Output is correct |
27 | Correct | 5 ms | 18920 KB | Output is correct |
28 | Correct | 4 ms | 18920 KB | Output is correct |
29 | Correct | 2 ms | 18920 KB | Output is correct |
30 | Correct | 207 ms | 19020 KB | Output is correct |
31 | Correct | 4 ms | 19020 KB | Output is correct |
32 | Correct | 314 ms | 19020 KB | Output is correct |
33 | Correct | 231 ms | 19020 KB | Output is correct |
34 | Correct | 88 ms | 19020 KB | Output is correct |
35 | Correct | 2 ms | 19020 KB | Output is correct |
36 | Correct | 274 ms | 19020 KB | Output is correct |
37 | Correct | 65 ms | 19020 KB | Output is correct |
38 | Correct | 5 ms | 19020 KB | Output is correct |
39 | Correct | 168 ms | 19020 KB | Output is correct |
40 | Correct | 5 ms | 19020 KB | Output is correct |
41 | Correct | 3 ms | 19020 KB | Output is correct |
42 | Correct | 3 ms | 19020 KB | Output is correct |
43 | Correct | 2 ms | 19020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 612 KB | Output is correct |
3 | Correct | 4 ms | 612 KB | Output is correct |
4 | Correct | 3 ms | 612 KB | Output is correct |
5 | Correct | 3 ms | 724 KB | Output is correct |
6 | Correct | 5 ms | 728 KB | Output is correct |
7 | Correct | 4 ms | 800 KB | Output is correct |
8 | Correct | 6 ms | 904 KB | Output is correct |
9 | Correct | 3 ms | 904 KB | Output is correct |
10 | Correct | 5 ms | 1128 KB | Output is correct |
11 | Correct | 4 ms | 1128 KB | Output is correct |
12 | Correct | 4 ms | 1128 KB | Output is correct |
13 | Correct | 6 ms | 1128 KB | Output is correct |
14 | Correct | 4 ms | 1128 KB | Output is correct |
15 | Correct | 3 ms | 1176 KB | Output is correct |
16 | Correct | 120 ms | 8648 KB | Output is correct |
17 | Correct | 5 ms | 8648 KB | Output is correct |
18 | Correct | 165 ms | 18920 KB | Output is correct |
19 | Correct | 4 ms | 18920 KB | Output is correct |
20 | Correct | 5 ms | 18920 KB | Output is correct |
21 | Correct | 3 ms | 18920 KB | Output is correct |
22 | Correct | 3 ms | 18920 KB | Output is correct |
23 | Correct | 5 ms | 18920 KB | Output is correct |
24 | Correct | 196 ms | 18920 KB | Output is correct |
25 | Correct | 193 ms | 18920 KB | Output is correct |
26 | Correct | 171 ms | 18920 KB | Output is correct |
27 | Correct | 5 ms | 18920 KB | Output is correct |
28 | Correct | 4 ms | 18920 KB | Output is correct |
29 | Correct | 2 ms | 18920 KB | Output is correct |
30 | Correct | 207 ms | 19020 KB | Output is correct |
31 | Correct | 4 ms | 19020 KB | Output is correct |
32 | Correct | 314 ms | 19020 KB | Output is correct |
33 | Correct | 231 ms | 19020 KB | Output is correct |
34 | Correct | 88 ms | 19020 KB | Output is correct |
35 | Correct | 2 ms | 19020 KB | Output is correct |
36 | Correct | 274 ms | 19020 KB | Output is correct |
37 | Correct | 65 ms | 19020 KB | Output is correct |
38 | Correct | 5 ms | 19020 KB | Output is correct |
39 | Correct | 168 ms | 19020 KB | Output is correct |
40 | Correct | 5 ms | 19020 KB | Output is correct |
41 | Correct | 3 ms | 19020 KB | Output is correct |
42 | Correct | 3 ms | 19020 KB | Output is correct |
43 | Correct | 2 ms | 19020 KB | Output is correct |
44 | Correct | 134 ms | 19020 KB | Output is correct |
45 | Correct | 5 ms | 19020 KB | Output is correct |
46 | Correct | 199 ms | 19020 KB | Output is correct |
47 | Correct | 5 ms | 19020 KB | Output is correct |
48 | Correct | 171 ms | 19020 KB | Output is correct |
49 | Correct | 87 ms | 19020 KB | Output is correct |
50 | Correct | 5 ms | 19020 KB | Output is correct |
51 | Correct | 4 ms | 19020 KB | Output is correct |
52 | Correct | 3 ms | 19020 KB | Output is correct |
53 | Correct | 5 ms | 19020 KB | Output is correct |
54 | Correct | 225 ms | 19020 KB | Output is correct |
55 | Correct | 166 ms | 19020 KB | Output is correct |
56 | Correct | 213 ms | 19020 KB | Output is correct |
57 | Correct | 181 ms | 19020 KB | Output is correct |
58 | Correct | 195 ms | 19020 KB | Output is correct |
59 | Correct | 6 ms | 19020 KB | Output is correct |
60 | Correct | 3 ms | 19020 KB | Output is correct |
61 | Correct | 4 ms | 19020 KB | Output is correct |
62 | Correct | 237 ms | 19020 KB | Output is correct |
63 | Correct | 218 ms | 19020 KB | Output is correct |
64 | Correct | 3 ms | 19020 KB | Output is correct |
65 | Correct | 216 ms | 19020 KB | Output is correct |
66 | Correct | 223 ms | 19020 KB | Output is correct |
67 | Correct | 257 ms | 19024 KB | Output is correct |
68 | Correct | 6 ms | 19024 KB | Output is correct |
69 | Correct | 261 ms | 19024 KB | Output is correct |
70 | Correct | 85 ms | 19024 KB | Output is correct |
71 | Correct | 197 ms | 19024 KB | Output is correct |
72 | Correct | 209 ms | 19024 KB | Output is correct |
73 | Correct | 84 ms | 19024 KB | Output is correct |
74 | Correct | 3 ms | 19024 KB | Output is correct |
75 | Correct | 245 ms | 19024 KB | Output is correct |
76 | Correct | 51 ms | 19024 KB | Output is correct |
77 | Correct | 6 ms | 19024 KB | Output is correct |
78 | Correct | 183 ms | 19024 KB | Output is correct |
79 | Correct | 2 ms | 19024 KB | Output is correct |
80 | Correct | 5 ms | 19024 KB | Output is correct |
81 | Correct | 3 ms | 19024 KB | Output is correct |
82 | Correct | 247 ms | 19024 KB | Output is correct |
83 | Correct | 3 ms | 19024 KB | Output is correct |
84 | Correct | 2 ms | 19024 KB | Output is correct |
85 | Correct | 212 ms | 19024 KB | Output is correct |