QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#417524#8723. 乘二skip2004WA 22ms972kbPascal1021b2024-05-22 19:32:082024-05-22 19:32:08

Judging History

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

  • [2024-05-22 19:32:08]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:972kb
  • [2024-05-22 19:32:08]
  • 提交

answer

const P = 1000000007;
var n, k, i, rem, tmp : longint;
a : array [1..200000] of longint;
ans, pw : int64;
procedure qsort(l,r:longint);
var i,j,x,y:longint;
begin
	i:=l; j:=r; x:=a[(l+r) div 2];
	repeat
		while (a[i]<x) do inc(i);
		while (a[j]>x) do dec(j);
		if (i<=j) then
		begin
			y:=a[i];
			a[i]:=a[j];
			a[j]:=y;
			inc(i);
			dec(j);
		end;
	until i>j;
	if (i<r) then qsort(i,r);
	if (j>l) then qsort(j,l);
end;
begin
	read(n, k);
	for i := 1 to n do
		read(a[i]);
	qsort(1, n);
	while (a[1] < P) and (k > 0) do
	begin
		tmp := a[1] * 2;
		for i := 1 to n do
		begin
			if (k = 0) or (a[i] > tmp) then
				break;
			a[i] := a[i] * 2;
			dec(k);
		end;
		qsort(1, n);
	end;
	pw := 1;
	rem := k mod n;
	k := k div n;
	while k > 30 do
		pw := (pw << 30) mod P;
	k := k - 30;
	for i := 1 to k do
		pw := pw * 2 mod P;

	for i := 1 to rem do
		ans := (ans + a[i] * pw * 2) mod P;
	for i := rem + 1 to n do
		ans := (ans + a[i] * pw) mod P;
	writeln(ans);
end.

详细

Test #1:

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

input:

3 3
7 2 1

output:

15

result:

ok 1 number(s): "15"

Test #2:

score: -100
Wrong Answer
time: 22ms
memory: 972kb

input:

200000 1605067
366760624 67854 93901 693975 27016 1046 10808 6533158 54778 500941023 77236442 32173 10431454 2 9726 1553148 89282 411182309 494073 131299543 249904771 7906930 353 9909 3632698 29156 1917186 303 737 1189004 22 1983 263 711 4106258 2070 36704 12524642 5192 123 2061 22887 66 380 1 10153...

output:

832337344

result:

wrong answer 1st numbers differ - expected: '707034173', found: '832337344'