結果

問題 No.2343 (l+r)/2
ユーザー 👑 chro_96chro_96
提出日時 2023-06-09 23:51:14
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 793 bytes
コンパイル時間 1,766 ms
コンパイル使用メモリ 28,900 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 14:58:27
合計ジャッジ時間 2,874 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 39 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 20 ms
4,380 KB
testcase_04 AC 9 ms
4,380 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 11 ms
4,380 KB
testcase_09 AC 8 ms
4,384 KB
testcase_10 AC 4 ms
4,384 KB
testcase_11 AC 9 ms
4,380 KB
testcase_12 AC 7 ms
4,380 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 12 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int t = 0;
  int n = 0;
  int a[200000] = {};
  
  int res = 0;
  
  res = scanf("%d", &t);
  while (t > 0) {
    res = scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      res = scanf("%d", a+i);
    }
    if (a[0] != a[n-1]) {
      printf("Yes\n");
    } else {
      int is_ok = 0;
      for (int i = 1; i < n-2; i++) {
        if (a[i] == a[i+1] && a[i] != a[0]) {
          is_ok = 1;
        }
      }
      if (is_ok > 0) {
        printf("Yes\n");
      } else {
        int cnt = 0;
        for (int i = 0; i < n-1; i++) {
          if (a[i] != a[i+1]) {
            cnt++;
          }
        }
        if (cnt > 7) {
          printf("Yes\n");
        } else {
          printf("No\n");
        }
      }
    }
    t--;
  }
  
  return 0;
}
0