QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#845040#9916. Defeat the EnemiesZawosAC ✓451ms41548kbC++232.9kb2025-01-06 14:10:542025-01-06 14:10:54

Judging History

你现在查看的是最新测评结果

  • [2025-01-06 14:10:54]
  • 评测
  • 测评结果:AC
  • 用时:451ms
  • 内存:41548kb
  • [2025-01-06 14:10:54]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using ld=long double;
using vi=vector<int>;
template<class T> using oset =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
//上
const ll MOD = 998244353;
ll dp[21000][105][2];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;
    while(t--){
        int n,m;
        cin >> n >> m;
        vector<pair<int,int>> v(n);
        FOR(i,0,n) cin >> v[i].second;
        FOR(i,0,n) cin >> v[i].first;
        sort(v.begin(),v.end());
        
        int  k;
        cin >> k;
        vector<ll> cost(k);
        FOR(i,0,k) cin >> cost[i];
        FOR(i,0,2*m+210) FOR(j,0,105) dp[i][j][0] = 1e18;
        dp[0][0][0] = 0;
        dp[0][0][1] = 1;
        int mm = 0;
        for(int i = 0,p1 = 0; i <=2*m +k;i++){
            
            while(p1<n && v[p1].first <= i){
                mm = max(mm,v[p1].first+v[p1].second);
                p1++;
            }
            int mx = 0;
            int mr = mm;
            for(int j = 0,p2 = p1; j <k;j++){
                while(p2 < n && v[p2].first <= i+j+1){
                    
                    mx = max(mx, v[p2].second);
                    mr = max(mr, v[p2].second+v[p2].first);
                    p2++;
                }
                for(int r = 0; r < k; r++){
                        if(dp[i][r][0] == 1e18) continue;
                        
                        int nxt = max(mx+i+j+1-mr,r+mm-mr);
                        if(mx == 0) nxt = r;
                        if(dp[i][r][0] +cost[j] < dp[i+j+1][nxt][0]){
                            dp[i+j+1][nxt][0] =dp[i][r][0] +cost[j];
                            dp[i+j+1][nxt][1] = dp[i][r][1];
                        }else if(dp[i][r][0] +cost[j] == dp[i+j+1][nxt][0]){
                            dp[i+j+1][nxt][1] += dp[i][r][1];
                            if(dp[i+j+1][nxt][1]>= MOD) dp[i+j+1][nxt][1] -= MOD;
                        }
                }
                
            }

        }
        // for(int i = 0; i <= 16;i++){
        //     cout <<i<<'\n';
        //     for(int j = 0; j <3; j++) cout <<dp[i][j][0]<<" "<<dp[i][j][1]<<'\n';
        // }
        ll mn = 1e18;
            for(int i = mm; i<=mm+200;i++){
                for(int j = 0; j <k; j++) if(i >= mm +j) mn = min(mn,dp[i][j][0]);
            }
            ll ans = 0;
            for(int i = mm; i<=mm+200;i++){
                for(int j = 0; j <k; j++){
                    if(i >= mm+j && dp[i][j][0] == mn) ans += dp[i][j][1];
                    if(ans >= MOD) ans -= MOD;
                }
            }
            cout <<mn <<" "<<ans<<'\n';
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 6128kb

input:

4
5 5
3 5 2 1 2
3 1 3 2 3
3
2 3 4
3 2
2 2 2
2 2 2
3
2 3 3
7 6
5 3 4 6 6 3 4
4 6 4 2 3 5 5
4
2 4 6 7
10 100
38 49 79 66 49 89 21 55 13 23
67 56 26 39 56 16 84 50 92 82
11
6 6 7 8 9 9 9 9 9 9 9

output:

9 1
6 4
18 18
99 44387

result:

ok 8 numbers

Test #2:

score: 0
Accepted
time: 8ms
memory: 3808kb

input:

1000
5 3
1 1 3 1 2
3 2 1 1 2
1
5
5 3
3 3 2 2 1
1 1 3 1 1
3
3 1 3
5 5
4 3 5 1 4
5 5 2 5 5
2
1 5
5 5
5 5 5 5 4
2 1 2 4 1
2
1 1
5 3
2 1 2 1 1
1 3 2 1 1
1
5
2 1
1 1
1 1
3
2 2 1
5 5
2 3 5 2 2
5 2 4 3 1
2
3 3
5 1
1 1 1 1 1
1 1 1 1 1
3
5 4 4
5 4
1 4 4 4 2
4 3 1 3 3
1
2
1 5
2
2
3
4 2 4
1 5
4
5
1
4
2 5
1 5
1...

output:

20 1
3 1
9 1
5 4
20 1
2 1
15 4
8 4
14 1
4 1
36 1
12 1
27 1
2 1
20 1
4 1
10 1
23 1
10 1
4 1
28 1
4 1
5 1
4 1
6 1
8 1
6 1
16 1
9 6
5 1
30 1
4 1
4 1
2 1
35 1
10 1
2 1
4 1
15 6
4 1
20 1
4 1
6 1
40 1
4 1
18 1
8 1
7 1
6 1
2 1
10 1
3 1
9 1
8 1
4 1
6 4
20 1
8 2
10 1
2 1
2 1
50 1
24 1
6 1
10 16
10 1
6 1
3 1
...

result:

ok 2000 numbers

Test #3:

score: 0
Accepted
time: 37ms
memory: 4224kb

input:

200
50 16
15 15 15 14 15 13 15 15 14 15 16 16 16 12 16 16 16 16 14 13 14 16 13 16 13 16 14 13 16 16 12 14 16 15 13 16 14 16 12 15 14 15 13 14 15 15 15 15 16 13
13 14 16 13 16 16 16 15 13 15 13 16 15 15 16 16 16 16 16 15 16 16 14 12 15 16 16 16 13 12 15 15 16 12 15 14 16 16 16 12 16 16 16 16 15 14 15...

output:

14 6889
68 33856
60 841
388 14400
20 214369
100 1
72 8281
6 256
39 30
4 1
58 1
12 144
4 144
116 169
46 38416
100 1
26 11025
88 36
80 1
10 81
114 100
92 413318192
56 1
50 1296
400 481524050
68 1
32 9
6 1
1100 1
100 103437186
46 1600
80 57
44 576
92 1
26 441
7 320
106 9
68 29241
34 324
29 7878
4 1
4 1...

result:

ok 400 numbers

Test #4:

score: 0
Accepted
time: 165ms
memory: 40184kb

input:

1
500000 10000
3544 1546 5208 6621 759 9303 9198 8910 9046 2355 5960 2034 7059 8504 4449 9573 3020 7106 6973 2021 5158 6148 386 3559 5050 9264 9497 2912 1170 7698 4529 4172 7729 3382 7613 3770 6552 2365 2193 9581 146 7853 5384 4589 3369 3102 9585 3124 1886 8301 8125 3842 4101 5388 3571 10 7190 2464 ...

output:

22388256114 1

result:

ok 2 number(s): "22388256114 1"

Test #5:

score: 0
Accepted
time: 364ms
memory: 18520kb

input:

5
41415 228
216 219 186 142 203 168 225 177 190 214 171 210 212 220 216 215 209 224 226 207 172 218 190 227 194 221 178 207 220 188 226 227 226 225 197 181 201 223 205 209 183 212 223 182 228 198 222 181 206 148 177 221 226 226 226 196 216 209 207 214 220 156 201 212 224 228 155 212 179 226 215 166 ...

output:

5914951720 225
12050089308 100
45462868776 1
64065203428 1
24263725416 44100

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 397ms
memory: 40952kb

input:

1
500000 10000
9776 9848 9204 9656 9915 9808 9447 9583 9898 9857 9475 9935 9717 9778 9517 9982 9999 9896 9937 9991 9696 9150 9774 9722 9780 9411 9987 9556 9964 9400 9597 9845 9679 9809 9238 9775 9796 9926 9673 9984 9970 9952 9620 9546 9951 9819 9360 9897 9898 9814 9861 9996 9998 9587 9905 9624 9473 ...

output:

1346000 1

result:

ok 2 number(s): "1346000 1"

Test #7:

score: 0
Accepted
time: 9ms
memory: 3880kb

input:

1000
10 3
1 2 3 1 2 2 3 2 1 1
1 3 2 3 3 3 3 1 1 1
2
10 7
4 10
4 8 4 6
5 8 9 6
3
3 4 3
3 2
1 2 1
2 2 2
4
4 8 8 2
10 10
1 2 4 7 1 3 5 9 8 9
2 7 3 1 5 1 10 2 9 6
1
9
3 3
2 3 3
3 3 1
4
7 8 1 5
2 2
2 2
2 2
3
8 7 5
6 9
5 3 3 5 1 9
3 7 1 3 2 3
4
6 7 2 3
3 8
4 1 3
8 3 5
5
6 2 9 4 7
10 7
3 2 2 5 3 1 6 3 2 3
...

output:

28 1
18 1
4 1
153 1
2 1
10 1
8 1
12 10
9 6
24 1
38 35
99 1
22 4
2 1
21 1
12 1
8 1
22 12
20 4
12 1
8 1
2 1
8 1
4 1
6 1
10 2
8 1
2 1
33 3
34 1
26 3
35 1
27 1
5 1
45 1
6 1
16 1
6 1
5 1
8 2
12 1
3 1
20 1
2 4
25 1
57 1
10 1
30 1
24 1
50 36
108 1
80 1
10 1
6 1
64 1
40 1
10 1
7 1
10 1
19 1
12 1
4 1
6 1
4 1...

result:

ok 2000 numbers

Test #8:

score: 0
Accepted
time: 15ms
memory: 3972kb

input:

1000
20 3
1 3 1 2 2 2 1 3 3 3 3 1 1 2 3 2 2 1 3 3
3 2 3 1 1 2 2 3 2 3 3 1 2 2 1 1 3 2 2 2
8
8 5 3 7 5 8 8 3
20 16
11 8 13 11 5 14 12 3 14 7 12 11 3 16 14 1 8 6 5 7
1 14 9 16 10 14 8 8 1 2 16 9 6 8 7 7 1 4 3 5
8
10 7 2 8 1 6 4 9
16 11
5 10 6 8 6 9 8 3 7 2 2 9 2 7 7 11
11 1 4 7 6 3 1 6 11 5 9 7 1 5 7 ...

output:

6 4
7 1
3 2
4 4
2 1
2 4
2 1
9 1
16 1
12 1
6 3
28 1
17 1
2 1
5 1
4 1
30 18
4 1
16 1
40 1
8 1
10 1
17 4
60 1
4 1
6 1
4 1
2 4
22 1
32 1
24 12
4 1
98 105
4 4
2 4
25 1
2 1
6 1
6 18
12 1
54 336
6 1
8 1
35 1
2 4
6 2
8 1
15 1
10 1
2 1
4 1
30 1
22 1
78 1
138 81
63 1
4 3
10 1
6 1
10 4
2 1
12 1
6 1
4 1
28 1
7 ...

result:

ok 2000 numbers

Test #9:

score: 0
Accepted
time: 25ms
memory: 3944kb

input:

1000
30 6
3 4 4 6 6 6 5 6 6 5 4 6 6 6 4 5 5 4 6 4 4 3 6 5 5 5 5 5 6 6
6 6 6 6 6 5 4 6 5 6 6 4 5 6 6 5 4 5 5 6 6 6 3 6 6 4 5 5 6 6
20
3 4 5 8 14 18 24 24 32 35 38 59 60 62 71 79 79 80 80 98
30 2
1 2 1 2 1 1 1 2 1 1 2 2 1 1 1 2 2 2 2 1 1 2 2 2 2 2 2 1 2 2
2 2 1 2 2 2 1 1 1 1 2 2 2 1 1 1 2 2 1 2 1 2 2 ...

output:

20 1
74 1
108 16
16 1
28 1
126 1
156 1
84 1
234 81
94 1
299 1
60 1
286 100
130 16
332 16
14 1
30 1
200 4
80 1
72 1
358 9
110 1
410 64
70 1
74 1
6 1
6 1
92 1
94 25
24 1
42 1
72 1
32 1
420 1
32 1
364 1
60 3
22 1
28 4
188 4
420 1
10 4
44 1
51 6
1570 121
4 1
48 1
80 1
48 1
120 1
396 1
108 1
688 25
178 1...

result:

ok 2000 numbers

Test #10:

score: 0
Accepted
time: 26ms
memory: 3880kb

input:

1000
30 8
4 8 5 7 7 8 5 8 7 3 8 5 6 3 6 3 8 8 6 6 5 8 7 4 6 6 7 5 8 6
7 8 6 7 6 8 8 3 7 8 7 7 8 8 5 8 3 5 8 5 8 8 6 7 8 5 6 7 8 8
9
4 8 23 27 29 51 52 88 96
30 2
2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 1 1 2 2 2 2 2 1 2 1 2 2 2 1 2
2 2 1 2 2 1 2 2 1 1 1 2 2 1 2 1 1 2 2 2 2 2 1 2 2 2 2 2 1 1
9
8 13 29 48 52 69...

output:

64 1156
26 1
264 16
252 1
16 1
96 1
28 1
90 9
94 9
94 9
28 1
16 1
1768 1
290 4
8 1
60 1
80 1
120 1
150 4
1568 1
994 100
24 1
18 1
52 1
40 1
22 1
182 1
84 1
176 225
1162 1
320 9
1121 1
144 1
14 1
196 1
4 1
76 1
264 1
4 1
8 1
19 4895
6 9
110 1
88 4
828 1
18 1
18 1
70 1
250 441
56 1
1711 2716504
2910 1...

result:

ok 2000 numbers

Test #11:

score: 0
Accepted
time: 25ms
memory: 4008kb

input:

1000
9 9
9 8 5 7 5 9 9 6 9
4 5 7 9 7 5 6 5 9
18
7 8 15 17 22 24 34 34 38 48 53 56 73 76 77 86 94 99
7 3
3 1 1 3 1 3 3
2 1 2 3 1 3 1
14
8 9 9 11 13 16 32 43 64 66 83 91 93 96
30 6
3 6 6 6 3 3 5 2 3 5 4 5 4 5 5 6 1 4 3 5 5 6 6 6 6 2 4 4 6 3
2 6 6 3 6 5 4 3 5 6 6 5 2 5 3 4 6 6 5 4 4 2 1 6 3 6 6 5 5 5
1...

output:

76 16
18 1
48 1
2040 1
120 1
75 4
104 1
8 1
1562 1
40 1
8 1
50 1
20 1
448 1
132 1
196 1
246 1
42 1
96 1
58 4
72 4
4 1
32 1
368 1
20 1
24 1
272 1
64 9
26 1
45 1
276 4
1885 1
27 1
210 1
58 36
24 4
336 1
250 1
17 3
816 1
134 1
2 1
126 1
132 1
190 1
24 1
1068 1
18 1
4 1
30 1
3995 1
95 6
106 1
26 1
28 4
...

result:

ok 2000 numbers

Test #12:

score: 0
Accepted
time: 139ms
memory: 5872kb

input:

1000
9 39
22 25 20 10 28 39 27 19 27
12 39 16 32 39 6 2 31 23
28
1 1 2 2 4 5 6 6 7 8 8 8 9 9 9 10 11 12 13 14 14 14 15 17 18 19 19 20
43 3
2 1 2 2 3 1 1 2 3 2 1 1 1 3 1 1 3 3 3 2 3 1 2 1 2 2 2 3 3 1 1 3 1 2 1 2 2 1 1 1 3 2 3
3 3 3 1 2 2 2 3 3 3 1 3 2 2 3 1 3 2 2 2 1 3 2 3 3 1 2 1 2 1 1 3 3 3 2 1 2 1...

output:

34 104133710
2 4
2 1
31 1576239
13 9
46 10
7 18
6 8
7 1
16 1
34 4
19 10
12 16
35 11
2 1
15 69
4 36
15 5214
11 1
24 6
6 4
2 4
2 4
2 4
7 18
90 1
12 410
5 30
6 9
6 100
31 7
11 121
12 5
10 4
6 36
22 81
2 16
2 1
4 3
8 81
8 21
19 1
30 1
2 1
10 183
2 1
70 1
8 25
17 1
4 1
6 12
17 1
18 1
7 96
2 4
4 16
20 4
4...

result:

ok 2000 numbers

Test #13:

score: 0
Accepted
time: 69ms
memory: 4200kb

input:

100
453 4
2 1 2 1 1 2 3 2 3 4 3 2 3 4 3 3 3 3 2 4 2 4 1 4 3 4 1 2 2 3 4 4 2 1 3 4 2 4 1 4 1 3 2 2 4 4 2 4 1 4 2 1 3 2 1 4 4 4 1 1 3 4 4 4 4 3 3 3 3 4 2 3 1 4 4 4 1 3 1 3 2 3 4 4 3 2 4 3 2 1 4 4 3 2 1 3 1 2 1 4 2 4 1 2 2 3 4 1 4 3 3 2 2 3 4 4 3 4 3 2 1 1 4 4 4 3 2 3 4 1 2 1 2 4 4 4 3 4 4 2 4 2 2 2 3 ...

output:

6 1
150 1
190 1
84 9
150 1
250 760839507
16 249001
50 1
64 37249
68 49
4 4
58 841
1134 1156
48 136900
512 1
972 1
60 49
68 5053504
32 16641
200 1
40 1
44 9
90 1
100 324
68 5198400
64 1
24 1
106 4225
100 1
102 1
1000 1
120 1
12 784
94 400
54 2704
30 199007449
6 49
52 140625
78 3721
14 1521
232 784
68...

result:

ok 200 numbers

Test #14:

score: 0
Accepted
time: 158ms
memory: 4252kb

input:

100
1520 54
42 51 47 54 38 52 51 54 48 47 48 42 39 54 51 50 47 54 38 52 51 52 48 51 49 52 41 54 40 54 44 51 48 53 45 50 42 37 41 54 37 53 46 45 52 54 45 51 43 53 53 40 41 42 43 49 49 51 53 41 53 54 54 51 46 38 52 45 53 53 47 54 47 54 51 50 50 54 53 53 47 47 54 54 43 53 45 43 53 54 45 42 44 52 44 53 ...

output:

182 400
1236 900
590 9
128 1
200 1
500 1
40 49
20 121
200 16
52 729
436 1
100 1
446 121
27600 1
400 1
62 1024
344 14400
152 81
198 144
302 1444
120 961
552 478377445
400 1
44 1
136 1
56 1
108 79524
362 81
124 16
30 9
272 396900
36 1
528 1
520 1
158 236596073
200 763865953
116 1
1748 3025
6 1
70 1
30...

result:

ok 200 numbers

Test #15:

score: 0
Accepted
time: 133ms
memory: 11180kb

input:

10
87789 439
434 433 437 437 405 428 406 432 418 421 438 439 403 434 431 436 424 436 439 428 421 438 421 432 403 426 403 439 433 412 420 419 437 433 423 428 437 431 436 434 433 436 436 403 414 424 424 434 435 434 400 423 392 436 438 433 425 421 432 433 438 439 427 424 409 426 439 432 415 433 414 434...

output:

4390 1
483000 1
896 1
14938 922402155
2000 1
1892 1
946 216225
2948 1
28000 1
37848 1

result:

ok 20 numbers

Test #16:

score: 0
Accepted
time: 100ms
memory: 8664kb

input:

10
7742 1000
981 992 990 969 995 994 986 969 996 995 991 960 980 997 981 974 999 993 1000 986 993 977 982 977 999 961 990 971 967 989 985 981 988 974 974 974 996 965 975 974 986 998 1000 1000 957 998 1000 984 998 990 989 980 979 983 986 999 996 986 968 998 987 1000 968 988 988 978 974 992 1000 997 9...

output:

8000 1
1352 36
10598 676
552 1
71154 349380396
10000 1
24000 1
9152 1
37000 1
22788 187465752

result:

ok 20 numbers

Test #17:

score: 0
Accepted
time: 123ms
memory: 41420kb

input:

1
500000 10000
9994 9957 9973 9967 9967 9985 9987 9990 9994 10000 9994 9996 9998 9964 9999 9977 9986 9980 9993 9985 9997 9990 9993 9982 9992 9973 9987 9992 9987 9991 9995 9991 9999 9995 9982 9999 9989 9994 9964 9996 9997 9985 9984 9993 9999 9997 9999 9975 10000 10000 9997 9990 9989 9979 10000 10000 ...

output:

100000 1

result:

ok 2 number(s): "100000 1"

Test #18:

score: 0
Accepted
time: 256ms
memory: 40992kb

input:

1
500000 10000
9997 9987 9973 9988 9978 9974 10000 10000 9969 9998 9989 9977 9990 9995 9996 9994 9969 9983 9999 9999 9997 9996 9963 9996 9977 9978 9968 9968 9999 10000 9987 9985 9994 9992 9994 10000 9986 9987 10000 9991 9998 9974 9969 9994 9967 10000 9977 9998 9994 9982 9999 9992 9998 9992 9988 9998...

output:

1432 1

result:

ok 2 number(s): "1432 1"

Test #19:

score: 0
Accepted
time: 142ms
memory: 41172kb

input:

1
500000 10000
5542 9332 7194 7594 4375 6328 7715 5841 5838 1962 5595 4759 6066 8217 8740 8855 9711 5258 51 9614 6501 9350 4691 7920 9832 5001 8080 5091 5278 8069 1469 1266 6500 1213 5118 7499 2810 9786 6094 3234 2178 2793 4747 8828 1973 9963 7173 4421 5774 2132 3458 426 2748 3917 861 6080 1620 8291...

output:

19986 1

result:

ok 2 number(s): "19986 1"

Test #20:

score: 0
Accepted
time: 96ms
memory: 40228kb

input:

1
500000 10000
6698 4586 7716 8341 5598 153 1023 1686 4359 1522 5851 4669 6529 7894 823 1132 2153 3048 402 1673 8723 9136 308 4063 9623 3484 9027 4970 8112 7354 2686 1679 3068 9104 2006 2769 8543 2549 8688 2941 6767 7012 292 7935 3993 48 5633 3803 411 5915 4407 7333 3928 1021 3627 4489 4999 5540 760...

output:

1046248 1

result:

ok 2 number(s): "1046248 1"

Test #21:

score: 0
Accepted
time: 121ms
memory: 40172kb

input:

1
500000 10000
9995 9967 9997 9990 9977 9997 9991 9986 9997 9999 9993 9993 9966 9987 9989 9957 9993 9995 10000 9985 9974 9983 9973 9998 9987 9986 10000 10000 9992 10000 9999 9966 9980 9997 9969 9994 9995 9974 9979 9994 9994 9999 9973 10000 10000 9996 9993 9993 9979 9997 9991 9986 9980 9991 9996 9962...

output:

578410068674 834804506

result:

ok 2 number(s): "578410068674 834804506"

Test #22:

score: 0
Accepted
time: 213ms
memory: 40264kb

input:

1
500000 10000
9981 9995 9963 9988 9988 9999 9987 10000 10000 9989 10000 9997 9994 9973 9976 9968 9995 9981 9973 9981 9993 9994 9991 9970 9990 9998 9989 10000 9991 9987 9996 9996 9997 9996 9979 9996 9993 9971 9995 9979 9994 9996 9982 9998 9989 9998 9984 9986 10000 9960 9985 9993 9985 9989 9993 9991 ...

output:

3305264320 1

result:

ok 2 number(s): "3305264320 1"

Test #23:

score: 0
Accepted
time: 248ms
memory: 40720kb

input:

1
500000 10000
2388 6291 4685 5875 3728 1286 482 5770 7421 2795 5703 4829 2004 315 2366 4192 578 533 3918 8474 5640 3657 4769 120 7962 782 4358 3032 8337 6925 4800 3759 3865 8195 8021 1203 6627 9603 6895 2978 1364 2146 9839 1290 8644 9913 3829 6846 353 4519 1369 1127 2921 8284 806 1601 6515 5615 336...

output:

142990526287 827190

result:

ok 2 number(s): "142990526287 827190"

Test #24:

score: 0
Accepted
time: 49ms
memory: 6552kb

input:

100
5000 18
4 9 18 4 18 17 13 9 8 18 14 17 12 16 18 16 9 17 17 6 12 18 12 14 5 14 18 5 18 11 18 9 15 13 17 18 6 18 14 13 18 13 6 6 17 15 8 10 11 5 10 8 15 16 11 11 17 15 18 9 16 16 11 9 8 8 16 15 2 10 9 7 9 15 10 13 15 12 3 15 8 16 14 16 9 11 17 10 9 7 11 6 17 16 18 18 5 13 13 16 3 10 15 7 14 9 9 10...

output:

3041882544 1
5048761354 1
4385580612 441
17673024334 245025
5504635410 1
3255826752 1
20198847172 1
7423222280 1
39762724864 1
8530498068 900
2248184180 1
2813342976 1
18619328640 1
102785239872 1
2304539176 1
32635610148 3844
51628460310 44521
108193525228 1
59121352736 1
6690516548 64
2901856578 8...

result:

ok 200 numbers

Test #25:

score: 0
Accepted
time: 425ms
memory: 40252kb

input:

1
500000 10000
9997 9984 9988 9993 9993 9995 10000 9995 9995 9994 9991 9995 9999 9984 9993 9988 9999 9986 9995 9986 10000 9988 9984 9994 9995 9996 9992 9989 9991 9986 9993 9998 9998 9994 9991 9994 9997 9992 9993 9991 9995 9999 9994 10000 9984 9998 10000 9999 9998 10000 10000 9996 9995 10000 10000 99...

output:

200 1

result:

ok 2 number(s): "200 1"

Test #26:

score: 0
Accepted
time: 400ms
memory: 40684kb

input:

1
500000 10000
9994 9998 9995 9999 9999 9995 9992 9997 10000 9985 9993 9987 9998 9993 9995 9998 9989 9987 9996 9999 9998 9992 9992 10000 9994 9998 9988 9999 9989 10000 9992 9996 10000 9997 9992 9987 9999 9998 9996 9998 9988 9998 9998 9994 9991 9992 9992 9999 9994 9984 9999 9998 9992 9996 9999 9996 9...

output:

1820 956592761

result:

ok 2 number(s): "1820 956592761"

Test #27:

score: 0
Accepted
time: 384ms
memory: 40096kb

input:

1
500000 10000
9979 9971 9964 9972 9961 9988 9976 9989 9980 9978 9999 9999 9962 9993 9995 9973 9991 9996 9982 9990 9965 9990 9985 9996 9992 9997 9998 9986 10000 9967 9969 10000 9999 9979 9956 9998 9992 9998 9991 9997 9977 9986 9994 9965 9984 9998 9969 9998 9986 9982 9990 9998 9967 9994 9980 9985 995...

output:

18400 1

result:

ok 2 number(s): "18400 1"

Test #28:

score: 0
Accepted
time: 383ms
memory: 40836kb

input:

1
500000 10000
9933 9993 9964 9980 9991 9977 9975 9985 9985 9978 9987 9931 9972 9978 9937 9935 9991 9943 9996 9990 9941 10000 10000 9984 9918 9945 9967 9995 9959 9913 9979 9974 9912 9999 9999 9999 9999 9984 9986 9997 9972 9917 9962 9998 9996 9981 9997 9965 9991 9980 9998 9963 9963 10000 9969 9934 99...

output:

40863300000 1

result:

ok 2 number(s): "40863300000 1"

Test #29:

score: 0
Accepted
time: 75ms
memory: 41232kb

input:

1
500000 10000
9998 9991 9999 9994 9968 9988 9960 9986 9995 9978 9999 9988 9981 9986 9964 10000 10000 9981 9989 9973 9997 9988 9985 9986 9981 9994 9972 9998 9981 9988 9991 10000 9968 9994 9970 9992 9996 9997 9996 9969 9997 9990 9992 9958 10000 9996 10000 9980 9991 9982 9983 9973 9981 9995 9985 9966 ...

output:

440000 1

result:

ok 2 number(s): "440000 1"

Test #30:

score: 0
Accepted
time: 79ms
memory: 40188kb

input:

1
500000 10000
10000 9978 9985 10000 9985 9999 9982 9976 9999 10000 9963 9957 9991 9974 9997 9988 9986 9996 9999 9998 9987 10000 9994 9962 9987 9996 9984 9978 9995 10000 9976 9976 9974 9987 9989 9997 9958 9988 9975 9996 9996 9983 9991 10000 9990 9994 9967 9976 9998 9996 9980 9992 9995 9990 9999 9995...

output:

180000 1

result:

ok 2 number(s): "180000 1"

Test #31:

score: 0
Accepted
time: 378ms
memory: 40892kb

input:

1
500000 10000
9998 9991 9994 10000 10000 9999 9996 9999 9995 9986 9990 9995 9987 9996 9994 9981 9991 9997 9998 9999 9990 9997 9993 9994 10000 9991 9999 10000 9991 9986 9993 10000 9994 9991 9994 9987 9999 9989 9990 9998 9991 9992 9994 10000 9997 9998 9995 10000 10000 9998 9987 9994 9991 9988 9998 99...

output:

147189753640 93179317

result:

ok 2 number(s): "147189753640 93179317"

Test #32:

score: 0
Accepted
time: 355ms
memory: 40728kb

input:

1
500000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 100...

output:

153932229444 282383571

result:

ok 2 number(s): "153932229444 282383571"

Test #33:

score: 0
Accepted
time: 374ms
memory: 40184kb

input:

1
500000 10000
10000 9996 9994 9996 9999 10000 9993 10000 9991 9998 10000 9996 10000 9993 9994 9995 9994 10000 10000 10000 9999 9999 9995 9997 9994 9994 10000 9997 10000 9998 10000 9995 10000 9997 9996 9999 9999 9999 9999 10000 9999 9996 9998 9993 9998 9991 9999 10000 9994 9997 10000 10000 9993 9999...

output:

164314480000 1

result:

ok 2 number(s): "164314480000 1"

Test #34:

score: 0
Accepted
time: 383ms
memory: 41548kb

input:

1
500000 10000
9974 9973 9917 9985 9999 10000 9965 9969 9934 10000 9996 9932 9949 9974 9995 9942 9956 9952 10000 9958 9952 9977 9959 9984 9927 9992 9962 9981 10000 9967 9998 9959 9945 9941 9967 9994 9951 9949 9984 9970 9970 9974 9996 9946 9953 9943 9998 9936 9986 9997 9994 9981 9998 10000 9973 9955 ...

output:

154734332 11115556

result:

ok 2 number(s): "154734332 11115556"

Test #35:

score: 0
Accepted
time: 100ms
memory: 40640kb

input:

1
500000 10000
9779 9600 9293 9840 9977 9933 9985 9609 9958 9270 9999 9985 9119 9731 9239 9780 9846 9543 9972 9471 9655 9622 9986 10000 9641 9973 9615 9579 9732 9407 9591 9626 9433 9810 9855 9795 9811 9992 9715 9843 9606 9569 9883 9566 9910 9751 9676 9693 9916 9921 9407 9700 9659 9654 9463 9964 9961...

output:

160006 11115556

result:

ok 2 number(s): "160006 11115556"

Test #36:

score: 0
Accepted
time: 391ms
memory: 40920kb

input:

1
500000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 100...

output:

120336800000 569934897

result:

ok 2 number(s): "120336800000 569934897"

Test #37:

score: 0
Accepted
time: 407ms
memory: 41352kb

input:

1
500000 10000
10000 9996 9994 9996 9999 10000 9993 10000 9991 9998 10000 9996 10000 9993 9994 9995 9994 10000 10000 10000 9999 9999 9995 9997 9994 9994 10000 9997 10000 9998 10000 9995 10000 9997 9996 9999 9999 9999 9999 10000 9999 9996 9998 9993 9998 9991 9999 10000 9994 9997 10000 10000 9993 9999...

output:

80803400000 569934897

result:

ok 2 number(s): "80803400000 569934897"

Test #38:

score: 0
Accepted
time: 407ms
memory: 40132kb

input:

1
500000 10000
9933 9993 9964 9980 9991 9977 9975 9985 9985 9978 9987 9931 9972 9978 9937 9935 9991 9943 9996 9990 9941 10000 10000 9984 9918 9945 9967 9995 9959 9913 9979 9974 9912 9999 9999 9999 9999 9984 9986 9997 9972 9917 9962 9998 9996 9981 9997 9965 9991 9980 9998 9963 9963 10000 9969 9934 99...

output:

13794600000 850089186

result:

ok 2 number(s): "13794600000 850089186"

Test #39:

score: 0
Accepted
time: 421ms
memory: 41236kb

input:

1
500000 10000
9930 9988 9887 9999 9996 9856 9987 9970 9982 9797 9961 9969 9998 9990 9837 9905 9808 9999 9998 9928 9963 9863 9938 9989 10000 9774 9989 9933 9770 9800 9872 9964 9940 9953 9902 9985 9944 9974 9976 9950 9882 9927 9996 9957 9995 9981 9994 9980 9995 9891 9995 9724 9970 9980 9852 10000 993...

output:

138446380000 569934897

result:

ok 2 number(s): "138446380000 569934897"

Test #40:

score: 0
Accepted
time: 411ms
memory: 40692kb

input:

1
500000 10000
9998 9968 9980 9948 9977 9952 9993 9971 9944 10000 9992 9964 10000 9976 9971 9926 9980 9976 9995 9996 9978 9966 9930 10000 9932 9943 9987 9958 9947 9985 9945 9985 9994 9945 9998 10000 9948 9981 9969 9990 9968 9963 9982 9998 9918 9960 9915 9978 9984 9964 9997 9961 9996 9982 9997 9956 9...

output:

111615500000 95270827

result:

ok 2 number(s): "111615500000 95270827"

Test #41:

score: 0
Accepted
time: 419ms
memory: 40488kb

input:

1
500000 10000
9772 9964 9779 9944 9946 9965 9980 9991 9805 9972 9912 9925 9986 9862 9988 9991 9883 9981 9978 9989 9994 9999 9982 9872 9977 9924 9844 9884 9813 9940 9969 9806 9868 9984 9869 9937 9781 9959 9914 9886 9875 9950 9786 9989 9930 9950 9808 9893 9999 9995 9758 9851 9999 9995 9961 9985 9844 ...

output:

96616680000 423966724

result:

ok 2 number(s): "96616680000 423966724"

Test #42:

score: 0
Accepted
time: 451ms
memory: 40608kb

input:

1
500000 10000
522 4575 6426 9445 8772 81 3447 629 3497 7202 7775 4325 3982 4784 8417 2156 1932 5902 5728 8537 3857 739 6918 9211 9679 8506 3340 6568 1868 16 7940 6263 4593 1449 6991 310 3355 7068 1431 8580 1757 9218 4934 4328 3676 9355 6221 9080 5922 1545 8511 4067 5467 8674 4691 6504 9835 2034 496...

output:

200000000000 10201

result:

ok 2 number(s): "200000000000 10201"

Test #43:

score: 0
Accepted
time: 428ms
memory: 40772kb

input:

1
500000 10000
9962 9613 9701 9779 9937 9993 9917 9754 9832 9850 9972 9879 9793 9633 9547 9936 9659 9897 9961 9985 9990 9989 9937 9569 9975 9993 9943 9832 9995 9956 9791 9842 9984 9972 9924 9997 9858 9982 9966 9838 9737 9666 9876 9998 9947 9761 9963 9545 9701 9833 9842 9756 9905 9865 9999 9991 9828 ...

output:

200000000000 1

result:

ok 2 number(s): "200000000000 1"

Test #44:

score: 0
Accepted
time: 166ms
memory: 6740kb

input:

200
475 21
19 20 15 18 21 20 14 21 16 21 18 19 21 13 21 21 17 21 18 15 20 21 13 15 13 14 20 17 18 19 17 20 19 20 21 17 21 16 20 17 18 17 19 17 20 19 16 12 21 19 20 20 20 20 19 19 19 19 17 20 21 18 19 18 21 16 20 20 15 20 17 20 21 18 16 19 13 18 16 21 18 17 16 12 17 16 21 20 21 21 20 19 17 21 21 17 2...

output:

36 1
48 1
40 4
44 1
76 9
88 4
48 1
180 1024
14 1
30 1
12 1
52 4
46 9
310 3600
8 1
52 4
196 1
60 1
194 49
48 1
14 1
34 4
162 3600
18 1
44 9
56 1
100 9
86 1
88 4
30 1
86 25
90 3249
18 1
30 1
34 1
88 36
36 1
40 1
106 9
96 225
132 1
32 1
18 1
192 16
44 9
58 1
30 1
70 1
56 1
136 9
58 4
122 16
44 1
38 1
5...

result:

ok 400 numbers

Test #45:

score: 0
Accepted
time: 361ms
memory: 14588kb

input:

20
25308 434
410 432 429 418 433 430 410 413 426 426 362 398 429 427 425 424 414 425 432 370 377 372 420 423 425 394 336 402 428 429 377 390 416 425 389 433 416 373 433 385 428 363 424 372 390 429 424 423 417 431 385 379 375 367 407 426 382 422 430 433 368 434 369 425 423 426 424 402 412 414 403 429...

output:

8120 225
444 1
1770 1
1494 196
2528 1
4532 36
22704 1
3784 1
8676 49
4274 144
5706 1225
11412 49
2728 36
9488 784
51272 1
13790 75076
1878 4
2904 1
9728 1
7440 1

result:

ok 40 numbers

Test #46:

score: 0
Accepted
time: 382ms
memory: 40296kb

input:

1
500000 10000
9981 9961 9956 9925 9998 9958 9949 9995 9916 9990 9981 9938 9988 9990 9995 9993 9950 9986 9935 9975 9981 9995 9951 10000 9922 9997 9996 9972 9944 9991 9999 9992 9998 9956 9967 9955 9987 9954 9994 9997 9984 9986 10000 9903 9945 9972 9994 9942 9987 9997 9999 9934 9988 9989 9995 9961 992...

output:

175170396642 10404

result:

ok 2 number(s): "175170396642 10404"

Extra Test:

score: 0
Extra Test Passed