結果

問題 No.1717 Levi-Civita Triangle
ユーザー SSRSSSRS
提出日時 2021-10-22 21:42:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,053 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 170,072 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-24 12:42:25
合計ジャッジ時間 5,887 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N * 2 + 1);
  for (int i = 0; i <= N * 2; i++){
    cin >> A[i];
  }
  while (true){
    int M = A.size();
    if (M == 1){
      cout << A[0] << endl;
      break;
    }
    bool ok = false;
    for (int i = 0; i < M - 1; i++){
      if (A[i] == A[i + 1]){
        ok = true;
      }
    }
    if (ok){
      cout << 0 << endl;
      break;
    }
    vector<int> B(M - 2);
    for (int i = 0; i < M - 2; i++){
      if (A[i] == 0 && A[i + 1] == 1 && A[i + 2] == 2){
        B[i] = 1;
      } else if (A[i] == 1 && A[i + 1] == 2 && A[i + 2] == 0){
        B[i] = 1;
      } else if (A[i] == 2 && A[i + 1] == 0 && A[i + 2] == 1){
        B[i] = 1;
      } else if (A[i] == 2 && A[i + 1] == 1 && A[i + 2] == 0){
        B[i] = 2;
      } else if (A[i] == 1 && A[i + 1] == 0 && A[i + 2] == 2){
        B[i] = 2;
      } else if (A[i] == 0 && A[i + 1] == 2 && A[i + 2] == 1){
        B[i] = 2;
      } else {
        B[i] = 0;
      }
    }
    swap(A, B);
  }
}
0