답안 #85094

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
85094 2018-11-18T13:28:49 Z tjdgus4384 XCorr (KOI18_XCorr) C++14
100 / 100
346 ms 228868 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
pair<ll, ll> a[300001], b[300001];
ll n, m, ans, x, y;

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

Compilation message

XCorr.cpp: In function 'int main()':
XCorr.cpp:9:8: warning: unused variable 'i' [-Wunused-variable]
     ll i, j, l;
        ^
XCorr.cpp:9:11: warning: unused variable 'j' [-Wunused-variable]
     ll i, j, l;
           ^
XCorr.cpp:9:14: warning: unused variable 'l' [-Wunused-variable]
     ll i, j, l;
              ^
XCorr.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &n);
     ~~~~~^~~~~~~~~~~~
XCorr.cpp:13:14: 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:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &m);
     ~~~~~^~~~~~~~~~~~
XCorr.cpp:18:14: 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:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld", &x, &y);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 4 ms 628 KB Output is correct
3 Correct 4 ms 628 KB Output is correct
4 Correct 3 ms 628 KB Output is correct
5 Correct 2 ms 628 KB Output is correct
6 Correct 3 ms 660 KB Output is correct
7 Correct 4 ms 660 KB Output is correct
8 Correct 4 ms 660 KB Output is correct
9 Correct 2 ms 660 KB Output is correct
10 Correct 3 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 3 ms 660 KB Output is correct
13 Correct 3 ms 660 KB Output is correct
14 Correct 2 ms 660 KB Output is correct
15 Correct 3 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 4 ms 628 KB Output is correct
3 Correct 4 ms 628 KB Output is correct
4 Correct 3 ms 628 KB Output is correct
5 Correct 2 ms 628 KB Output is correct
6 Correct 3 ms 660 KB Output is correct
7 Correct 4 ms 660 KB Output is correct
8 Correct 4 ms 660 KB Output is correct
9 Correct 2 ms 660 KB Output is correct
10 Correct 3 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 3 ms 660 KB Output is correct
13 Correct 3 ms 660 KB Output is correct
14 Correct 2 ms 660 KB Output is correct
15 Correct 3 ms 716 KB Output is correct
16 Correct 87 ms 5856 KB Output is correct
17 Correct 3 ms 5856 KB Output is correct
18 Correct 156 ms 16708 KB Output is correct
19 Correct 3 ms 16708 KB Output is correct
20 Correct 4 ms 16708 KB Output is correct
21 Correct 4 ms 16708 KB Output is correct
22 Correct 2 ms 16708 KB Output is correct
23 Correct 3 ms 16708 KB Output is correct
24 Correct 139 ms 22372 KB Output is correct
25 Correct 142 ms 29896 KB Output is correct
26 Correct 153 ms 36600 KB Output is correct
27 Correct 3 ms 36600 KB Output is correct
28 Correct 4 ms 36600 KB Output is correct
29 Correct 3 ms 36600 KB Output is correct
30 Correct 151 ms 43292 KB Output is correct
31 Correct 3 ms 43292 KB Output is correct
32 Correct 142 ms 49224 KB Output is correct
33 Correct 151 ms 56228 KB Output is correct
34 Correct 69 ms 56228 KB Output is correct
35 Correct 2 ms 56228 KB Output is correct
36 Correct 144 ms 65944 KB Output is correct
37 Correct 50 ms 65944 KB Output is correct
38 Correct 3 ms 65944 KB Output is correct
39 Correct 148 ms 73864 KB Output is correct
40 Correct 4 ms 73864 KB Output is correct
41 Correct 2 ms 73864 KB Output is correct
42 Correct 3 ms 73864 KB Output is correct
43 Correct 2 ms 73864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 4 ms 628 KB Output is correct
3 Correct 4 ms 628 KB Output is correct
4 Correct 3 ms 628 KB Output is correct
5 Correct 2 ms 628 KB Output is correct
6 Correct 3 ms 660 KB Output is correct
7 Correct 4 ms 660 KB Output is correct
8 Correct 4 ms 660 KB Output is correct
9 Correct 2 ms 660 KB Output is correct
10 Correct 3 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 3 ms 660 KB Output is correct
13 Correct 3 ms 660 KB Output is correct
14 Correct 2 ms 660 KB Output is correct
15 Correct 3 ms 716 KB Output is correct
16 Correct 87 ms 5856 KB Output is correct
17 Correct 3 ms 5856 KB Output is correct
18 Correct 156 ms 16708 KB Output is correct
19 Correct 3 ms 16708 KB Output is correct
20 Correct 4 ms 16708 KB Output is correct
21 Correct 4 ms 16708 KB Output is correct
22 Correct 2 ms 16708 KB Output is correct
23 Correct 3 ms 16708 KB Output is correct
24 Correct 139 ms 22372 KB Output is correct
25 Correct 142 ms 29896 KB Output is correct
26 Correct 153 ms 36600 KB Output is correct
27 Correct 3 ms 36600 KB Output is correct
28 Correct 4 ms 36600 KB Output is correct
29 Correct 3 ms 36600 KB Output is correct
30 Correct 151 ms 43292 KB Output is correct
31 Correct 3 ms 43292 KB Output is correct
32 Correct 142 ms 49224 KB Output is correct
33 Correct 151 ms 56228 KB Output is correct
34 Correct 69 ms 56228 KB Output is correct
35 Correct 2 ms 56228 KB Output is correct
36 Correct 144 ms 65944 KB Output is correct
37 Correct 50 ms 65944 KB Output is correct
38 Correct 3 ms 65944 KB Output is correct
39 Correct 148 ms 73864 KB Output is correct
40 Correct 4 ms 73864 KB Output is correct
41 Correct 2 ms 73864 KB Output is correct
42 Correct 3 ms 73864 KB Output is correct
43 Correct 2 ms 73864 KB Output is correct
44 Correct 91 ms 74148 KB Output is correct
45 Correct 4 ms 74148 KB Output is correct
46 Correct 146 ms 84904 KB Output is correct
47 Correct 3 ms 84904 KB Output is correct
48 Correct 122 ms 88572 KB Output is correct
49 Correct 61 ms 88572 KB Output is correct
50 Correct 4 ms 88572 KB Output is correct
51 Correct 3 ms 88572 KB Output is correct
52 Correct 2 ms 88572 KB Output is correct
53 Correct 4 ms 88572 KB Output is correct
54 Correct 138 ms 99596 KB Output is correct
55 Correct 134 ms 107240 KB Output is correct
56 Correct 156 ms 115564 KB Output is correct
57 Correct 148 ms 122228 KB Output is correct
58 Correct 177 ms 130740 KB Output is correct
59 Correct 5 ms 130740 KB Output is correct
60 Correct 2 ms 130740 KB Output is correct
61 Correct 3 ms 130740 KB Output is correct
62 Correct 174 ms 138572 KB Output is correct
63 Correct 184 ms 146996 KB Output is correct
64 Correct 3 ms 146996 KB Output is correct
65 Correct 252 ms 155548 KB Output is correct
66 Correct 147 ms 162056 KB Output is correct
67 Correct 207 ms 169844 KB Output is correct
68 Correct 3 ms 169844 KB Output is correct
69 Correct 156 ms 175716 KB Output is correct
70 Correct 80 ms 175716 KB Output is correct
71 Correct 170 ms 188072 KB Output is correct
72 Correct 196 ms 194796 KB Output is correct
73 Correct 109 ms 194796 KB Output is correct
74 Correct 2 ms 194796 KB Output is correct
75 Correct 346 ms 203800 KB Output is correct
76 Correct 97 ms 203800 KB Output is correct
77 Correct 5 ms 203800 KB Output is correct
78 Correct 150 ms 211776 KB Output is correct
79 Correct 2 ms 211776 KB Output is correct
80 Correct 4 ms 211776 KB Output is correct
81 Correct 2 ms 211776 KB Output is correct
82 Correct 176 ms 220820 KB Output is correct
83 Correct 3 ms 220820 KB Output is correct
84 Correct 2 ms 220820 KB Output is correct
85 Correct 166 ms 228868 KB Output is correct