結果

問題 No.24 数当てゲーム
ユーザー rsk0315rsk0315
提出日時 2020-02-24 17:13:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 420 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 32,640 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 09:56:05
合計ジャッジ時間 751 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>

int main() {
  int n;
  scanf("%d", &n);

  int no = 0;
  int yes = (1 << 10) - 1;
  for (int i = 0; i < n; ++i) {
    int cur = 0;
    for (int j = 0; j < 4; ++j) {
      int a;
      scanf("%d", &a);
      cur |= 1 << a;
    }

    char r[4];
    scanf("%s", r);
    if (r[0] == 'Y') {
      yes &= cur;
    } else {
      no |= cur;
    }
  }

  yes &= ~no;
  printf("%d\n", __builtin_ctz(yes));
}
0