結果

問題 No.2148 ひとりUNO
ユーザー 👑 chro_96chro_96
提出日時 2022-12-05 00:58:16
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 31,360 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 05:52:27
合計ジャッジ時間 1,694 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 16 ms
5,376 KB
testcase_17 AC 16 ms
5,376 KB
testcase_18 AC 17 ms
5,376 KB
testcase_19 AC 16 ms
5,376 KB
testcase_20 AC 14 ms
5,376 KB
testcase_21 AC 14 ms
5,376 KB
testcase_22 AC 15 ms
5,376 KB
testcase_23 AC 14 ms
5,376 KB
testcase_24 AC 14 ms
5,376 KB
testcase_25 AC 15 ms
5,376 KB
testcase_26 AC 7 ms
5,376 KB
testcase_27 AC 7 ms
5,376 KB
testcase_28 AC 6 ms
5,376 KB
testcase_29 AC 7 ms
5,376 KB
testcase_30 AC 6 ms
5,376 KB
testcase_31 AC 6 ms
5,376 KB
testcase_32 AC 7 ms
5,376 KB
testcase_33 AC 7 ms
5,376 KB
testcase_34 AC 7 ms
5,376 KB
testcase_35 AC 7 ms
5,376 KB
testcase_36 AC 7 ms
5,376 KB
testcase_37 AC 7 ms
5,376 KB
testcase_38 AC 7 ms
5,376 KB
testcase_39 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int t = 0;
  int n = 0;
  char c[2] = "";
  int d = 0;
  
  int res = 0;
  int flag[200000] = {};
  
  char cmap[3] = { 'B', 'G', 'R' };
  
  res = scanf("%d", &t);
  while (t > 0) {
    int cnt[8] = {};
    int b = 0;
    int ccnt[3] = {};
    res = scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      flag[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      res = scanf("%s", c);
      res = scanf("%d", &d);
      d--;
      for (int j = 0; j < 3; j++) {
        if (c[0] == cmap[j]) {
          flag[d] |= (1<<j);
          b |= (1<<j);
          ccnt[j]++;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      cnt[flag[i]]++;
    }
    if ((b == 7 && (cnt[7] > 1 || (cnt[7] > 0 && (ccnt[0] <= 1 || ccnt[1] <= 1 || ccnt[2] <= 1 || cnt[3] > 0 || cnt[5] > 0 || cnt[6] > 0)) || (cnt[3] > 0 && (cnt[5] > 0 || cnt[6] > 0)) || (cnt[5] > 0 && cnt[6] > 0))) || (b != 7 && cnt[b] > 0)) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
    t--;
  }
  
  return 0;
}
0