# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
63666 | 2018-08-02T12:32:22 Z | comfile | None (KOI18_XCorr) | C++17 | 269 ms | 130484 KB |
#include <bits/stdc++.h> #define N 300010 using namespace std; typedef long long ll; int n,m; pair<ll,ll> x[N],y[N]; ll s[N],a,b,ans; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%lld%lld",&x[i].first,&x[i].second); scanf("%d",&m); for(int i=1;i<=m;i++) scanf("%lld%lld",&y[i].first,&y[i].second); scanf("%lld%lld",&a,&b); for(int i=1;i<=m;i++) s[i]=s[i-1]+y[i].second; int l=0; int r=0; for(int i=1;i<=n;i++){ while(1){ if(r>=m) break; if(y[r+1].first>(x[i].first+b)) break; r++; } while(1){ if(l>=m) break; if(y[l+1].first>=(x[i].first+a)) break; l++; } ans += x[i].second*(s[r]-s[l]); } printf("%lld\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 504 KB | Output is correct |
2 | Correct | 5 ms | 660 KB | Output is correct |
3 | Correct | 5 ms | 768 KB | Output is correct |
4 | Correct | 5 ms | 900 KB | Output is correct |
5 | Correct | 4 ms | 900 KB | Output is correct |
6 | Correct | 5 ms | 900 KB | Output is correct |
7 | Correct | 5 ms | 940 KB | Output is correct |
8 | Correct | 5 ms | 1152 KB | Output is correct |
9 | Correct | 4 ms | 1152 KB | Output is correct |
10 | Correct | 5 ms | 1152 KB | Output is correct |
11 | Correct | 3 ms | 1152 KB | Output is correct |
12 | Correct | 5 ms | 1200 KB | Output is correct |
13 | Correct | 6 ms | 1256 KB | Output is correct |
14 | Correct | 3 ms | 1256 KB | Output is correct |
15 | Correct | 4 ms | 1256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 504 KB | Output is correct |
2 | Correct | 5 ms | 660 KB | Output is correct |
3 | Correct | 5 ms | 768 KB | Output is correct |
4 | Correct | 5 ms | 900 KB | Output is correct |
5 | Correct | 4 ms | 900 KB | Output is correct |
6 | Correct | 5 ms | 900 KB | Output is correct |
7 | Correct | 5 ms | 940 KB | Output is correct |
8 | Correct | 5 ms | 1152 KB | Output is correct |
9 | Correct | 4 ms | 1152 KB | Output is correct |
10 | Correct | 5 ms | 1152 KB | Output is correct |
11 | Correct | 3 ms | 1152 KB | Output is correct |
12 | Correct | 5 ms | 1200 KB | Output is correct |
13 | Correct | 6 ms | 1256 KB | Output is correct |
14 | Correct | 3 ms | 1256 KB | Output is correct |
15 | Correct | 4 ms | 1256 KB | Output is correct |
16 | Correct | 111 ms | 11468 KB | Output is correct |
17 | Correct | 8 ms | 11468 KB | Output is correct |
18 | Correct | 190 ms | 23268 KB | Output is correct |
19 | Correct | 4 ms | 23268 KB | Output is correct |
20 | Correct | 5 ms | 23268 KB | Output is correct |
21 | Correct | 5 ms | 23268 KB | Output is correct |
22 | Correct | 2 ms | 23268 KB | Output is correct |
23 | Correct | 5 ms | 23268 KB | Output is correct |
24 | Correct | 230 ms | 28556 KB | Output is correct |
25 | Correct | 218 ms | 35404 KB | Output is correct |
26 | Correct | 157 ms | 35564 KB | Output is correct |
27 | Correct | 4 ms | 35564 KB | Output is correct |
28 | Correct | 5 ms | 35564 KB | Output is correct |
29 | Correct | 3 ms | 35564 KB | Output is correct |
30 | Correct | 174 ms | 42364 KB | Output is correct |
31 | Correct | 5 ms | 42364 KB | Output is correct |
32 | Correct | 150 ms | 48184 KB | Output is correct |
33 | Correct | 188 ms | 55324 KB | Output is correct |
34 | Correct | 91 ms | 55324 KB | Output is correct |
35 | Correct | 3 ms | 55324 KB | Output is correct |
36 | Correct | 192 ms | 65020 KB | Output is correct |
37 | Correct | 59 ms | 65020 KB | Output is correct |
38 | Correct | 4 ms | 65020 KB | Output is correct |
39 | Correct | 153 ms | 72652 KB | Output is correct |
40 | Correct | 4 ms | 72652 KB | Output is correct |
41 | Correct | 2 ms | 72652 KB | Output is correct |
42 | Correct | 4 ms | 72652 KB | Output is correct |
43 | Correct | 3 ms | 72652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 504 KB | Output is correct |
2 | Correct | 5 ms | 660 KB | Output is correct |
3 | Correct | 5 ms | 768 KB | Output is correct |
4 | Correct | 5 ms | 900 KB | Output is correct |
5 | Correct | 4 ms | 900 KB | Output is correct |
6 | Correct | 5 ms | 900 KB | Output is correct |
7 | Correct | 5 ms | 940 KB | Output is correct |
8 | Correct | 5 ms | 1152 KB | Output is correct |
9 | Correct | 4 ms | 1152 KB | Output is correct |
10 | Correct | 5 ms | 1152 KB | Output is correct |
11 | Correct | 3 ms | 1152 KB | Output is correct |
12 | Correct | 5 ms | 1200 KB | Output is correct |
13 | Correct | 6 ms | 1256 KB | Output is correct |
14 | Correct | 3 ms | 1256 KB | Output is correct |
15 | Correct | 4 ms | 1256 KB | Output is correct |
16 | Correct | 111 ms | 11468 KB | Output is correct |
17 | Correct | 8 ms | 11468 KB | Output is correct |
18 | Correct | 190 ms | 23268 KB | Output is correct |
19 | Correct | 4 ms | 23268 KB | Output is correct |
20 | Correct | 5 ms | 23268 KB | Output is correct |
21 | Correct | 5 ms | 23268 KB | Output is correct |
22 | Correct | 2 ms | 23268 KB | Output is correct |
23 | Correct | 5 ms | 23268 KB | Output is correct |
24 | Correct | 230 ms | 28556 KB | Output is correct |
25 | Correct | 218 ms | 35404 KB | Output is correct |
26 | Correct | 157 ms | 35564 KB | Output is correct |
27 | Correct | 4 ms | 35564 KB | Output is correct |
28 | Correct | 5 ms | 35564 KB | Output is correct |
29 | Correct | 3 ms | 35564 KB | Output is correct |
30 | Correct | 174 ms | 42364 KB | Output is correct |
31 | Correct | 5 ms | 42364 KB | Output is correct |
32 | Correct | 150 ms | 48184 KB | Output is correct |
33 | Correct | 188 ms | 55324 KB | Output is correct |
34 | Correct | 91 ms | 55324 KB | Output is correct |
35 | Correct | 3 ms | 55324 KB | Output is correct |
36 | Correct | 192 ms | 65020 KB | Output is correct |
37 | Correct | 59 ms | 65020 KB | Output is correct |
38 | Correct | 4 ms | 65020 KB | Output is correct |
39 | Correct | 153 ms | 72652 KB | Output is correct |
40 | Correct | 4 ms | 72652 KB | Output is correct |
41 | Correct | 2 ms | 72652 KB | Output is correct |
42 | Correct | 4 ms | 72652 KB | Output is correct |
43 | Correct | 3 ms | 72652 KB | Output is correct |
44 | Correct | 120 ms | 72652 KB | Output is correct |
45 | Correct | 5 ms | 72652 KB | Output is correct |
46 | Correct | 164 ms | 79256 KB | Output is correct |
47 | Correct | 4 ms | 79256 KB | Output is correct |
48 | Correct | 164 ms | 79256 KB | Output is correct |
49 | Correct | 113 ms | 79256 KB | Output is correct |
50 | Correct | 4 ms | 79256 KB | Output is correct |
51 | Correct | 3 ms | 79256 KB | Output is correct |
52 | Correct | 4 ms | 79256 KB | Output is correct |
53 | Correct | 4 ms | 79256 KB | Output is correct |
54 | Correct | 192 ms | 79256 KB | Output is correct |
55 | Correct | 210 ms | 79380 KB | Output is correct |
56 | Correct | 191 ms | 79380 KB | Output is correct |
57 | Correct | 190 ms | 79380 KB | Output is correct |
58 | Correct | 211 ms | 79448 KB | Output is correct |
59 | Correct | 4 ms | 79448 KB | Output is correct |
60 | Correct | 2 ms | 79448 KB | Output is correct |
61 | Correct | 3 ms | 79448 KB | Output is correct |
62 | Correct | 188 ms | 79448 KB | Output is correct |
63 | Correct | 269 ms | 84332 KB | Output is correct |
64 | Correct | 4 ms | 84332 KB | Output is correct |
65 | Correct | 229 ms | 92792 KB | Output is correct |
66 | Correct | 236 ms | 99412 KB | Output is correct |
67 | Correct | 258 ms | 106980 KB | Output is correct |
68 | Correct | 5 ms | 106980 KB | Output is correct |
69 | Correct | 160 ms | 113332 KB | Output is correct |
70 | Correct | 85 ms | 113332 KB | Output is correct |
71 | Correct | 269 ms | 125888 KB | Output is correct |
72 | Correct | 202 ms | 130484 KB | Output is correct |
73 | Correct | 90 ms | 130484 KB | Output is correct |
74 | Correct | 3 ms | 130484 KB | Output is correct |
75 | Correct | 182 ms | 130484 KB | Output is correct |
76 | Correct | 53 ms | 130484 KB | Output is correct |
77 | Correct | 5 ms | 130484 KB | Output is correct |
78 | Correct | 185 ms | 130484 KB | Output is correct |
79 | Correct | 2 ms | 130484 KB | Output is correct |
80 | Correct | 3 ms | 130484 KB | Output is correct |
81 | Correct | 3 ms | 130484 KB | Output is correct |
82 | Correct | 226 ms | 130484 KB | Output is correct |
83 | Correct | 3 ms | 130484 KB | Output is correct |
84 | Correct | 2 ms | 130484 KB | Output is correct |
85 | Correct | 190 ms | 130484 KB | Output is correct |