Submission #108181

# Submission time Handle Problem Language Result Execution time Memory
108181 2019-04-27T23:58:59 Z aer0park None (KOI18_XCorr) C++14
100 / 100
207 ms 25940 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> py,x;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	py.push_back({-1e10,0});
	for(int i=0;i<n;i++)
	{
		ll a,b;cin>>a>>b;	
		x.push_back({a,b});
	}	
	cin>>m;
	for(int i=0;i<m;i++)
	{
		ll a,b;cin>>a>>b;
		py.push_back({a,py[i].s+b});
	}	
	cin>>mn>>mx;
	for(int i=0;i<n;i++)
	{
		ll nw=x[i].f,nv=x[i].s,a=1,b=0;
		if(nw+mx<0)
			continue;
		b=upper_bound(py.begin(),py.end(),pi(nw+mx,1e11))-py.begin();
		if(nw+mn>=0)
			a=lower_bound(py.begin(),py.end(),pi(nw+mn,-1e11))-py.begin();
		anw+=nv*(py[b-1].s-py[a-1].s);
	}
	cout<<anw;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 5 ms 640 KB Output is correct
7 Correct 3 ms 640 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 640 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 4 ms 640 KB Output is correct
13 Correct 3 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 3 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 5 ms 640 KB Output is correct
7 Correct 3 ms 640 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 640 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 4 ms 640 KB Output is correct
13 Correct 3 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 86 ms 12484 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 149 ms 23784 KB Output is correct
19 Correct 4 ms 512 KB Output is correct
20 Correct 4 ms 512 KB Output is correct
21 Correct 3 ms 508 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 4 ms 640 KB Output is correct
24 Correct 139 ms 23124 KB Output is correct
25 Correct 125 ms 23876 KB Output is correct
26 Correct 142 ms 23764 KB Output is correct
27 Correct 3 ms 640 KB Output is correct
28 Correct 4 ms 512 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 132 ms 23864 KB Output is correct
31 Correct 4 ms 512 KB Output is correct
32 Correct 139 ms 23684 KB Output is correct
33 Correct 126 ms 23764 KB Output is correct
34 Correct 71 ms 11740 KB Output is correct
35 Correct 3 ms 384 KB Output is correct
36 Correct 158 ms 23740 KB Output is correct
37 Correct 70 ms 6260 KB Output is correct
38 Correct 5 ms 640 KB Output is correct
39 Correct 149 ms 23328 KB Output is correct
40 Correct 3 ms 564 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 3 ms 512 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 5 ms 640 KB Output is correct
7 Correct 3 ms 640 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 640 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 4 ms 640 KB Output is correct
13 Correct 3 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 86 ms 12484 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 149 ms 23784 KB Output is correct
19 Correct 4 ms 512 KB Output is correct
20 Correct 4 ms 512 KB Output is correct
21 Correct 3 ms 508 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 4 ms 640 KB Output is correct
24 Correct 139 ms 23124 KB Output is correct
25 Correct 125 ms 23876 KB Output is correct
26 Correct 142 ms 23764 KB Output is correct
27 Correct 3 ms 640 KB Output is correct
28 Correct 4 ms 512 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 132 ms 23864 KB Output is correct
31 Correct 4 ms 512 KB Output is correct
32 Correct 139 ms 23684 KB Output is correct
33 Correct 126 ms 23764 KB Output is correct
34 Correct 71 ms 11740 KB Output is correct
35 Correct 3 ms 384 KB Output is correct
36 Correct 158 ms 23740 KB Output is correct
37 Correct 70 ms 6260 KB Output is correct
38 Correct 5 ms 640 KB Output is correct
39 Correct 149 ms 23328 KB Output is correct
40 Correct 3 ms 564 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 3 ms 512 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 129 ms 12508 KB Output is correct
45 Correct 5 ms 640 KB Output is correct
46 Correct 159 ms 23792 KB Output is correct
47 Correct 4 ms 512 KB Output is correct
48 Correct 117 ms 13920 KB Output is correct
49 Correct 65 ms 6816 KB Output is correct
50 Correct 4 ms 512 KB Output is correct
51 Correct 4 ms 512 KB Output is correct
52 Correct 2 ms 384 KB Output is correct
53 Correct 4 ms 640 KB Output is correct
54 Correct 158 ms 23432 KB Output is correct
55 Correct 157 ms 23980 KB Output is correct
56 Correct 171 ms 25940 KB Output is correct
57 Correct 155 ms 23764 KB Output is correct
58 Correct 177 ms 25556 KB Output is correct
59 Correct 4 ms 512 KB Output is correct
60 Correct 2 ms 384 KB Output is correct
61 Correct 3 ms 512 KB Output is correct
62 Correct 143 ms 25528 KB Output is correct
63 Correct 166 ms 25592 KB Output is correct
64 Correct 3 ms 384 KB Output is correct
65 Correct 157 ms 25572 KB Output is correct
66 Correct 122 ms 23764 KB Output is correct
67 Correct 207 ms 25556 KB Output is correct
68 Correct 4 ms 512 KB Output is correct
69 Correct 148 ms 23688 KB Output is correct
70 Correct 72 ms 12564 KB Output is correct
71 Correct 144 ms 25616 KB Output is correct
72 Correct 118 ms 23872 KB Output is correct
73 Correct 57 ms 11872 KB Output is correct
74 Correct 2 ms 384 KB Output is correct
75 Correct 136 ms 23764 KB Output is correct
76 Correct 40 ms 6252 KB Output is correct
77 Correct 3 ms 640 KB Output is correct
78 Correct 127 ms 23336 KB Output is correct
79 Correct 2 ms 384 KB Output is correct
80 Correct 4 ms 640 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 148 ms 25604 KB Output is correct
83 Correct 3 ms 484 KB Output is correct
84 Correct 2 ms 384 KB Output is correct
85 Correct 151 ms 25528 KB Output is correct