QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#417556#8723. 乘二skip2004Compile Error//C++201.0kb2024-05-22 19:42:372024-05-22 19:42:38

Judging History

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

  • [2024-05-22 19:42:38]
  • 评测
  • [2024-05-22 19:42:37]
  • 提交

answer

const P = 1000000007;
var n, k, i, rem, tmp : int64;
a : array [1..200000] of int64;
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
	begin
		pw := (pw << 30) mod P;
		k := k - 30;
	end;
	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.

Details

answer.code:3:12: error: too many decimal points in number
    3 | a : array [1..200000] of int64;
      |            ^~~~~~~~~
answer.code:1:7: error: ‘P’ does not name a type
    1 | const P = 1000000007;
      |       ^
answer.code:2:1: error: ‘var’ does not name a type
    2 | var n, k, i, rem, tmp : int64;
      | ^~~
answer.code:3:3: error: found ‘:’ in nested-name-specifier, expected ‘::’
    3 | a : array [1..200000] of int64;
      |   ^
      |   ::
answer.code:3:1: error: ‘a’ does not name a type
    3 | a : array [1..200000] of int64;
      | ^
answer.code:4:1: error: ‘ans’ does not name a type
    4 | ans, pw : int64;
      | ^~~
answer.code:5:1: error: ‘procedure’ does not name a type
    5 | procedure qsort(l,r:longint);
      | ^~~~~~~~~
answer.code:6:1: error: ‘var’ does not name a type
    6 | var i,j,x,y:longint;
      | ^~~
answer.code:7:1: error: ‘begin’ does not name a type
    7 | begin
      | ^~~~~
answer.code:8:15: error: ‘j’ does not name a type
    8 |         i:=l; j:=r; x:=a[(l+r) div 2];
      |               ^
answer.code:8:21: error: ‘x’ does not name a type
    8 |         i:=l; j:=r; x:=a[(l+r) div 2];
      |                     ^
answer.code:9:9: error: ‘repeat’ does not name a type
    9 |         repeat
      |         ^~~~~~
answer.code:11:17: error: expected unqualified-id before ‘while’
   11 |                 while (a[j]>x) do dec(j);
      |                 ^~~~~
answer.code:12:17: error: expected unqualified-id before ‘if’
   12 |                 if (i<=j) then
      |                 ^~
answer.code:15:25: error: ‘a’ does not name a type
   15 |                         a[i]:=a[j];
      |                         ^
answer.code:16:25: error: ‘a’ does not name a type
   16 |                         a[j]:=y;
      |                         ^
answer.code:17:28: error: expected constructor, destructor, or type conversion before ‘(’ token
   17 |                         inc(i);
      |                            ^
answer.code:18:28: error: expected constructor, destructor, or type conversion before ‘(’ token
   18 |                         dec(j);
      |                            ^
answer.code:19:17: error: ‘end’ does not name a type
   19 |                 end;
      |                 ^~~
answer.code:20:9: error: ‘until’ does not name a type
   20 |         until i>j;
      |         ^~~~~
answer.code:21:9: error: expected unqualified-id before ‘if’
   21 |         if (i<r) then qsort(i,r);
      |         ^~
answer.code:22:9: error: expected unqualified-id before ‘if’
   22 |         if (j>l) then qsort(j,l);
      |         ^~
answer.code:23:1: error: ‘end’ does not name a type
   23 | end;
      | ^~~
answer.code:24:1: error: ‘begin’ does not name a type
   24 | begin
      | ^~~~~
answer.code:26:9: error: expected unqualified-id before ‘for’
   26 |         for i := 1 to n do
      |         ^~~
answer.code:28:14: error: expected constructor, destructor, or type conversion before ‘(’ token
   28 |         qsort(1, n);
      |              ^
answer.code:29:9: error: expected unqualified-id before ‘while’
   29 |         while (a[1] < P) and (k > 0) do
      |         ^~~~~
answer.code:32:17: error: expected unqualified-id before ‘for’
   32 |                 for i := 1 to n do
      |                 ^~~
answer.code:36:25: error: ‘a’ does not name a type
   36 |                         a[i] := a[i] * 2;
      |                         ^
answer.code:37:28: error: expected constructor, destructor, or type conversion before ‘(’ token
   37 |                         dec(k);
      |                            ^
answer.code:38:17: error: ‘end’ does not name a type
   38 |                 end;
      |                 ^~~
answer.code:39:22: error: expected constructor, destructor, or type conversion before ‘(’ token
   39 |                 qsort(1, n);
      |                      ^
answer.code:40:9: error: ‘end’ does not name a type
   40 |         end;
      |         ^~~
answer.code:41:9: error: ‘pw’ does not name a type
   41 |         pw := 1;
      |         ^~
answer.code:42:9: error: ‘rem’ does not name a type
   42 |         rem := k mod n;
      |         ^~~
answer.code:43:9: error: ‘k’ does not name a type
   43 |         k := k div n;
      |         ^
answer.code:44:9: error: expected unqualified-id before ‘while’
   44 |         while k > 30 do
      |         ^~~~~
answer.code:47:17: error: ‘k’ does not name a type
   47 |                 k := k - 30;
      |                 ^
answer.code:48:9: error: ‘end’ does not name a type
   48 |         end;
      |         ^~~
answer.code:49:9: error: expected unqualified-id before ‘for’
   49 |         for i := 1 to k do
      |         ^~~
answer.code:51:9: error: expected unqualified-id before ‘for’
   51 |         for i := 1 to rem do
      |         ^~~
answer.code:53:9: error: expected unqualified-id before ‘for’
   53 |         for i := rem + 1 to n do
      |         ^~~
answer.code:55:16: error: expected c...