답안 #170714

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170714 2019-12-26T07:32:54 Z isvara XCorr (KOI18_XCorr) C++14
100 / 100
172 ms 18552 KB
#include<iostream>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<string.h>
#include<math.h>
#include<stack>
#include<assert.h>
using namespace std;
typedef long long ll;

const int max_n =1e5+1;
 
int N, M;
ll ans;
vector<ll>arr, aidx, bidx, sum;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> N;
	arr.resize(N), aidx.resize(N);
	for (int i = 0; i < N; i++)
	{
		ll idx, val;
		cin >> idx >> val;
		arr[i] = val;
		aidx[i] = idx;
	}
 
 	cin >> M;
	bidx.resize(M + 10), sum.resize(M + 10);
	for (int i = 0; i < M; i++)
	{
		ll idx, val;
		cin >> idx >> val;
		bidx[i] = idx;
		sum[i + 1] = sum[i] + val;
	}
  
	for (int i = M; i < M + 10; i++)
		bidx[i] = 1e18;

	int a, b;
	cin >> a >> b;

 	for (int i = 0; i < N; i++)
	{
		int low=lower_bound(bidx.begin(), bidx.end(), a + aidx[i]) - bidx.begin();
		int high = lower_bound(bidx.begin(), bidx.end(), b + aidx[i]+1) - bidx.begin();
		ans += arr[i]*(sum[high] - sum[low]);
	}
	cout << ans;
}

 
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 504 KB Output is correct
13 Correct 3 ms 504 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 504 KB Output is correct
13 Correct 3 ms 504 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 88 ms 9476 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 156 ms 16376 KB Output is correct
19 Correct 3 ms 504 KB Output is correct
20 Correct 3 ms 504 KB Output is correct
21 Correct 3 ms 428 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 ms 504 KB Output is correct
24 Correct 148 ms 15196 KB Output is correct
25 Correct 148 ms 16632 KB Output is correct
26 Correct 150 ms 16328 KB Output is correct
27 Correct 3 ms 508 KB Output is correct
28 Correct 3 ms 504 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 143 ms 16348 KB Output is correct
31 Correct 3 ms 488 KB Output is correct
32 Correct 153 ms 15736 KB Output is correct
33 Correct 142 ms 16348 KB Output is correct
34 Correct 63 ms 7900 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 151 ms 16376 KB Output is correct
37 Correct 50 ms 5496 KB Output is correct
38 Correct 3 ms 504 KB Output is correct
39 Correct 140 ms 15480 KB Output is correct
40 Correct 3 ms 504 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 504 KB Output is correct
13 Correct 3 ms 504 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 88 ms 9476 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 156 ms 16376 KB Output is correct
19 Correct 3 ms 504 KB Output is correct
20 Correct 3 ms 504 KB Output is correct
21 Correct 3 ms 428 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 ms 504 KB Output is correct
24 Correct 148 ms 15196 KB Output is correct
25 Correct 148 ms 16632 KB Output is correct
26 Correct 150 ms 16328 KB Output is correct
27 Correct 3 ms 508 KB Output is correct
28 Correct 3 ms 504 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 143 ms 16348 KB Output is correct
31 Correct 3 ms 488 KB Output is correct
32 Correct 153 ms 15736 KB Output is correct
33 Correct 142 ms 16348 KB Output is correct
34 Correct 63 ms 7900 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 151 ms 16376 KB Output is correct
37 Correct 50 ms 5496 KB Output is correct
38 Correct 3 ms 504 KB Output is correct
39 Correct 140 ms 15480 KB Output is correct
40 Correct 3 ms 504 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
44 Correct 87 ms 9288 KB Output is correct
45 Correct 3 ms 504 KB Output is correct
46 Correct 155 ms 16376 KB Output is correct
47 Correct 3 ms 504 KB Output is correct
48 Correct 123 ms 13420 KB Output is correct
49 Correct 53 ms 6520 KB Output is correct
50 Correct 3 ms 504 KB Output is correct
51 Correct 3 ms 376 KB Output is correct
52 Correct 2 ms 376 KB Output is correct
53 Correct 3 ms 504 KB Output is correct
54 Correct 149 ms 15096 KB Output is correct
55 Correct 145 ms 16632 KB Output is correct
56 Correct 164 ms 18552 KB Output is correct
57 Correct 148 ms 16480 KB Output is correct
58 Correct 166 ms 18312 KB Output is correct
59 Correct 3 ms 504 KB Output is correct
60 Correct 2 ms 380 KB Output is correct
61 Correct 3 ms 504 KB Output is correct
62 Correct 161 ms 18264 KB Output is correct
63 Correct 170 ms 18296 KB Output is correct
64 Correct 3 ms 376 KB Output is correct
65 Correct 161 ms 18256 KB Output is correct
66 Correct 143 ms 16504 KB Output is correct
67 Correct 172 ms 17632 KB Output is correct
68 Correct 3 ms 476 KB Output is correct
69 Correct 154 ms 15736 KB Output is correct
70 Correct 78 ms 8312 KB Output is correct
71 Correct 167 ms 17852 KB Output is correct
72 Correct 143 ms 16352 KB Output is correct
73 Correct 64 ms 7872 KB Output is correct
74 Correct 2 ms 376 KB Output is correct
75 Correct 152 ms 16468 KB Output is correct
76 Correct 52 ms 5496 KB Output is correct
77 Correct 3 ms 504 KB Output is correct
78 Correct 140 ms 15604 KB Output is correct
79 Correct 2 ms 376 KB Output is correct
80 Correct 4 ms 504 KB Output is correct
81 Correct 2 ms 376 KB Output is correct
82 Correct 169 ms 18268 KB Output is correct
83 Correct 3 ms 376 KB Output is correct
84 Correct 2 ms 376 KB Output is correct
85 Correct 167 ms 17744 KB Output is correct