結果
| 問題 | No.806 木を道に |
| コンテスト | |
| ユーザー |
しのっち
|
| 提出日時 | 2019-05-28 16:35:50 |
| 言語 | PHP (843.2) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 533 bytes |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 32,532 KB |
| 実行使用メモリ | 41,396 KB |
| 最終ジャッジ日時 | 2024-09-17 15:44:06 |
| 合計ジャッジ時間 | 2,875 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 27 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php
$apex = [];
$operation = 0;
$node = trim(fgets(STDIN));
for ($i = 0; $i < $node; ++$i) {
$string_array = explode(" ", trim(fgets(STDIN)));
if (isset($apex[ $string_array[0] ])) $apex[ $string_array[0] ]++;
else $apex[ $string_array[0] ] = 1;
if (isset($apex[ $string_array[1] ])) $apex[ $string_array[1] ]++;
else $apex[ $string_array[1] ] = 1;
}
$side_num = array_count_values($apex);
while ($side_num[1] > 2) {
$operation++;
$side_num[1]--;
}
echo $operation;
しのっち