結果

問題 No.459 C-VS for yukicoder
ユーザー tailstails
提出日時 2016-12-10 01:12:17
言語 Perl
(5.38.2)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 1,003 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 20,532 KB
最終ジャッジ日時 2023-08-19 06:45:39
合計ジャッジ時間 4,874 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,352 KB
testcase_01 AC 6 ms
5,244 KB
testcase_02 AC 5 ms
5,240 KB
testcase_03 AC 5 ms
5,384 KB
testcase_04 AC 5 ms
5,260 KB
testcase_05 AC 6 ms
5,184 KB
testcase_06 AC 5 ms
5,064 KB
testcase_07 AC 5 ms
5,256 KB
testcase_08 AC 5 ms
5,252 KB
testcase_09 AC 6 ms
5,160 KB
testcase_10 AC 5 ms
5,332 KB
testcase_11 AC 5 ms
5,208 KB
testcase_12 AC 5 ms
5,160 KB
testcase_13 AC 5 ms
5,204 KB
testcase_14 AC 6 ms
5,212 KB
testcase_15 AC 8 ms
5,488 KB
testcase_16 AC 8 ms
5,356 KB
testcase_17 AC 5 ms
5,384 KB
testcase_18 AC 6 ms
5,164 KB
testcase_19 AC 6 ms
5,196 KB
testcase_20 AC 5 ms
5,368 KB
testcase_21 AC 168 ms
20,532 KB
testcase_22 AC 149 ms
19,820 KB
testcase_23 AC 161 ms
19,604 KB
testcase_24 AC 55 ms
10,852 KB
testcase_25 AC 25 ms
7,564 KB
testcase_26 AC 25 ms
6,832 KB
testcase_27 AC 24 ms
6,776 KB
testcase_28 AC 23 ms
7,648 KB
testcase_29 AC 55 ms
10,172 KB
testcase_30 AC 26 ms
6,748 KB
testcase_31 AC 32 ms
7,968 KB
testcase_32 AC 8 ms
5,472 KB
testcase_33 AC 37 ms
8,652 KB
testcase_34 AC 41 ms
8,968 KB
testcase_35 AC 10 ms
5,644 KB
testcase_36 AC 42 ms
8,744 KB
testcase_37 AC 8 ms
5,320 KB
testcase_38 AC 36 ms
8,436 KB
testcase_39 AC 10 ms
5,544 KB
testcase_40 AC 29 ms
7,696 KB
testcase_41 AC 7 ms
5,480 KB
testcase_42 AC 28 ms
7,356 KB
testcase_43 AC 39 ms
8,392 KB
testcase_44 AC 13 ms
5,896 KB
testcase_45 AC 11 ms
5,680 KB
testcase_46 AC 11 ms
5,712 KB
testcase_47 AC 9 ms
5,572 KB
testcase_48 AC 40 ms
8,556 KB
testcase_49 AC 8 ms
5,472 KB
testcase_50 AC 34 ms
8,136 KB
testcase_51 AC 8 ms
5,512 KB
testcase_52 AC 20 ms
6,664 KB
testcase_53 AC 10 ms
5,556 KB
testcase_54 AC 37 ms
8,448 KB
testcase_55 AC 16 ms
6,196 KB
testcase_56 AC 30 ms
7,608 KB
testcase_57 AC 8 ms
5,508 KB
testcase_58 AC 42 ms
8,952 KB
testcase_59 AC 13 ms
5,892 KB
testcase_60 AC 21 ms
6,604 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::y" used only once: possible typo at Main.pl line 2.
Main.pl syntax OK

ソースコード

diff #

($h,$w,$n)=glob<>;
for$y(1..$h){
	$_=<>;
	for$x(0..$w-1){
		if(substr($_,$x,1)eq'#'){
			++$a[$x];
		}
	}
}
for$t(0..$n-1){
	$c=<>;
	$t[$c]=$t;
	$e[$c+0]+=3;
	$e[$c+1]+=3;
	$e[$c+2]+=3;
	push@b,sprintf"%6d,%6d",$c,$t;
}
@b=sort@b;
for$j(0..$#b){
	$_=$b[$j];
	/,/,$c=$`,$t=$';
	$j[$t]=$j;
	$e[$c+0]-=3; $a[$c+0]-=$r[$j][0]=$-=$a[$c+0]-$e[$c+0]; 
	$e[$c+1]-=3; $a[$c+1]-=$r[$j][1]=$-=$a[$c+1]-$e[$c+1]; 
	$e[$c+2]-=3; $a[$c+2]-=$r[$j][2]=$-=$a[$c+2]-$e[$c+2]; 
	if($r[$j][0]+$r[$j][1]+$r[$j][2]==0){
		if($a[$c+0]){
			$r[$j][0]=1;
			--$a[$c+0];
		}elsif($a[$c+1]){
			$r[$j][1]=1;
			--$a[$c+1];
		}elsif($a[$c+2]){
			$r[$j][2]=1;
			--$a[$c+2];
		}else{
		last;
			#die;
		}
	}
}
for$t(0..$n-1){
	$j=$j[$t];
	print $r[$j][0]>0?'#':'.';
	print $r[$j][1]>0?'#':'.';
	print $r[$j][2]>0?'#':'.';
	print "\n";
	print $r[$j][0]>1?'#':'.';
	print $r[$j][1]>1?'#':'.';
	print $r[$j][2]>1?'#':'.';
	print "\n";
	print $r[$j][0]>2?'#':'.';
	print $r[$j][1]>2?'#':'.';
	print $r[$j][2]>2?'#':'.';
	print "\n";
}
0