結果
問題 |
No.459 C-VS for yukicoder
|
ユーザー |
![]() |
提出日時 | 2016-12-10 00:29:02 |
言語 | Perl (5.40.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 962 bytes |
コンパイル時間 | 53 ms |
コンパイル使用メモリ | 5,888 KB |
実行使用メモリ | 23,596 KB |
最終ジャッジ日時 | 2024-11-28 20:34:34 |
合計ジャッジ時間 | 22,067 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 52 TLE * 6 |
コンパイルメッセージ
Name "main::y" used only once: possible typo at Main.pl line 2. Main.pl syntax OK
ソースコード
($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; push@b,sprintf"%6d,%6d",$c,$t; } @b=sort@b; for($j=0;$j<@b;++$j){ $_=$b[$j]; /,/,$c=$`,$t=$'; $j[$t]=$j; $r[$j][0]=$a[$c+0]<3?$a[$c+0]:3; $a[$c+0]-=$r[$j][0]; $r[$j][1]=$a[$c+1]<3?$a[$c+1]:3; $a[$c+1]-=$r[$j][1]; $r[$j][2]=$a[$c+2]<3?$a[$c+2]:3; $a[$c+2]-=$r[$j][2]; while($r[$j][0]+$r[$j][1]+$r[$j][2]==0){ --$j; if($r[$j][2]){ --$r[$j][2]; ++$a[$b[$j]+2]; }elsif($r[$j][1]){ --$r[$j][1]; ++$a[$b[$j]+1]; }elsif($r[$j][0]){ --$r[$j][0]; ++$a[$b[$j]+0]; } } } 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"; }