Submission #82860

# Submission time Handle Problem Language Result Execution time Memory
82860 2018-11-02T08:56:47 Z chunghan None (KOI18_XCorr) C++17
100 / 100
233 ms 237380 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long int lld;
typedef pair<int, lld> pil;

int N, M;
lld presum[300005], Xi[300005], X[300005], Yi[300005], Y[300005];
lld rst, a, b;

void input() {
    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;
}

void f() {
    for(int i = 1; i <= M; i++) presum[i] = Y[i] + presum[i-1];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    input();
    f();
    for(int i = 1; i <= N; i++) {
        int tmp = presum[upper_bound(Yi+1, Yi+M+1, Xi[i] + b) - Yi - 1] - presum[lower_bound(Yi+1, Yi+M+1, Xi[i]+a) - Yi - 1];
        rst += tmp*X[i];
    }
    cout << rst;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 520 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 4 ms 788 KB Output is correct
7 Correct 4 ms 908 KB Output is correct
8 Correct 3 ms 908 KB Output is correct
9 Correct 3 ms 908 KB Output is correct
10 Correct 5 ms 1148 KB Output is correct
11 Correct 2 ms 1148 KB Output is correct
12 Correct 4 ms 1148 KB Output is correct
13 Correct 3 ms 1152 KB Output is correct
14 Correct 2 ms 1152 KB Output is correct
15 Correct 4 ms 1212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 520 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 4 ms 788 KB Output is correct
7 Correct 4 ms 908 KB Output is correct
8 Correct 3 ms 908 KB Output is correct
9 Correct 3 ms 908 KB Output is correct
10 Correct 5 ms 1148 KB Output is correct
11 Correct 2 ms 1148 KB Output is correct
12 Correct 4 ms 1148 KB Output is correct
13 Correct 3 ms 1152 KB Output is correct
14 Correct 2 ms 1152 KB Output is correct
15 Correct 4 ms 1212 KB Output is correct
16 Correct 91 ms 11588 KB Output is correct
17 Correct 3 ms 11588 KB Output is correct
18 Correct 147 ms 23304 KB Output is correct
19 Correct 5 ms 23304 KB Output is correct
20 Correct 4 ms 23304 KB Output is correct
21 Correct 3 ms 23304 KB Output is correct
22 Correct 2 ms 23304 KB Output is correct
23 Correct 3 ms 23304 KB Output is correct
24 Correct 145 ms 28756 KB Output is correct
25 Correct 155 ms 36612 KB Output is correct
26 Correct 180 ms 43144 KB Output is correct
27 Correct 3 ms 43144 KB Output is correct
28 Correct 4 ms 43144 KB Output is correct
29 Correct 3 ms 43144 KB Output is correct
30 Correct 147 ms 50008 KB Output is correct
31 Correct 4 ms 50008 KB Output is correct
32 Correct 159 ms 55772 KB Output is correct
33 Correct 133 ms 62876 KB Output is correct
34 Correct 63 ms 62876 KB Output is correct
35 Correct 2 ms 62876 KB Output is correct
36 Correct 164 ms 72720 KB Output is correct
37 Correct 46 ms 72720 KB Output is correct
38 Correct 3 ms 72720 KB Output is correct
39 Correct 130 ms 80516 KB Output is correct
40 Correct 3 ms 80516 KB Output is correct
41 Correct 2 ms 80516 KB Output is correct
42 Correct 2 ms 80516 KB Output is correct
43 Correct 2 ms 80516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 520 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 4 ms 788 KB Output is correct
7 Correct 4 ms 908 KB Output is correct
8 Correct 3 ms 908 KB Output is correct
9 Correct 3 ms 908 KB Output is correct
10 Correct 5 ms 1148 KB Output is correct
11 Correct 2 ms 1148 KB Output is correct
12 Correct 4 ms 1148 KB Output is correct
13 Correct 3 ms 1152 KB Output is correct
14 Correct 2 ms 1152 KB Output is correct
15 Correct 4 ms 1212 KB Output is correct
16 Correct 91 ms 11588 KB Output is correct
17 Correct 3 ms 11588 KB Output is correct
18 Correct 147 ms 23304 KB Output is correct
19 Correct 5 ms 23304 KB Output is correct
20 Correct 4 ms 23304 KB Output is correct
21 Correct 3 ms 23304 KB Output is correct
22 Correct 2 ms 23304 KB Output is correct
23 Correct 3 ms 23304 KB Output is correct
24 Correct 145 ms 28756 KB Output is correct
25 Correct 155 ms 36612 KB Output is correct
26 Correct 180 ms 43144 KB Output is correct
27 Correct 3 ms 43144 KB Output is correct
28 Correct 4 ms 43144 KB Output is correct
29 Correct 3 ms 43144 KB Output is correct
30 Correct 147 ms 50008 KB Output is correct
31 Correct 4 ms 50008 KB Output is correct
32 Correct 159 ms 55772 KB Output is correct
33 Correct 133 ms 62876 KB Output is correct
34 Correct 63 ms 62876 KB Output is correct
35 Correct 2 ms 62876 KB Output is correct
36 Correct 164 ms 72720 KB Output is correct
37 Correct 46 ms 72720 KB Output is correct
38 Correct 3 ms 72720 KB Output is correct
39 Correct 130 ms 80516 KB Output is correct
40 Correct 3 ms 80516 KB Output is correct
41 Correct 2 ms 80516 KB Output is correct
42 Correct 2 ms 80516 KB Output is correct
43 Correct 2 ms 80516 KB Output is correct
44 Correct 96 ms 80516 KB Output is correct
45 Correct 3 ms 80516 KB Output is correct
46 Correct 156 ms 91636 KB Output is correct
47 Correct 3 ms 91636 KB Output is correct
48 Correct 126 ms 94708 KB Output is correct
49 Correct 60 ms 94708 KB Output is correct
50 Correct 3 ms 94708 KB Output is correct
51 Correct 3 ms 94708 KB Output is correct
52 Correct 2 ms 94708 KB Output is correct
53 Correct 3 ms 94708 KB Output is correct
54 Correct 145 ms 106004 KB Output is correct
55 Correct 140 ms 113760 KB Output is correct
56 Correct 158 ms 122728 KB Output is correct
57 Correct 141 ms 129188 KB Output is correct
58 Correct 177 ms 137700 KB Output is correct
59 Correct 3 ms 137700 KB Output is correct
60 Correct 2 ms 137700 KB Output is correct
61 Correct 3 ms 137700 KB Output is correct
62 Correct 149 ms 146344 KB Output is correct
63 Correct 233 ms 154872 KB Output is correct
64 Correct 2 ms 154872 KB Output is correct
65 Correct 171 ms 163484 KB Output is correct
66 Correct 151 ms 170036 KB Output is correct
67 Correct 169 ms 177580 KB Output is correct
68 Correct 4 ms 177580 KB Output is correct
69 Correct 141 ms 183968 KB Output is correct
70 Correct 77 ms 183968 KB Output is correct
71 Correct 199 ms 196532 KB Output is correct
72 Correct 134 ms 203344 KB Output is correct
73 Correct 63 ms 203344 KB Output is correct
74 Correct 2 ms 203344 KB Output is correct
75 Correct 147 ms 213188 KB Output is correct
76 Correct 47 ms 213188 KB Output is correct
77 Correct 3 ms 213188 KB Output is correct
78 Correct 142 ms 220164 KB Output is correct
79 Correct 2 ms 220164 KB Output is correct
80 Correct 4 ms 220164 KB Output is correct
81 Correct 2 ms 220164 KB Output is correct
82 Correct 212 ms 229380 KB Output is correct
83 Correct 2 ms 229380 KB Output is correct
84 Correct 2 ms 229380 KB Output is correct
85 Correct 187 ms 237380 KB Output is correct