結果

問題 No.239 にゃんぱすー
コンテスト
ユーザー Ruizi_Luigi
提出日時 2015-10-29 00:43:53
言語 PHP
(8.5.4)
コンパイル:
php -l _filename_
実行:
php _filename_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 627 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,275 ms
コンパイル使用メモリ 37,120 KB
実行使用メモリ 38,140 KB
最終ジャッジ日時 2026-04-04 03:19:25
合計ジャッジ時間 6,868 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
PHP Deprecated:  Non-canonical cast (integer) is deprecated, use the (int) cast instead in Main.php on line 6

Deprecated: Non-canonical cast (integer) is deprecated, use the (int) cast instead in Main.php on line 6
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?php

define('HELLO', 'nyanpass');
define ('NOT_HELLO', '-');

$n = (integer)trim(fgets(STDIN));
$lists = array();
$tmp_list = explode(' ', (string)trim(fgets(STDIN)));
foreach ($tmp_list as $key=>$val) {
    if ($val === HELLO || $val === NOT_HELLO) $lists[] = $key;
}
for ($i = 1; $i < $n; $i++) {
    $tmp_list = explode(' ', (string)trim(fgets(STDIN)));

    for ($j = count($lists)-1; $j >= 0; $j--) {
        if ($tmp_list[$lists[$j]] !== HELLO && $tmp_list[$lists[$j]] !== NOT_HELLO) {
            unset($lists[$j]);
        }
    }
    $lists = array_values($lists);
}
echo count($lists) === 1 ? $lists[0]+1 : '-1';
?>
0