QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#378084#5058. Prof. Pang Earning AusInfinityNSWA 129ms3948kbC++171.2kb2024-04-06 00:32:322024-04-06 00:32:32

Judging History

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

  • [2024-04-06 00:32:32]
  • 评测
  • 测评结果:WA
  • 用时:129ms
  • 内存:3948kb
  • [2024-04-06 00:32:32]
  • 提交

answer

#include<bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()

using namespace std;

vector<ll> x(6);
vector<int> n(2),k(6);
ll ans;
void pok(){
    x[0]=(n[0]-x[5]*k[5])/k[0];
    if(x[0]<0)return;
    x[1]=x[0]*k[0]+x[5]*k[5]-x[4];
    if(x[1]<0)return;
    x[2]=(n[1]-x[4]*k[4])/k[2];
    if(x[2]<0)return;
    x[3]=x[2]*k[2]+x[4]*k[4]-x[5];
    if(x[3]<0)return;
    if(x[0]==0&&x[2]==0)return;
    if(x[1]+x[4]>n[0])return;
    if(x[3]+x[5]>n[1])return;
    ans=max(ans,x[1]*k[1]+x[3]*k[3]-x[0]-x[2]);
}
void test(){
    for(int i=0;i<2;i++){
        scanf("%i",&n[i]);
    }
    for(int i=0;i<6;i++){
        scanf("%i",&k[i]);
    }
    ans=0;
    for(x[4]=0;x[4]<=100;x[4]++){
        for(x[5]=0;x[5]<=100;x[5]++){
            pok();
        }
    }
    int mx4=min(n[1]/k[4],n[0]),mx5=min(n[0]/k[5],n[1]);
    for(x[4]=mx4;x[4]>=0&&mx4-x[4]<=100;x[4]--){
        for(x[5]=mx5;x[5]>=0&&mx5-x[5]<=100;x[5]--){
            pok();
        }
    }
    printf("%lld\n",ans+1);
}

int main(){
    int t;
    scanf("%i",&t);
    while(t--){
        test();
    }
}

详细

Test #1:

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

input:

6
2 2 2 2 2 2 2 2
78 74 5 3 10 2 4 7
31 75 3 6 6 1 8 4
91 86 4 2 9 5 8 5
48 89 3 9 2 3 5 7
13 25 5 7 6 1 2 4

output:

7
355
239
571
637
109

result:

ok 6 numbers

Test #2:

score: 0
Accepted
time: 31ms
memory: 3748kb

input:

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

output:

111
46
64
90
66
37
1
1
63
101
30
17
50
22
54
40
1
29
1
21
38
50
1
9
55
21
11
1
104
61
4
81
1
119
74
6
17
16
13
20
56
46
33
20
42
1
96
21
40
46
39
47
4
61
5
81
111
27
18
1
1
32
4
1
30
133
1
89
51
34
29
1
53
15
34
45
1
32
1
25
55
120
23
22
20
57
19
108
24
1
20
1
52
40
41
15
9
1
1
15
35
104
1
43
84
15
...

result:

ok 1000 numbers

Test #3:

score: 0
Accepted
time: 31ms
memory: 3780kb

input:

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

output:

87
20
79
1
31
78
41
40
36
18
61
68
16
83
56
41
63
48
26
57
1
1
16
105
99
70
40
55
53
22
1
30
71
50
49
1
1
1
45
59
55
123
22
1
58
16
1
37
23
54
50
41
68
61
47
108
24
54
40
70
24
42
6
64
13
17
21
1
91
28
59
61
1
52
103
66
54
1
114
58
1
49
10
61
1
66
1
1
29
60
1
32
21
5
55
121
87
99
1
128
1
5
1
1
5
81
...

result:

ok 1000 numbers

Test #4:

score: 0
Accepted
time: 32ms
memory: 3940kb

input:

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

output:

18
17
1
48
87
32
1
47
15
36
1
52
61
40
16
60
1
1
1
50
1
58
1
35
35
25
130
17
44
96
1
41
1
14
12
24
8
23
1
40
1
70
16
37
43
35
37
28
71
67
25
1
22
76
32
106
41
90
1
30
1
1
16
74
60
1
30
45
14
19
63
12
50
16
29
75
84
15
40
54
13
25
10
1
59
63
16
51
87
1
40
58
26
14
7
16
70
13
1
109
1
32
1
84
58
80
45
...

result:

ok 1000 numbers

Test #5:

score: 0
Accepted
time: 31ms
memory: 3948kb

input:

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

output:

31
6
3
41
60
12
1
55
80
69
11
81
96
48
18
49
13
48
39
62
53
24
1
40
3
21
74
52
8
104
1
1
29
13
99
1
92
1
31
1
1
74
5
85
49
74
1
16
16
20
32
63
50
1
44
56
86
1
1
60
14
96
32
25
16
74
1
44
13
24
1
12
47
55
5
3
45
111
89
8
41
16
18
81
77
35
5
98
1
10
5
1
90
1
56
5
1
1
78
110
23
1
19
69
1
1
44
51
15
23
...

result:

ok 1000 numbers

Test #6:

score: 0
Accepted
time: 128ms
memory: 3804kb

input:

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

output:

1
32
52
91
41
96
25
1
75
45
40
1
16
5
32
47
8
55
90
45
62
16
58
1
94
33
16
49
52
12
75
16
45
48
76
19
1
57
15
11
1
56
1
36
15
26
1
73
1
1
1
32
28
40
21
24
51
28
56
56
30
46
24
1
27
42
1
77
3
5
1
91
1
21
105
1
1
72
35
1
26
55
24
80
15
53
85
11
82
42
1
30
1
76
34
13
11
64
72
25
1
1
50
84
1
81
1
63
80
...

result:

ok 1000 numbers

Test #7:

score: 0
Accepted
time: 33ms
memory: 3940kb

input:

1000
69 13 3 9 1 9 9 9
68 27 3 8 9 3 10 9
9 6 2 7 2 2 9 3
99 70 3 9 8 5 6 4
50 49 1 2 4 1 2 9
4 7 8 5 9 1 9 9
72 78 7 2 5 8 7 5
13 3 5 9 1 9 4 4
19 62 10 6 2 1 6 7
56 17 9 2 5 10 10 1
52 5 3 7 9 5 4 5
16 26 9 6 2 10 8 10
65 58 2 9 9 7 4 5
68 86 8 4 1 3 8 2
67 94 10 10 2 3 9 8
42 92 7 3 9 10 5 1
63 8...

output:

703
585
68
1192
127
1
737
123
132
250
354
301
940
471
885
1021
630
706
435
288
144
169
179
340
433
1122
810
533
1001
294
29
334
149
457
433
205
846
469
372
356
730
121
177
469
879
38
866
800
823
910
1225
1050
172
411
123
989
452
104
892
49
502
186
662
427
392
403
963
751
1201
822
553
286
120
40
686
...

result:

ok 1000 numbers

Test #8:

score: 0
Accepted
time: 29ms
memory: 3800kb

input:

1000
14 41 7 9 5 7 4 3
50 83 5 2 7 1 3 6
63 32 4 6 1 4 6 2
7 27 4 10 4 6 4 4
83 52 9 4 8 6 4 7
18 12 3 3 6 8 10 9
39 92 10 4 8 9 9 9
26 90 10 7 2 6 9 6
77 93 9 6 3 7 5 7
60 36 6 2 1 7 7 5
8 51 1 6 2 3 6 6
30 76 9 5 3 5 7 4
12 74 6 7 4 1 5 8
34 100 1 10 8 5 3 6
18 62 8 4 4 6 10 7
20 97 1 7 5 10 3 6
7...

output:

397
160
450
178
618
143
950
670
1062
352
169
486
137
785
418
1052
600
588
693
47
689
1196
988
246
769
487
569
725
192
67
183
587
859
296
1413
137
420
835
997
185
779
547
479
357
601
819
649
279
1231
581
435
282
1095
600
441
250
95
580
163
280
653
350
556
391
550
493
177
743
1408
246
1001
223
308
443...

result:

ok 1000 numbers

Test #9:

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

input:

1000
62 61 5 10 6 4 7 5
28 38 5 6 8 4 8 9
26 50 2 1 1 2 5 5
24 84 5 7 10 6 6 9
27 39 2 10 4 10 7 4
37 1 8 8 4 2 8 3
98 10 4 7 3 7 5 8
47 80 3 6 5 9 8 8
42 29 6 10 6 5 3 10
75 59 6 2 1 10 10 1
60 2 8 10 7 10 10 8
53 25 7 1 4 10 6 9
64 83 2 1 8 6 6 3
4 22 10 3 2 6 7 5
81 34 2 5 3 4 4 1
5 3 5 7 1 1 9 6...

output:

819
283
106
632
620
253
709
965
535
704
554
279
514
122
483
35
1526
403
515
213
784
174
388
482
453
134
180
400
243
354
667
641
433
1008
395
456
637
181
743
597
447
62
306
594
760
52
1126
676
848
584
866
168
233
413
306
345
566
135
978
1018
807
27
539
529
191
825
121
427
463
38
726
100
103
61
310
22...

result:

ok 1000 numbers

Test #10:

score: 0
Accepted
time: 33ms
memory: 3856kb

input:

1000
2 89 10 8 6 7 7 3
10 93 4 5 2 5 1 6
72 73 5 10 10 9 1 4
32 45 2 3 1 2 2 9
59 26 7 8 8 1 5 5
51 93 5 6 1 9 2 3
60 28 8 3 2 7 1 2
72 71 8 10 5 2 3 1
7 60 1 7 4 9 6 6
87 74 1 2 7 7 9 9
20 57 4 10 8 2 1 5
80 75 5 8 1 5 6 5
15 91 6 8 1 4 1 10
66 37 1 2 9 1 6 10
43 6 10 6 5 1 3 7
91 8 3 10 8 5 3 4
21...

output:

575
459
1310
131
485
1035
344
838
568
612
301
925
368
153
246
916
684
466
848
937
1217
739
822
648
299
120
386
427
155
778
276
337
469
547
581
842
484
407
784
769
776
1257
434
733
326
545
51
80
891
821
337
665
386
610
96
941
276
470
381
682
526
403
212
556
229
181
760
323
1234
504
604
856
406
405
33...

result:

ok 1000 numbers

Test #11:

score: 0
Accepted
time: 36ms
memory: 3876kb

input:

1000
55 13 4 10 7 6 6 1
97 53 8 7 2 8 6 3
34 87 3 4 9 1 10 10
48 2 4 4 9 1 10 1
96 17 6 8 7 8 6 3
62 98 8 1 4 9 9 7
23 42 5 1 2 6 7 6
93 58 5 6 8 5 8 3
61 83 6 7 5 3 5 2
95 90 7 6 9 4 2 5
68 99 4 4 1 6 3 5
98 33 5 10 5 8 3 7
66 7 8 2 2 4 2 1
36 51 9 9 3 3 10 1
94 70 6 1 8 1 9 2
84 1 6 10 8 9 3 9
44 ...

output:

587
1051
201
181
863
920
263
809
635
895
751
1193
142
457
140
827
1063
407
518
1272
519
357
147
187
372
441
246
578
45
244
805
619
408
277
922
607
306
382
867
822
1113
313
729
368
575
239
90
397
339
1142
142
346
856
443
153
756
106
276
1444
680
417
330
636
655
251
210
68
1012
747
639
197
465
566
460...

result:

ok 1000 numbers

Test #12:

score: 0
Accepted
time: 33ms
memory: 3888kb

input:

1000
39 23 85 46 97 72 41 70
18 37 8 40 33 61 12 79
78 51 61 66 85 97 78 14
47 70 100 40 15 40 61 52
30 19 14 91 82 56 10 6
24 68 97 61 31 78 18 45
6 88 37 38 51 86 37 42
30 58 79 56 50 14 61 18
20 13 57 3 93 15 24 74
21 32 71 93 2 66 25 75
10 75 86 82 30 31 6 49
33 15 100 35 1 96 87 83
21 29 41 22 ...

output:

1
2715
4026
2397
3016
4835
4386
1694
1
2097
1859
1426
1
7041
1505
1
4590
1546
1401
820
5550
5859
4620
3697
6800
3630
1847
6268
1509
2824
6437
475
5579
1990
5975
1
4231
3261
5602
945
6738
4917
1664
4797
8042
8001
2935
4344
6903
2413
11118
5980
2400
5695
12269
4401
5551
2515
3795
1110
2077
1
9290
704
...

result:

ok 1000 numbers

Test #13:

score: 0
Accepted
time: 29ms
memory: 3864kb

input:

1000
79 47 39 24 51 37 29 54
100 96 48 80 32 98 27 88
36 73 79 11 33 78 87 94
55 27 21 1 24 6 83 27
66 7 27 91 12 35 43 17
46 57 78 19 20 61 29 89
73 6 51 82 48 14 33 81
51 37 34 64 57 19 1 96
81 49 34 27 84 49 72 56
37 47 50 23 58 53 78 82
66 25 13 10 61 3 73 96
59 64 38 48 12 61 96 81
80 37 83 39 ...

output:

2920
17084
5147
186
4913
2439
4182
2176
1835
1
646
5479
2209
1
7830
4800
1262
918
5449
3438
5406
1
5049
5161
1
1
1
2109
2807
594
1
1
1
1
1
910
8737
4127
4008
1870
2944
1
2631
1980
1
1
1922
6072
5624
2806
1
1
1062
6557
1285
2296
5640
944
996
5572
3076
1
1
5289
1291
3451
1
4487
9088
1562
3680
1
10031
...

result:

ok 1000 numbers

Test #14:

score: 0
Accepted
time: 36ms
memory: 3856kb

input:

1000
23 71 84 98 8 14 4 42
83 56 87 28 22 32 50 5
90 96 1 59 74 56 96 77
71 88 38 62 36 85 1 97
98 98 32 99 42 6 81 20
57 49 71 66 9 45 41 29
32 28 68 38 29 35 29 19
76 27 85 68 68 41 32 78
38 72 19 55 83 83 25 46
48 62 26 53 14 39 31 94
22 84 39 34 96 63 37 42
78 6 76 64 16 26 6 79
24 53 29 63 87 8...

output:

889
3135
10559
8842
10004
3890
1
1
6129
3690
1
4956
1
6654
3050
2888
949
1
1
1
1
5541
6972
1
1
2523
4179
8533
2204
1
1
1
1
4783
955
1
5925
1
6731
4800
2431
8418
266
716
7354
4343
2867
296
11799
767
4890
1
6541
1
10699
3129
1
4866
1293
1972
180
5581
1
5549
5346
1
12387
2254
269
2112
7567
3239
7896
62...

result:

ok 1000 numbers

Test #15:

score: 0
Accepted
time: 29ms
memory: 3876kb

input:

1000
72 95 38 75 62 87 87 30
65 11 35 75 16 73 65 23
48 18 19 4 22 42 14 60
83 49 59 15 60 51 27 80
35 97 37 100 64 81 22 38
71 54 52 20 5 20 52 73
98 42 78 86 26 55 25 57
97 14 36 81 71 54 71 51
4 3 8 74 82 21 74 29
52 81 1 87 75 22 76 2
79 27 73 61 39 39 9 89
1 60 14 77 27 87 11 70
75 61 63 75 64 ...

output:

12507
2625
735
2247
5184
2060
8137
5831
1
6122
5323
4697
8143
4094
1
2457
81
2508
1
1
893
1
478
3873
4921
2373
8787
4782
4439
2843
4444
2120
2775
3255
9463
1
1
1
940
1
1961
4836
1
912
1
5607
1240
1
3118
2960
1
1474
4951
1
2306
4066
1175
1
1
1
5536
5951
6389
1618
1
3588
3590
394
8463
6623
2677
400
13...

result:

ok 1000 numbers

Test #16:

score: 0
Accepted
time: 29ms
memory: 3856kb

input:

1000
20 23 87 49 15 59 70 18
47 67 79 19 7 6 88 40
7 33 37 45 75 16 19 43
96 6 77 79 69 21 54 46
67 84 49 4 97 52 60 45
90 47 33 79 94 4 64 13
57 56 96 33 7 83 17 92
18 5 83 93 87 63 10 33
65 38 85 98 73 47 19 15
64 92 72 18 23 9 33 18
35 81 100 85 70 7 85 35
19 9 44 89 34 48 20 64
26 70 5 95 33 30 ...

output:

1708
1124
1
6083
3312
5213
4641
1
1
1770
3458
1
4349
2650
2937
4368
5500
2280
1709
1
1
11976
1
4782
1
6802
5569
8975
1749
5685
2069
8048
1
6257
4174
5641
660
575
3188
2269
1
3331
1
2517
7998
560
419
6958
2007
480
4140
7487
6064
1
5836
1
1
2069
4879
768
1
1
6881
2272
4759
3837
4176
1
4494
946
11293
8...

result:

ok 1000 numbers

Test #17:

score: -100
Wrong Answer
time: 129ms
memory: 3872kb

input:

1000
861134582 257942979 13 18 40 71 22 17
66130593 958022679 33 31 85 57 22 20
39736426 996932957 81 50 77 49 43 66
148797691 302372310 47 77 20 69 93 12
483105085 237881347 90 24 67 18 34 15
107634264 767520421 53 58 4 46 11 17
616215478 270289085 16 26 23 4 16 38
62831871 515949964 60 22 33 62 99...

output:

33741683780
56644065827
50823097612
32302826354
15867467272
41354815171
17052493569
33354515580
71094661108
53806190395
73940098129
65821806959
8017507053
58258390288
34534952947
6844918148
82877650835
23827149676
6619300902
46008267727
42736835603
70648509216
43827260800
81512172522
22365137194
436...

result:

wrong answer 12th numbers differ - expected: '65883252209', found: '65821806959'