# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
209726 |
2020-03-15T12:37:54 Z |
gratus907 |
None (KOI18_XCorr) |
C++17 |
|
606 ms |
20856 KB |
#include <bits/stdc++.h>
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;
typedef long long ll;
using pii = pair<int, int>;
#define int ll
vector <int> x, y, xind, yind, ysum;
int n, m, a, b;
int32_t main()
{
cin >> n;
x.resize(n);
xind.resize(n);
for (int i = 0; i<n; i++)
cin >> xind[i] >> x[i];
cin >> m;
y.resize(m+1);
yind.resize(m+1);
ysum.resize(m+1);
for (int i = 0; i<m; i++)
cin >> yind[i] >> y[i];
yind[m] = INT_MAX;
for (int i = 1; i<=m; i++)
ysum[i] = ysum[i-1] + y[i-1];
cin >> a >> b;
int ans = 0;
for (int i = 0; i<n; i++)
{
int tmp = 0;
int l = lower_bound(all(yind),xind[i]+a)-yind.begin();
int r = lower_bound(all(yind),xind[i]+b+1)-yind.begin();
tmp = (x[i])*(ysum[r]-ysum[l]);
ans += tmp;
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
504 KB |
Output is correct |
2 |
Correct |
9 ms |
504 KB |
Output is correct |
3 |
Correct |
10 ms |
504 KB |
Output is correct |
4 |
Correct |
8 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
9 ms |
504 KB |
Output is correct |
7 |
Correct |
9 ms |
504 KB |
Output is correct |
8 |
Correct |
9 ms |
504 KB |
Output is correct |
9 |
Correct |
6 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
9 ms |
504 KB |
Output is correct |
13 |
Correct |
9 ms |
504 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
504 KB |
Output is correct |
2 |
Correct |
9 ms |
504 KB |
Output is correct |
3 |
Correct |
10 ms |
504 KB |
Output is correct |
4 |
Correct |
8 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
9 ms |
504 KB |
Output is correct |
7 |
Correct |
9 ms |
504 KB |
Output is correct |
8 |
Correct |
9 ms |
504 KB |
Output is correct |
9 |
Correct |
6 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
9 ms |
504 KB |
Output is correct |
13 |
Correct |
9 ms |
504 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
6 ms |
376 KB |
Output is correct |
16 |
Correct |
283 ms |
10720 KB |
Output is correct |
17 |
Correct |
9 ms |
504 KB |
Output is correct |
18 |
Correct |
518 ms |
18680 KB |
Output is correct |
19 |
Correct |
9 ms |
504 KB |
Output is correct |
20 |
Correct |
10 ms |
504 KB |
Output is correct |
21 |
Correct |
8 ms |
376 KB |
Output is correct |
22 |
Correct |
5 ms |
256 KB |
Output is correct |
23 |
Correct |
10 ms |
420 KB |
Output is correct |
24 |
Correct |
512 ms |
17272 KB |
Output is correct |
25 |
Correct |
505 ms |
18936 KB |
Output is correct |
26 |
Correct |
513 ms |
18680 KB |
Output is correct |
27 |
Correct |
9 ms |
504 KB |
Output is correct |
28 |
Correct |
9 ms |
420 KB |
Output is correct |
29 |
Correct |
6 ms |
376 KB |
Output is correct |
30 |
Correct |
496 ms |
18680 KB |
Output is correct |
31 |
Correct |
9 ms |
504 KB |
Output is correct |
32 |
Correct |
488 ms |
17784 KB |
Output is correct |
33 |
Correct |
520 ms |
18680 KB |
Output is correct |
34 |
Correct |
231 ms |
9980 KB |
Output is correct |
35 |
Correct |
5 ms |
256 KB |
Output is correct |
36 |
Correct |
500 ms |
18640 KB |
Output is correct |
37 |
Correct |
173 ms |
5560 KB |
Output is correct |
38 |
Correct |
9 ms |
504 KB |
Output is correct |
39 |
Correct |
462 ms |
17656 KB |
Output is correct |
40 |
Correct |
9 ms |
504 KB |
Output is correct |
41 |
Correct |
5 ms |
256 KB |
Output is correct |
42 |
Correct |
6 ms |
376 KB |
Output is correct |
43 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
504 KB |
Output is correct |
2 |
Correct |
9 ms |
504 KB |
Output is correct |
3 |
Correct |
10 ms |
504 KB |
Output is correct |
4 |
Correct |
8 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
9 ms |
504 KB |
Output is correct |
7 |
Correct |
9 ms |
504 KB |
Output is correct |
8 |
Correct |
9 ms |
504 KB |
Output is correct |
9 |
Correct |
6 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
9 ms |
504 KB |
Output is correct |
13 |
Correct |
9 ms |
504 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
6 ms |
376 KB |
Output is correct |
16 |
Correct |
283 ms |
10720 KB |
Output is correct |
17 |
Correct |
9 ms |
504 KB |
Output is correct |
18 |
Correct |
518 ms |
18680 KB |
Output is correct |
19 |
Correct |
9 ms |
504 KB |
Output is correct |
20 |
Correct |
10 ms |
504 KB |
Output is correct |
21 |
Correct |
8 ms |
376 KB |
Output is correct |
22 |
Correct |
5 ms |
256 KB |
Output is correct |
23 |
Correct |
10 ms |
420 KB |
Output is correct |
24 |
Correct |
512 ms |
17272 KB |
Output is correct |
25 |
Correct |
505 ms |
18936 KB |
Output is correct |
26 |
Correct |
513 ms |
18680 KB |
Output is correct |
27 |
Correct |
9 ms |
504 KB |
Output is correct |
28 |
Correct |
9 ms |
420 KB |
Output is correct |
29 |
Correct |
6 ms |
376 KB |
Output is correct |
30 |
Correct |
496 ms |
18680 KB |
Output is correct |
31 |
Correct |
9 ms |
504 KB |
Output is correct |
32 |
Correct |
488 ms |
17784 KB |
Output is correct |
33 |
Correct |
520 ms |
18680 KB |
Output is correct |
34 |
Correct |
231 ms |
9980 KB |
Output is correct |
35 |
Correct |
5 ms |
256 KB |
Output is correct |
36 |
Correct |
500 ms |
18640 KB |
Output is correct |
37 |
Correct |
173 ms |
5560 KB |
Output is correct |
38 |
Correct |
9 ms |
504 KB |
Output is correct |
39 |
Correct |
462 ms |
17656 KB |
Output is correct |
40 |
Correct |
9 ms |
504 KB |
Output is correct |
41 |
Correct |
5 ms |
256 KB |
Output is correct |
42 |
Correct |
6 ms |
376 KB |
Output is correct |
43 |
Correct |
5 ms |
256 KB |
Output is correct |
44 |
Correct |
297 ms |
10612 KB |
Output is correct |
45 |
Correct |
9 ms |
504 KB |
Output is correct |
46 |
Correct |
506 ms |
18656 KB |
Output is correct |
47 |
Correct |
9 ms |
504 KB |
Output is correct |
48 |
Correct |
428 ms |
15228 KB |
Output is correct |
49 |
Correct |
205 ms |
8184 KB |
Output is correct |
50 |
Correct |
9 ms |
504 KB |
Output is correct |
51 |
Correct |
8 ms |
376 KB |
Output is correct |
52 |
Correct |
5 ms |
256 KB |
Output is correct |
53 |
Correct |
9 ms |
504 KB |
Output is correct |
54 |
Correct |
473 ms |
17272 KB |
Output is correct |
55 |
Correct |
508 ms |
18936 KB |
Output is correct |
56 |
Correct |
606 ms |
20856 KB |
Output is correct |
57 |
Correct |
493 ms |
18680 KB |
Output is correct |
58 |
Correct |
595 ms |
20600 KB |
Output is correct |
59 |
Correct |
9 ms |
504 KB |
Output is correct |
60 |
Correct |
5 ms |
256 KB |
Output is correct |
61 |
Correct |
9 ms |
504 KB |
Output is correct |
62 |
Correct |
601 ms |
20600 KB |
Output is correct |
63 |
Correct |
598 ms |
20600 KB |
Output is correct |
64 |
Correct |
6 ms |
376 KB |
Output is correct |
65 |
Correct |
587 ms |
20600 KB |
Output is correct |
66 |
Correct |
493 ms |
18680 KB |
Output is correct |
67 |
Correct |
573 ms |
19704 KB |
Output is correct |
68 |
Correct |
9 ms |
504 KB |
Output is correct |
69 |
Correct |
490 ms |
17784 KB |
Output is correct |
70 |
Correct |
269 ms |
8312 KB |
Output is correct |
71 |
Correct |
576 ms |
20216 KB |
Output is correct |
72 |
Correct |
495 ms |
18680 KB |
Output is correct |
73 |
Correct |
230 ms |
9976 KB |
Output is correct |
74 |
Correct |
5 ms |
256 KB |
Output is correct |
75 |
Correct |
525 ms |
18680 KB |
Output is correct |
76 |
Correct |
168 ms |
5496 KB |
Output is correct |
77 |
Correct |
9 ms |
504 KB |
Output is correct |
78 |
Correct |
462 ms |
17656 KB |
Output is correct |
79 |
Correct |
5 ms |
256 KB |
Output is correct |
80 |
Correct |
9 ms |
504 KB |
Output is correct |
81 |
Correct |
5 ms |
256 KB |
Output is correct |
82 |
Correct |
594 ms |
20556 KB |
Output is correct |
83 |
Correct |
7 ms |
376 KB |
Output is correct |
84 |
Correct |
5 ms |
256 KB |
Output is correct |
85 |
Correct |
581 ms |
20000 KB |
Output is correct |