結果

問題 No.483 マッチ並べ
ユーザー tails
提出日時 2017-02-10 23:04:24
言語 Perl
(5.40.0)
結果
WA  
実行時間 -
コード長 525 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 5,888 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2024-12-29 09:47:28
合計ジャッジ時間 4,044 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::i" used only once: possible typo at Main.pl line 2.
Main.pl syntax OK

ソースコード

diff #

$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;
0