# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
108182 |
2019-04-28T00:03:44 Z |
aer0park |
None (KOI18_XCorr) |
C++14 |
|
205 ms |
18008 KB |
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
ll n,m,mx,mn,anw;
vector<pi> px,y;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
px.push_back({-1e10,0});
for(int i=0;i<n;i++)
{
ll a,b;cin>>a>>b;
px.push_back({a,px[i].s+b});
}
cin>>m;
for(int i=0;i<m;i++)
{
ll a,b;cin>>a>>b;
y.push_back({a,b});
}
cin>>mn>>mx;
mn=-mn,mx=-mx;
swap(mn,mx);
for(int i=0;i<m;i++)
{
ll nw=y[i].f,nv=y[i].s,a=1,b=0;
if(nw+mx<0)
continue;
b=upper_bound(px.begin(),px.end(),pi(nw+mx,1e11))-px.begin();
if(nw+mn>=0)
a=lower_bound(px.begin(),px.end(),pi(nw+mn,-1e11))-px.begin();
anw+=nv*(px[b-1].s-px[a-1].s);
}
cout<<anw;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
512 KB |
Output is correct |
2 |
Correct |
3 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
512 KB |
Output is correct |
7 |
Correct |
4 ms |
512 KB |
Output is correct |
8 |
Correct |
4 ms |
512 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
640 KB |
Output is correct |
13 |
Correct |
4 ms |
512 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
512 KB |
Output is correct |
2 |
Correct |
3 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
512 KB |
Output is correct |
7 |
Correct |
4 ms |
512 KB |
Output is correct |
8 |
Correct |
4 ms |
512 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
640 KB |
Output is correct |
13 |
Correct |
4 ms |
512 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
512 KB |
Output is correct |
16 |
Correct |
81 ms |
9540 KB |
Output is correct |
17 |
Correct |
3 ms |
512 KB |
Output is correct |
18 |
Correct |
129 ms |
17876 KB |
Output is correct |
19 |
Correct |
4 ms |
512 KB |
Output is correct |
20 |
Correct |
3 ms |
588 KB |
Output is correct |
21 |
Correct |
3 ms |
512 KB |
Output is correct |
22 |
Correct |
2 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
560 KB |
Output is correct |
24 |
Correct |
195 ms |
17492 KB |
Output is correct |
25 |
Correct |
132 ms |
17952 KB |
Output is correct |
26 |
Correct |
140 ms |
17980 KB |
Output is correct |
27 |
Correct |
4 ms |
512 KB |
Output is correct |
28 |
Correct |
4 ms |
512 KB |
Output is correct |
29 |
Correct |
3 ms |
384 KB |
Output is correct |
30 |
Correct |
131 ms |
17848 KB |
Output is correct |
31 |
Correct |
4 ms |
512 KB |
Output is correct |
32 |
Correct |
155 ms |
17880 KB |
Output is correct |
33 |
Correct |
137 ms |
17836 KB |
Output is correct |
34 |
Correct |
61 ms |
9308 KB |
Output is correct |
35 |
Correct |
2 ms |
384 KB |
Output is correct |
36 |
Correct |
140 ms |
17852 KB |
Output is correct |
37 |
Correct |
38 ms |
5108 KB |
Output is correct |
38 |
Correct |
4 ms |
512 KB |
Output is correct |
39 |
Correct |
133 ms |
17624 KB |
Output is correct |
40 |
Correct |
4 ms |
512 KB |
Output is correct |
41 |
Correct |
2 ms |
384 KB |
Output is correct |
42 |
Correct |
4 ms |
512 KB |
Output is correct |
43 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
512 KB |
Output is correct |
2 |
Correct |
3 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
512 KB |
Output is correct |
7 |
Correct |
4 ms |
512 KB |
Output is correct |
8 |
Correct |
4 ms |
512 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
512 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
640 KB |
Output is correct |
13 |
Correct |
4 ms |
512 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
512 KB |
Output is correct |
16 |
Correct |
81 ms |
9540 KB |
Output is correct |
17 |
Correct |
3 ms |
512 KB |
Output is correct |
18 |
Correct |
129 ms |
17876 KB |
Output is correct |
19 |
Correct |
4 ms |
512 KB |
Output is correct |
20 |
Correct |
3 ms |
588 KB |
Output is correct |
21 |
Correct |
3 ms |
512 KB |
Output is correct |
22 |
Correct |
2 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
560 KB |
Output is correct |
24 |
Correct |
195 ms |
17492 KB |
Output is correct |
25 |
Correct |
132 ms |
17952 KB |
Output is correct |
26 |
Correct |
140 ms |
17980 KB |
Output is correct |
27 |
Correct |
4 ms |
512 KB |
Output is correct |
28 |
Correct |
4 ms |
512 KB |
Output is correct |
29 |
Correct |
3 ms |
384 KB |
Output is correct |
30 |
Correct |
131 ms |
17848 KB |
Output is correct |
31 |
Correct |
4 ms |
512 KB |
Output is correct |
32 |
Correct |
155 ms |
17880 KB |
Output is correct |
33 |
Correct |
137 ms |
17836 KB |
Output is correct |
34 |
Correct |
61 ms |
9308 KB |
Output is correct |
35 |
Correct |
2 ms |
384 KB |
Output is correct |
36 |
Correct |
140 ms |
17852 KB |
Output is correct |
37 |
Correct |
38 ms |
5108 KB |
Output is correct |
38 |
Correct |
4 ms |
512 KB |
Output is correct |
39 |
Correct |
133 ms |
17624 KB |
Output is correct |
40 |
Correct |
4 ms |
512 KB |
Output is correct |
41 |
Correct |
2 ms |
384 KB |
Output is correct |
42 |
Correct |
4 ms |
512 KB |
Output is correct |
43 |
Correct |
3 ms |
384 KB |
Output is correct |
44 |
Correct |
95 ms |
9544 KB |
Output is correct |
45 |
Correct |
5 ms |
512 KB |
Output is correct |
46 |
Correct |
135 ms |
17880 KB |
Output is correct |
47 |
Correct |
3 ms |
512 KB |
Output is correct |
48 |
Correct |
114 ms |
9828 KB |
Output is correct |
49 |
Correct |
54 ms |
5140 KB |
Output is correct |
50 |
Correct |
4 ms |
512 KB |
Output is correct |
51 |
Correct |
3 ms |
512 KB |
Output is correct |
52 |
Correct |
2 ms |
256 KB |
Output is correct |
53 |
Correct |
4 ms |
588 KB |
Output is correct |
54 |
Correct |
128 ms |
17596 KB |
Output is correct |
55 |
Correct |
129 ms |
17876 KB |
Output is correct |
56 |
Correct |
152 ms |
17864 KB |
Output is correct |
57 |
Correct |
156 ms |
17848 KB |
Output is correct |
58 |
Correct |
149 ms |
17992 KB |
Output is correct |
59 |
Correct |
4 ms |
640 KB |
Output is correct |
60 |
Correct |
2 ms |
256 KB |
Output is correct |
61 |
Correct |
4 ms |
512 KB |
Output is correct |
62 |
Correct |
184 ms |
18004 KB |
Output is correct |
63 |
Correct |
182 ms |
17932 KB |
Output is correct |
64 |
Correct |
2 ms |
384 KB |
Output is correct |
65 |
Correct |
147 ms |
17876 KB |
Output is correct |
66 |
Correct |
143 ms |
18008 KB |
Output is correct |
67 |
Correct |
205 ms |
17800 KB |
Output is correct |
68 |
Correct |
3 ms |
512 KB |
Output is correct |
69 |
Correct |
137 ms |
17852 KB |
Output is correct |
70 |
Correct |
59 ms |
9184 KB |
Output is correct |
71 |
Correct |
153 ms |
17872 KB |
Output is correct |
72 |
Correct |
136 ms |
17752 KB |
Output is correct |
73 |
Correct |
71 ms |
9184 KB |
Output is correct |
74 |
Correct |
2 ms |
256 KB |
Output is correct |
75 |
Correct |
134 ms |
17824 KB |
Output is correct |
76 |
Correct |
44 ms |
4944 KB |
Output is correct |
77 |
Correct |
4 ms |
512 KB |
Output is correct |
78 |
Correct |
128 ms |
17496 KB |
Output is correct |
79 |
Correct |
2 ms |
384 KB |
Output is correct |
80 |
Correct |
3 ms |
588 KB |
Output is correct |
81 |
Correct |
2 ms |
256 KB |
Output is correct |
82 |
Correct |
165 ms |
17776 KB |
Output is correct |
83 |
Correct |
3 ms |
512 KB |
Output is correct |
84 |
Correct |
2 ms |
384 KB |
Output is correct |
85 |
Correct |
174 ms |
17788 KB |
Output is correct |