結果
| 問題 |
No.583 鉄道同好会
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2017-10-27 22:49:11 |
| 言語 | Perl (5.40.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 450 bytes |
| コンパイル時間 | 36 ms |
| コンパイル使用メモリ | 6,688 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2024-11-21 22:41:46 |
| 合計ジャッジ時間 | 4,092 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 1 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
($n,$m)=glob<>;
@s=map[glob],<>;
die if @s!=$m;
for(@s){
++$d[$a=$_->[0]];
++$d[$b=$_->[1]];
vec($e[$a],$b,1)=1;
vec($e[$b],$a,1)=1;
vec($h,$a,1)=1;
vec($h,$b,1)=1;
die if $a>=$n;
die if $b>=$n;
}
for(0..$n-1){
$c+=$d[$_]%2;
}
if($c>2){
print"NO";
exit;
}
sub f{
my($a)=@_;
if(!vec($g,$a,1)){
vec($g,$a,1)=1;
for(0..$n-1){
if(vec($e[$a],$_,1)){
f($_);
}
}
}
}
f($s[0][0]);
if($g!=$h){
print"NO";
exit;
}
print"YES";
tails