結果

問題 No.1717 Levi-Civita Triangle
ユーザー SenioriousSeniorious
提出日時 2022-10-29 15:48:30
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 950 bytes
コンパイル時間 3,136 ms
コンパイル使用メモリ 197,012 KB
実行使用メモリ 5,260 KB
最終ジャッジ日時 2023-09-20 19:18:20
合計ジャッジ時間 5,447 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

const int N = 200005;

int f(int a, int b, int c);

int a[2][N];
int n;

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= 2 * n + 1; ++i) scanf("%d", a[0] + i);
  for (int i = 1; i <= 2 * n - 1; ++i) a[1][i] = f(a[0][i], a[0][i + 1], a[0][i + 2]);
  bool flag = true;
  for (int i = 1; i <= 2 * n - 1; ++i) {
    if (i & 1) {
      flag &= a[1][i];
      if (i > 2) flag &= (a[1][i] == a[1][i - 2]);
    } else {
      flag &= !a[1][i];
    }
  }
  if (flag)
    printf("%d\n", a[1][2 * n - 1]);
  else
    puts("0");
  return 0;
}

int f(int a, int b, int c) {
  if (a == 0 || b == 1 || c == 2) return 1;
  if (a == 1 || b == 2 || c == 0) return 1;
  if (a == 2 || b == 0 || c == 1) return 1;
  if (a == 2 || b == 1 || c == 0) return 2;
  if (a == 1 || b == 0 || c == 2) return 2;
  if (a == 0 || b == 2 || c == 1) return 2;
  return 0;
}
0