結果
問題 | No.483 マッチ並べ |
ユーザー | tails |
提出日時 | 2017-02-10 23:04:56 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 373 ms |
コンパイル使用メモリ | 7,076 KB |
実行使用メモリ | 9,472 KB |
最終ジャッジ日時 | 2024-12-29 10:56:33 |
合計ジャッジ時間 | 3,760 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 53 |
コンパイルメッセージ
Name "main::i" used only once: possible typo at Main.pl line 2. Main.pl syntax OK
ソースコード
$n=<>; for$i(1..$n){ ($r1,$c1,$r2,$c2)=glob<>; push@{"$r1,$c1"},"$r2,$c2"; push@{"$r2,$c2"},"$r1,$c1"; $a{"$r1,$c1,$r2,$c2"}=1; $a{"$r2,$c2,$r1,$c1"}=1; } sub hoge1 { my($yx)=@_; @$yx=grep{$a{"$yx,$_"}}@$yx; if(@$yx==1){ $z=pop@$yx; $a{"$yx,$z"}=0; $a{"$z,$yx"}=0; hoge1($z); } } for$y(1..100){ for$x(1..100){ hoge1("$y,$x"); } } sub hoge2 { my($yx)=@_; if(@$yx>2){ $f=1; } my@t=@$yx; @$yx=(); for(@t){ hoge2($_); } } for$y(1..100){ for$x(1..100){ hoge2("$y,$x"); } } print $f?NO:YES;