UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#201331#3000. 分组snow_trace1001252ms10148kbC++638b2024-01-23 09:30:422024-01-23 12:22:51

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
int a[500005];
bool ok[2000005];
int mn[500005];
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n >>m;
	for(int i = 1;i<=n;i++)cin>>a[i];
	for(int i = 1;i<=n;i++)mn[i] = -10000000000000005;
	for(int i = 1;i<=n;i++)ok[a[i]] = 1;
	for(int i = 1;i<=2000000;i++){
		int tot = 0,sum = 0;
		for(int j = i;j<=2000000;j+=i){
			if(ok[j]){
				sum+=j;tot++;mn[tot] = max(mn[tot],i-sum);
			}
		}
	}int sum =0;for(int i = 1;i<=n;i++)sum+=a[i];
	for(int i = 1;i<=m;i++){
		cout<<sum+mn[n-i+1]<<' ';
	}cout<<endl;
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 5
Accepted
time: 20ms
memory: 1260kb

input:

10 10
900 240 940 360 120 720 960 480 600 840

output:

20 1000 1960 2920 3760 4480 5080 5560 5920 6160 

result:

ok single line: '20 1000 1960 2920 3760 4480 5080 5560 5920 6160 '

Test #2:

score: 5
Accepted
time: 24ms
memory: 1256kb

input:

10 10
920 240 952 360 120 720 960 480 600 840

output:

8 992 1992 2952 3792 4512 5112 5592 5952 6192 

result:

ok single line: '8 992 1992 2952 3792 4512 5112 5592 5952 6192 '

Test #3:

score: 5
Accepted
time: 24ms
memory: 1260kb

input:

10 10
900 240 950 360 120 720 960 480 600 840

output:

10 1010 1970 2930 3770 4490 5090 5570 5930 6170 

result:

ok single line: '10 1010 1970 2930 3770 4490 5090 5570 5930 6170 '

Test #4:

score: 5
Accepted
time: 24ms
memory: 1256kb

input:

10 10
930 240 955 360 120 720 960 480 600 840

output:

5 985 2005 2965 3805 4525 5125 5605 5965 6205 

result:

ok single line: '5 985 2005 2965 3805 4525 5125 5605 5965 6205 '

Test #5:

score: 5
Accepted
time: 24ms
memory: 1316kb

input:

100 2
18600 19200 28800 44400 31800 21600 18000 13800 23400 9000 36000 54600 10800 46200 40800 1200 ...

output:

8 58232 

result:

ok single line: '8 58232 '

Test #6:

score: 5
Accepted
time: 21ms
memory: 1316kb

input:

100 2
41400 17400 57600 9600 42600 48600 18600 53400 36600 14400 40800 7200 32400 58200 18000 25200 ...

output:

10 58240 

result:

ok single line: '10 58240 '

Test #7:

score: 5
Accepted
time: 24ms
memory: 1312kb

input:

100 3
48000 8400 4800 7200 37200 18000 44400 39600 45600 43800 42600 27600 12000 26400 9000 5400 102...

output:

10 58220 116420 

result:

ok single line: '10 58220 116420 '

Test #8:

score: 5
Accepted
time: 25ms
memory: 1316kb

input:

100 3
54000 56400 49800 6000 7200 35400 5400 58080 16800 47400 1800 37200 42000 58200 37800 28200 36...

output:

10 58230 116470 

result:

ok single line: '10 58230 116470 '

Test #9:

score: 5
Accepted
time: 24ms
memory: 1344kb

input:

100 100
50189 25324 18727 45900 63368 14626 77505 76238 92424 37191 69974 51825 54635 57560 96749 49...

output:

1 98634 195383 290532 385282 479877 574367 668791 761215 853610 945212 1036383 1127353 1216607 13055...

result:

ok single line: '1 98634 195383 290532 385282 4...313038 5321384 5326165 5333446 '

Test #10:

score: 5
Accepted
time: 20ms
memory: 1352kb

input:

100 100
27371 97177 14983 72357 83123 51052 12400 12187 94578 54750 74097 6391 24675 73603 22364 381...

output:

1 98996 197807 296440 394150 491327 588368 682946 776599 870130 961276 1051885 1142333 1231888 13210...

result:

ok single line: '1 98996 197807 296440 394150 4...136446 5141093 5144665 5149845 '

Test #11:

score: 5
Accepted
time: 24ms
memory: 1328kb

input:

100 100
36000 1200 31200 4200 25800 27600 51600 52200 21000 42000 12600 13800 12000 44400 22200 1800...

output:

1 90333 179037 251257 322552 390679 457869 524114 578144 632194 686494 740494 793894 846694 898894 9...

result:

ok single line: '1 90333 179037 251257 322552 3...137494 3139894 3141694 3142894 '

Test #12:

score: 5
Accepted
time: 24ms
memory: 1332kb

input:

100 100
49800 600 28200 25800 9600 42000 10800 18600 14400 15600 30000 52800 53960 1800 60434 16200 ...

output:

1 90357 177434 263120 335173 406425 470753 531195 585215 639255 693615 747615 801015 853815 906015 9...

result:

ok single line: '1 90357 177434 263120 335173 4...144615 3147015 3148815 3150015 '

Test #13:

score: 5
Accepted
time: 57ms
memory: 4384kb

input:

80000 2
1760616 1339224 1661280 1035264 1380792 1882776 1112568 1302816 672240 452760 1070712 893544...

output:

2 1919930 

result:

ok single line: '2 1919930 '

Test #14:

score: 5
Accepted
time: 51ms
memory: 3548kb

input:

45000 2
1410768 982692 989640 1009584 160524 1256652 1064088 432396 908388 558144 1416816 770256 101...

output:

2 1619896 

result:

ok single line: '2 1619896 '

Test #15:

score: 5
Accepted
time: 55ms
memory: 4384kb

input:

80000 3
1561920 760248 1558704 782832 699024 1175928 1830888 969288 701760 920496 1487928 1709976 17...

output:

2 1919930 3839858 

result:

ok single line: '2 1919930 3839858 '

Test #16:

score: 5
Accepted
time: 51ms
memory: 3544kb

input:

45000 3
7236 1083384 1321416 137124 778140 432 1535256 1074888 1221120 1116684 313128 636336 962172 ...

output:

2 1619896 3239794 

result:

ok single line: '2 1619896 3239794 '

Test #17:

score: 5
Accepted
time: 194ms
memory: 10048kb

input:

500000 500000
1343362 1053816 1676183 1426278 1779347 1099882 1235596 1224730 1310237 1111406 179780...

output:

1 2000001 4000000 5999998 7999995 9999987 11999977 13999966 15999954 17999939 19999923 21999903 2399...

result:

ok single line: '1 2000001 4000000 5999998 7999...6139 749994356145 749996356153 '

Test #18:

score: 5
Accepted
time: 168ms
memory: 10044kb

input:

500000 500000
1924070 1901421 1936257 1077615 1157352 1299607 1747128 1581409 1799184 1975045 156367...

output:

1 1999998 3999991 5999982 7999968 9999950 11999931 13999910 15999882 17999853 19999823 21999791 2399...

result:

ok single line: '1 1999998 3999991 5999982 7999...7302 749744417306 749746417310 '

Test #19:

score: 5
Accepted
time: 213ms
memory: 10148kb

input:

500000 500000
1821470 1051716 1924187 1105953 1007562 1901880 1231874 1010609 1044565 1396024 151653...

output:

1 2000001 3999998 5999991 7999983 9999974 11999960 13999943 15999924 17999904 19999883 21999861 2399...

result:

ok single line: '1 2000001 3999998 5999991 7999...6874 748484167174 748484167374 '

Test #20:

score: 5
Accepted
time: 185ms
memory: 10144kb

input:

500000 500000
1448814 1996266 1629828 1147578 1060061 1247419 1213268 1789844 1378521 1044541 158485...

output:

1 2000001 4000000 5999997 7999993 9999987 11999980 13999972 15999963 17999952 19999937 21999921 2399...

result:

ok single line: '1 2000001 4000000 5999997 7999...9589 748202089889 748202090089 '