Submission #402909

# Submission time Handle Problem Language Result Execution time Memory
402909 2021-05-12T13:36:33 Z jk410 None (KOI18_XCorr) C++17
100 / 100
146 ms 7364 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,M,a,b,l=1,r;
int xi[300001],yi[300001];
ll x[300001],y[300001];
ll Ans;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    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];
        y[i]+=y[i-1];
    }
    cin>>a>>b;
    for (int i=1; i<=N; i++){
        while (l<=M&&yi[l]<xi[i]+a)
            l++;
        while (r<M&&yi[r+1]<=xi[i]+b)
            r++;
        Ans+=x[i]*(y[r]-y[l-1]);
    }
    cout<<Ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 82 ms 4224 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 119 ms 7220 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 2 ms 460 KB Output is correct
21 Correct 2 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 2 ms 332 KB Output is correct
24 Correct 110 ms 6720 KB Output is correct
25 Correct 136 ms 7332 KB Output is correct
26 Correct 122 ms 7284 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 2 ms 332 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 134 ms 7236 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 113 ms 6932 KB Output is correct
33 Correct 120 ms 7236 KB Output is correct
34 Correct 58 ms 3556 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 120 ms 7260 KB Output is correct
37 Correct 38 ms 2504 KB Output is correct
38 Correct 2 ms 332 KB Output is correct
39 Correct 111 ms 6844 KB Output is correct
40 Correct 2 ms 332 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 82 ms 4224 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 119 ms 7220 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 2 ms 460 KB Output is correct
21 Correct 2 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 2 ms 332 KB Output is correct
24 Correct 110 ms 6720 KB Output is correct
25 Correct 136 ms 7332 KB Output is correct
26 Correct 122 ms 7284 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 2 ms 332 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 134 ms 7236 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 113 ms 6932 KB Output is correct
33 Correct 120 ms 7236 KB Output is correct
34 Correct 58 ms 3556 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 120 ms 7260 KB Output is correct
37 Correct 38 ms 2504 KB Output is correct
38 Correct 2 ms 332 KB Output is correct
39 Correct 111 ms 6844 KB Output is correct
40 Correct 2 ms 332 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
44 Correct 75 ms 4228 KB Output is correct
45 Correct 2 ms 332 KB Output is correct
46 Correct 131 ms 7340 KB Output is correct
47 Correct 2 ms 332 KB Output is correct
48 Correct 98 ms 5308 KB Output is correct
49 Correct 46 ms 2636 KB Output is correct
50 Correct 2 ms 332 KB Output is correct
51 Correct 2 ms 332 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 2 ms 332 KB Output is correct
54 Correct 111 ms 6744 KB Output is correct
55 Correct 128 ms 7276 KB Output is correct
56 Correct 130 ms 7240 KB Output is correct
57 Correct 119 ms 7272 KB Output is correct
58 Correct 131 ms 7356 KB Output is correct
59 Correct 2 ms 332 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 2 ms 332 KB Output is correct
62 Correct 146 ms 7364 KB Output is correct
63 Correct 133 ms 7344 KB Output is correct
64 Correct 1 ms 332 KB Output is correct
65 Correct 132 ms 7344 KB Output is correct
66 Correct 122 ms 7236 KB Output is correct
67 Correct 130 ms 6924 KB Output is correct
68 Correct 2 ms 332 KB Output is correct
69 Correct 114 ms 6980 KB Output is correct
70 Correct 59 ms 3400 KB Output is correct
71 Correct 146 ms 7180 KB Output is correct
72 Correct 121 ms 7236 KB Output is correct
73 Correct 57 ms 3560 KB Output is correct
74 Correct 1 ms 332 KB Output is correct
75 Correct 118 ms 7240 KB Output is correct
76 Correct 43 ms 2496 KB Output is correct
77 Correct 2 ms 332 KB Output is correct
78 Correct 113 ms 6884 KB Output is correct
79 Correct 1 ms 332 KB Output is correct
80 Correct 2 ms 332 KB Output is correct
81 Correct 1 ms 332 KB Output is correct
82 Correct 145 ms 7236 KB Output is correct
83 Correct 1 ms 332 KB Output is correct
84 Correct 1 ms 332 KB Output is correct
85 Correct 130 ms 7108 KB Output is correct