結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-12-29 19:56:28 | 
| 言語 | PHP (843.2) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 40 ms / 5,000 ms | 
| コード長 | 700 bytes | 
| コンパイル時間 | 1,961 ms | 
| コンパイル使用メモリ | 31,504 KB | 
| 実行使用メモリ | 32,528 KB | 
| 最終ジャッジ日時 | 2024-10-05 23:39:04 | 
| 合計ジャッジ時間 | 1,185 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php
/**
 * @see https://yukicoder.me/problems/no/24
 */
$numTurn = trim(fgets(STDIN));
$numSet = range(0, 9);
$candidates = $numSet;
for ($i = 0; $i < $numTurn; $i++) {
    $splitArrays = array_chunk(explode(' ', trim(fgets(STDIN))), 4);
    $sayNums = $splitArrays[0];
    $response = $splitArrays[1][0];
    $candidates = extractCandidates($candidates, $sayNums, $response);
}
echo implode('', $candidates) . "\n";
function extractCandidates(array $candidates, array $sayNums, string $response): array
{
    switch ($response) {
        case 'NO':
            return array_diff($candidates, $sayNums);
        case 'YES':
            return array_intersect($candidates, $sayNums);
    }
}
            
            
            
        