結果

問題 No.24 数当てゲーム
ユーザー nak2yoshinak2yoshi
提出日時 2016-02-17 17:38:23
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 98,444 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 02:52:19
合計ジャッジ時間 1,239 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio,
       std.conv,
       std.string,
       std.range,
       std.algorithm,
       core.bitop;

void main()
{
    auto N = readln.strip.to!int;
    int[] A, B, C, D;
    string[] R;
    foreach (_; 0 .. N)
    {
        auto input = readln.split;
        A ~= input[0].to!int;
        B ~= input[1].to!int;
        C ~= input[2].to!int;
        D ~= input[3].to!int;
        R ~= input[4];
    }

    ulong ans = 0xFFFF;
    foreach (i; 0 .. N)
    {
        auto flg = (1UL << A[i]) | (1UL << B[i]) | (1UL << C[i]) | (1UL << D[i]);
        if (R[i] == "YES")
            ans &= flg;
        else
            ans &= ~flg;
    }
    ans.bsf.writeln;
}
0