Submission #68127

# Submission time Handle Problem Language Result Execution time Memory
68127 2018-08-16T04:33:02 Z red1108 None (KOI18_XCorr) C++17
100 / 100
315 ms 238132 KB
#include <iostream>
#include <algorithm>
using namespace std;
int an, bn;
long long ax[300010],a[300010],bx[300010],b[300010],bsum[300010],ans,l,r;
int main()
{
    int i;
    scanf("%d",&an);
    for(i=1;i<=an;i++)
    {
        scanf("%lld %lld", &ax[i], &a[i]);
    }
    scanf("%d",&bn);
    for(i=1;i<=bn;i++)
    {
        scanf("%lld %lld", &bx[i], &b[i]);
        bsum[i]=bsum[i-1]+b[i];
    }
    scanf("%lld %lld", &l, &r);
    for(i=1;i<=an;i++)
    {
        ans=ans+(bsum[upper_bound(bx+1,bx+bn+1,ax[i]+r)-bx-1]-bsum[lower_bound(bx+1,bx+bn+1,ax[i]+l)-bx-1])*a[i];
    }
    printf("%lld", ans);
}

Compilation message

XCorr.cpp: In function 'int main()':
XCorr.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&an);
     ~~~~~^~~~~~~~~~
XCorr.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &ax[i], &a[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&bn);
     ~~~~~^~~~~~~~~~
XCorr.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &bx[i], &b[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld", &l, &r);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 7 ms 676 KB Output is correct
3 Correct 5 ms 788 KB Output is correct
4 Correct 4 ms 788 KB Output is correct
5 Correct 3 ms 788 KB Output is correct
6 Correct 5 ms 788 KB Output is correct
7 Correct 4 ms 900 KB Output is correct
8 Correct 4 ms 900 KB Output is correct
9 Correct 3 ms 988 KB Output is correct
10 Correct 4 ms 1264 KB Output is correct
11 Correct 2 ms 1264 KB Output is correct
12 Correct 5 ms 1384 KB Output is correct
13 Correct 4 ms 1504 KB Output is correct
14 Correct 3 ms 1504 KB Output is correct
15 Correct 5 ms 1504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 7 ms 676 KB Output is correct
3 Correct 5 ms 788 KB Output is correct
4 Correct 4 ms 788 KB Output is correct
5 Correct 3 ms 788 KB Output is correct
6 Correct 5 ms 788 KB Output is correct
7 Correct 4 ms 900 KB Output is correct
8 Correct 4 ms 900 KB Output is correct
9 Correct 3 ms 988 KB Output is correct
10 Correct 4 ms 1264 KB Output is correct
11 Correct 2 ms 1264 KB Output is correct
12 Correct 5 ms 1384 KB Output is correct
13 Correct 4 ms 1504 KB Output is correct
14 Correct 3 ms 1504 KB Output is correct
15 Correct 5 ms 1504 KB Output is correct
16 Correct 113 ms 11724 KB Output is correct
17 Correct 5 ms 11724 KB Output is correct
18 Correct 194 ms 23436 KB Output is correct
19 Correct 6 ms 23436 KB Output is correct
20 Correct 4 ms 23436 KB Output is correct
21 Correct 3 ms 23436 KB Output is correct
22 Correct 3 ms 23436 KB Output is correct
23 Correct 5 ms 23436 KB Output is correct
24 Correct 181 ms 28712 KB Output is correct
25 Correct 188 ms 36588 KB Output is correct
26 Correct 173 ms 43096 KB Output is correct
27 Correct 7 ms 43096 KB Output is correct
28 Correct 5 ms 43096 KB Output is correct
29 Correct 3 ms 43096 KB Output is correct
30 Correct 229 ms 49944 KB Output is correct
31 Correct 7 ms 49944 KB Output is correct
32 Correct 193 ms 55744 KB Output is correct
33 Correct 173 ms 62972 KB Output is correct
34 Correct 78 ms 62972 KB Output is correct
35 Correct 2 ms 62972 KB Output is correct
36 Correct 192 ms 72672 KB Output is correct
37 Correct 62 ms 72672 KB Output is correct
38 Correct 5 ms 72672 KB Output is correct
39 Correct 145 ms 80444 KB Output is correct
40 Correct 7 ms 80444 KB Output is correct
41 Correct 3 ms 80444 KB Output is correct
42 Correct 3 ms 80444 KB Output is correct
43 Correct 2 ms 80444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 7 ms 676 KB Output is correct
3 Correct 5 ms 788 KB Output is correct
4 Correct 4 ms 788 KB Output is correct
5 Correct 3 ms 788 KB Output is correct
6 Correct 5 ms 788 KB Output is correct
7 Correct 4 ms 900 KB Output is correct
8 Correct 4 ms 900 KB Output is correct
9 Correct 3 ms 988 KB Output is correct
10 Correct 4 ms 1264 KB Output is correct
11 Correct 2 ms 1264 KB Output is correct
12 Correct 5 ms 1384 KB Output is correct
13 Correct 4 ms 1504 KB Output is correct
14 Correct 3 ms 1504 KB Output is correct
15 Correct 5 ms 1504 KB Output is correct
16 Correct 113 ms 11724 KB Output is correct
17 Correct 5 ms 11724 KB Output is correct
18 Correct 194 ms 23436 KB Output is correct
19 Correct 6 ms 23436 KB Output is correct
20 Correct 4 ms 23436 KB Output is correct
21 Correct 3 ms 23436 KB Output is correct
22 Correct 3 ms 23436 KB Output is correct
23 Correct 5 ms 23436 KB Output is correct
24 Correct 181 ms 28712 KB Output is correct
25 Correct 188 ms 36588 KB Output is correct
26 Correct 173 ms 43096 KB Output is correct
27 Correct 7 ms 43096 KB Output is correct
28 Correct 5 ms 43096 KB Output is correct
29 Correct 3 ms 43096 KB Output is correct
30 Correct 229 ms 49944 KB Output is correct
31 Correct 7 ms 49944 KB Output is correct
32 Correct 193 ms 55744 KB Output is correct
33 Correct 173 ms 62972 KB Output is correct
34 Correct 78 ms 62972 KB Output is correct
35 Correct 2 ms 62972 KB Output is correct
36 Correct 192 ms 72672 KB Output is correct
37 Correct 62 ms 72672 KB Output is correct
38 Correct 5 ms 72672 KB Output is correct
39 Correct 145 ms 80444 KB Output is correct
40 Correct 7 ms 80444 KB Output is correct
41 Correct 3 ms 80444 KB Output is correct
42 Correct 3 ms 80444 KB Output is correct
43 Correct 2 ms 80444 KB Output is correct
44 Correct 109 ms 80444 KB Output is correct
45 Correct 4 ms 80444 KB Output is correct
46 Correct 186 ms 91664 KB Output is correct
47 Correct 4 ms 91664 KB Output is correct
48 Correct 149 ms 94716 KB Output is correct
49 Correct 73 ms 94716 KB Output is correct
50 Correct 6 ms 94716 KB Output is correct
51 Correct 4 ms 94716 KB Output is correct
52 Correct 2 ms 94716 KB Output is correct
53 Correct 4 ms 94716 KB Output is correct
54 Correct 196 ms 106020 KB Output is correct
55 Correct 155 ms 113804 KB Output is correct
56 Correct 175 ms 122588 KB Output is correct
57 Correct 169 ms 129220 KB Output is correct
58 Correct 264 ms 137772 KB Output is correct
59 Correct 5 ms 137772 KB Output is correct
60 Correct 3 ms 137772 KB Output is correct
61 Correct 5 ms 137772 KB Output is correct
62 Correct 192 ms 146432 KB Output is correct
63 Correct 315 ms 155036 KB Output is correct
64 Correct 3 ms 155036 KB Output is correct
65 Correct 228 ms 163504 KB Output is correct
66 Correct 188 ms 170148 KB Output is correct
67 Correct 232 ms 177748 KB Output is correct
68 Correct 6 ms 177748 KB Output is correct
69 Correct 195 ms 184188 KB Output is correct
70 Correct 104 ms 184188 KB Output is correct
71 Correct 199 ms 196524 KB Output is correct
72 Correct 194 ms 203452 KB Output is correct
73 Correct 120 ms 203452 KB Output is correct
74 Correct 4 ms 203452 KB Output is correct
75 Correct 203 ms 213288 KB Output is correct
76 Correct 61 ms 213288 KB Output is correct
77 Correct 5 ms 213288 KB Output is correct
78 Correct 172 ms 220992 KB Output is correct
79 Correct 2 ms 220992 KB Output is correct
80 Correct 5 ms 220992 KB Output is correct
81 Correct 2 ms 220992 KB Output is correct
82 Correct 231 ms 230164 KB Output is correct
83 Correct 3 ms 230164 KB Output is correct
84 Correct 2 ms 230164 KB Output is correct
85 Correct 234 ms 238132 KB Output is correct