Submission #19968


Source Code Expand

Copy
{$R-,S-,Q-,I-,O+}
const MAX=5000000;
var n,m,k,i,j,a,b,count:longint;
	ng:array[0..11,0..11] of boolean;
	x,y:array[0..11] of longint;
procedure shuffle;
var s,t,u:longint;
begin
	s:=random(n);
	u:=random(n);
	if s=u then shuffle else begin
		t:=y[s];
		y[s]:=y[u];
		y[u]:=t;
	end;
end;

function adj_check:boolean;
var idx:longint;
begin
	adj_check:=false;
	if ng[y[n-1],y[0]] then adj_check:=true else begin
		for idx:=0 to n-2 do if ng[y[idx],y[idx+1]] then begin
			adj_check:=true;
			break;
		end;
	end;
end;

begin
	randomize;
	readln(n,m,k);
	for i:=0 to n-1 do x[i]:=i;
	for i:=1 to m do begin
		readln(a,b);
		ng[a,b]:=true;
		ng[b,a]:=true;
	end;
	for i:=1 to MAX do begin
		y:=x;
		for j:=1 to k do shuffle;
		if adj_check then inc(count);
	end;
	writeln(1-(count/MAX):0:7);
end.

Submission Info

Submission Time
Task D - シャッフル席替え
User urutom
Language Pascal (fpc 2.4.4)
Score 100
Code Size 836 Byte
Status AC
Exec Time 9183 ms
Memory 756 KB

Compile Error

/usr/bin/ld: warning: ./link.res contains output sections; did you forget -T?

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 71
Set Name Test Cases
all 00_mini_01.txt, 00_mini_02.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_rnd_11_01.txt, 01_rnd_11_02.txt, 01_rnd_11_03.txt, 01_rnd_11_04.txt, 01_rnd_11_05.txt, 01_rnd_11_06.txt, 01_rnd_11_07.txt, 01_rnd_11_08.txt, 01_rnd_11_09.txt, 01_rnd_11_10.txt, 01_rnd_11_11.txt, 01_rnd_11_12.txt, 01_rnd_11_13.txt, 01_rnd_11_14.txt, 01_rnd_11_15.txt, 01_rnd_11_16.txt, 01_rnd_11_17.txt, 01_rnd_11_18.txt, 01_rnd_11_19.txt, 01_rnd_11_20.txt, 01_rnd_11_21.txt, 01_rnd_11_22.txt, 01_rnd_7_01.txt, 01_rnd_7_02.txt, 01_rnd_7_03.txt, 01_rnd_7_04.txt, 01_rnd_7_05.txt, 01_rnd_7_06.txt, 01_rnd_7_07.txt, 01_rnd_7_08.txt, 01_rnd_7_09.txt, 01_rnd_7_10.txt, 01_rnd_7_11.txt, 01_rnd_7_12.txt, 01_rnd_7_13.txt, 01_rnd_7_14.txt, 01_rnd_7_15.txt, 01_rnd_7_16.txt, 01_rnd_7_17.txt, 01_rnd_7_18.txt, 01_rnd_7_19.txt, 01_rnd_7_20.txt, 01_rnd_7_21.txt, 01_rnd_7_22.txt, 01_rnd_8_01.txt, 01_rnd_8_02.txt, 01_rnd_8_03.txt, 01_rnd_8_04.txt, 01_rnd_8_05.txt, 01_rnd_8_06.txt, 01_rnd_8_07.txt, 01_rnd_8_08.txt, 01_rnd_8_09.txt, 01_rnd_8_10.txt, 01_rnd_8_11.txt, 01_rnd_8_12.txt, 01_rnd_8_13.txt, 01_rnd_8_14.txt, 01_rnd_8_15.txt, 01_rnd_8_16.txt, 01_rnd_8_17.txt, 01_rnd_8_18.txt, 01_rnd_8_19.txt, 01_rnd_8_20.txt, 01_rnd_8_21.txt, 01_rnd_8_22.txt
Case Name Status Exec Time Memory
00_mini_01.txt AC 9183 ms 664 KB
00_mini_02.txt AC 9176 ms 736 KB
00_sample_01.txt AC 503 ms 660 KB
00_sample_02.txt AC 5320 ms 740 KB
00_sample_03.txt AC 753 ms 732 KB
01_rnd_11_01.txt AC 4502 ms 732 KB
01_rnd_11_02.txt AC 4513 ms 636 KB
01_rnd_11_03.txt AC 4533 ms 736 KB
01_rnd_11_04.txt AC 4558 ms 636 KB
01_rnd_11_05.txt AC 4534 ms 736 KB
01_rnd_11_06.txt AC 4544 ms 668 KB
01_rnd_11_07.txt AC 5037 ms 664 KB
01_rnd_11_08.txt AC 4525 ms 732 KB
01_rnd_11_09.txt AC 4813 ms 752 KB
01_rnd_11_10.txt AC 4505 ms 660 KB
01_rnd_11_11.txt AC 4512 ms 660 KB
01_rnd_11_12.txt AC 3877 ms 664 KB
01_rnd_11_13.txt AC 227 ms 688 KB
01_rnd_11_14.txt AC 733 ms 656 KB
01_rnd_11_15.txt AC 4323 ms 632 KB
01_rnd_11_16.txt AC 2655 ms 636 KB
01_rnd_11_17.txt AC 1603 ms 664 KB
01_rnd_11_18.txt AC 3163 ms 728 KB
01_rnd_11_19.txt AC 4099 ms 660 KB
01_rnd_11_20.txt AC 4096 ms 732 KB
01_rnd_11_21.txt AC 2624 ms 664 KB
01_rnd_11_22.txt AC 1573 ms 660 KB
01_rnd_7_01.txt AC 4839 ms 648 KB
01_rnd_7_02.txt AC 4868 ms 664 KB
01_rnd_7_03.txt AC 4886 ms 688 KB
01_rnd_7_04.txt AC 4875 ms 652 KB
01_rnd_7_05.txt AC 4896 ms 660 KB
01_rnd_7_06.txt AC 4860 ms 664 KB
01_rnd_7_07.txt AC 4856 ms 696 KB
01_rnd_7_08.txt AC 4850 ms 660 KB
01_rnd_7_09.txt AC 4843 ms 660 KB
01_rnd_7_10.txt AC 4840 ms 660 KB
01_rnd_7_11.txt AC 5471 ms 664 KB
01_rnd_7_12.txt AC 2890 ms 660 KB
01_rnd_7_13.txt AC 4645 ms 752 KB
01_rnd_7_14.txt AC 3060 ms 660 KB
01_rnd_7_15.txt AC 2585 ms 732 KB
01_rnd_7_16.txt AC 4435 ms 664 KB
01_rnd_7_17.txt AC 1972 ms 640 KB
01_rnd_7_18.txt AC 2919 ms 660 KB
01_rnd_7_19.txt AC 1217 ms 664 KB
01_rnd_7_20.txt AC 1659 ms 656 KB
01_rnd_7_21.txt AC 2788 ms 664 KB
01_rnd_7_22.txt AC 971 ms 736 KB
01_rnd_8_01.txt AC 4698 ms 732 KB
01_rnd_8_02.txt AC 5385 ms 664 KB
01_rnd_8_03.txt AC 4754 ms 664 KB
01_rnd_8_04.txt AC 4760 ms 664 KB
01_rnd_8_05.txt AC 4765 ms 660 KB
01_rnd_8_06.txt AC 4753 ms 660 KB
01_rnd_8_07.txt AC 4945 ms 660 KB
01_rnd_8_08.txt AC 4800 ms 756 KB
01_rnd_8_09.txt AC 7345 ms 660 KB
01_rnd_8_10.txt AC 4720 ms 660 KB
01_rnd_8_11.txt AC 4745 ms 736 KB
01_rnd_8_12.txt AC 3155 ms 656 KB
01_rnd_8_13.txt AC 443 ms 664 KB
01_rnd_8_14.txt AC 3206 ms 724 KB
01_rnd_8_15.txt AC 2324 ms 680 KB
01_rnd_8_16.txt AC 1877 ms 664 KB
01_rnd_8_17.txt AC 4307 ms 656 KB
01_rnd_8_18.txt AC 998 ms 660 KB
01_rnd_8_19.txt AC 2297 ms 656 KB
01_rnd_8_20.txt AC 3181 ms 744 KB
01_rnd_8_21.txt AC 975 ms 664 KB
01_rnd_8_22.txt AC 4283 ms 736 KB