답안 #65656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65656 2018-08-08T11:05:00 Z sebinkim XCorr (KOI18_XCorr) C++14
100 / 100
199 ms 235504 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

pll A[303030], B[303030];
ll n, m, ans, a, b;

int main()
{
	ll i, j, l;
	
	scanf("%lld", &n);
	
	for(i=1; i<=n; i++){
		scanf("%lld%lld", &A[i].first, &A[i].second);
	}
	
	scanf("%lld", &m);
	
	for(i=1; i<=m; i++){
		scanf("%lld%lld", &B[i].first, &B[i].second);
		B[i].second += B[i-1].second;
	}
	
	scanf("%lld%lld", &a, &b);
	
	for(i=j=l=1; i<=n; i++){
		for(; j <= m && A[i].first + a > B[j].first; j++);
		for(; l <= m && A[i].first + b >= B[l].first; l++);
		ans += A[i].second * (B[l-1].second - B[j-1].second);
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

Compilation message

XCorr.cpp: In function 'int main()':
XCorr.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
  ~~~~~^~~~~~~~~~~~
XCorr.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &A[i].first, &A[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &m);
  ~~~~~^~~~~~~~~~~~
XCorr.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &B[i].first, &B[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 748 KB Output is correct
3 Correct 5 ms 848 KB Output is correct
4 Correct 4 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 5 ms 1120 KB Output is correct
7 Correct 5 ms 1128 KB Output is correct
8 Correct 5 ms 1188 KB Output is correct
9 Correct 4 ms 1188 KB Output is correct
10 Correct 4 ms 1264 KB Output is correct
11 Correct 2 ms 1296 KB Output is correct
12 Correct 5 ms 1384 KB Output is correct
13 Correct 6 ms 1440 KB Output is correct
14 Correct 2 ms 1440 KB Output is correct
15 Correct 3 ms 1440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 748 KB Output is correct
3 Correct 5 ms 848 KB Output is correct
4 Correct 4 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 5 ms 1120 KB Output is correct
7 Correct 5 ms 1128 KB Output is correct
8 Correct 5 ms 1188 KB Output is correct
9 Correct 4 ms 1188 KB Output is correct
10 Correct 4 ms 1264 KB Output is correct
11 Correct 2 ms 1296 KB Output is correct
12 Correct 5 ms 1384 KB Output is correct
13 Correct 6 ms 1440 KB Output is correct
14 Correct 2 ms 1440 KB Output is correct
15 Correct 3 ms 1440 KB Output is correct
16 Correct 87 ms 10304 KB Output is correct
17 Correct 5 ms 10304 KB Output is correct
18 Correct 158 ms 21040 KB Output is correct
19 Correct 5 ms 21040 KB Output is correct
20 Correct 4 ms 21040 KB Output is correct
21 Correct 4 ms 21040 KB Output is correct
22 Correct 3 ms 21040 KB Output is correct
23 Correct 4 ms 21040 KB Output is correct
24 Correct 166 ms 26812 KB Output is correct
25 Correct 151 ms 34368 KB Output is correct
26 Correct 151 ms 40888 KB Output is correct
27 Correct 4 ms 40888 KB Output is correct
28 Correct 4 ms 40888 KB Output is correct
29 Correct 4 ms 40888 KB Output is correct
30 Correct 149 ms 47608 KB Output is correct
31 Correct 5 ms 47608 KB Output is correct
32 Correct 161 ms 53692 KB Output is correct
33 Correct 154 ms 60668 KB Output is correct
34 Correct 80 ms 60668 KB Output is correct
35 Correct 3 ms 60668 KB Output is correct
36 Correct 178 ms 70384 KB Output is correct
37 Correct 57 ms 70384 KB Output is correct
38 Correct 4 ms 70384 KB Output is correct
39 Correct 156 ms 78184 KB Output is correct
40 Correct 5 ms 78184 KB Output is correct
41 Correct 3 ms 78184 KB Output is correct
42 Correct 3 ms 78184 KB Output is correct
43 Correct 3 ms 78184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 748 KB Output is correct
3 Correct 5 ms 848 KB Output is correct
4 Correct 4 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 5 ms 1120 KB Output is correct
7 Correct 5 ms 1128 KB Output is correct
8 Correct 5 ms 1188 KB Output is correct
9 Correct 4 ms 1188 KB Output is correct
10 Correct 4 ms 1264 KB Output is correct
11 Correct 2 ms 1296 KB Output is correct
12 Correct 5 ms 1384 KB Output is correct
13 Correct 6 ms 1440 KB Output is correct
14 Correct 2 ms 1440 KB Output is correct
15 Correct 3 ms 1440 KB Output is correct
16 Correct 87 ms 10304 KB Output is correct
17 Correct 5 ms 10304 KB Output is correct
18 Correct 158 ms 21040 KB Output is correct
19 Correct 5 ms 21040 KB Output is correct
20 Correct 4 ms 21040 KB Output is correct
21 Correct 4 ms 21040 KB Output is correct
22 Correct 3 ms 21040 KB Output is correct
23 Correct 4 ms 21040 KB Output is correct
24 Correct 166 ms 26812 KB Output is correct
25 Correct 151 ms 34368 KB Output is correct
26 Correct 151 ms 40888 KB Output is correct
27 Correct 4 ms 40888 KB Output is correct
28 Correct 4 ms 40888 KB Output is correct
29 Correct 4 ms 40888 KB Output is correct
30 Correct 149 ms 47608 KB Output is correct
31 Correct 5 ms 47608 KB Output is correct
32 Correct 161 ms 53692 KB Output is correct
33 Correct 154 ms 60668 KB Output is correct
34 Correct 80 ms 60668 KB Output is correct
35 Correct 3 ms 60668 KB Output is correct
36 Correct 178 ms 70384 KB Output is correct
37 Correct 57 ms 70384 KB Output is correct
38 Correct 4 ms 70384 KB Output is correct
39 Correct 156 ms 78184 KB Output is correct
40 Correct 5 ms 78184 KB Output is correct
41 Correct 3 ms 78184 KB Output is correct
42 Correct 3 ms 78184 KB Output is correct
43 Correct 3 ms 78184 KB Output is correct
44 Correct 108 ms 78564 KB Output is correct
45 Correct 4 ms 78564 KB Output is correct
46 Correct 166 ms 89384 KB Output is correct
47 Correct 4 ms 89384 KB Output is correct
48 Correct 147 ms 92884 KB Output is correct
49 Correct 66 ms 92884 KB Output is correct
50 Correct 4 ms 92884 KB Output is correct
51 Correct 5 ms 92884 KB Output is correct
52 Correct 4 ms 92884 KB Output is correct
53 Correct 4 ms 92884 KB Output is correct
54 Correct 155 ms 103888 KB Output is correct
55 Correct 143 ms 111448 KB Output is correct
56 Correct 163 ms 120224 KB Output is correct
57 Correct 153 ms 126876 KB Output is correct
58 Correct 173 ms 135492 KB Output is correct
59 Correct 3 ms 135492 KB Output is correct
60 Correct 2 ms 135492 KB Output is correct
61 Correct 4 ms 135492 KB Output is correct
62 Correct 199 ms 144112 KB Output is correct
63 Correct 181 ms 152628 KB Output is correct
64 Correct 3 ms 152628 KB Output is correct
65 Correct 173 ms 161208 KB Output is correct
66 Correct 177 ms 167820 KB Output is correct
67 Correct 180 ms 175472 KB Output is correct
68 Correct 4 ms 175472 KB Output is correct
69 Correct 157 ms 182012 KB Output is correct
70 Correct 100 ms 182012 KB Output is correct
71 Correct 184 ms 194256 KB Output is correct
72 Correct 164 ms 201008 KB Output is correct
73 Correct 83 ms 201008 KB Output is correct
74 Correct 3 ms 201008 KB Output is correct
75 Correct 173 ms 210808 KB Output is correct
76 Correct 57 ms 210808 KB Output is correct
77 Correct 4 ms 210808 KB Output is correct
78 Correct 156 ms 218624 KB Output is correct
79 Correct 2 ms 218624 KB Output is correct
80 Correct 5 ms 218624 KB Output is correct
81 Correct 3 ms 218624 KB Output is correct
82 Correct 195 ms 227456 KB Output is correct
83 Correct 5 ms 227456 KB Output is correct
84 Correct 2 ms 227456 KB Output is correct
85 Correct 182 ms 235504 KB Output is correct