結果
| 問題 |
No.1717 Levi-Civita Triangle
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2021-10-22 22:35:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,441 bytes |
| コンパイル時間 | 1,533 ms |
| コンパイル使用メモリ | 171,428 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-23 06:17:32 |
| 合計ジャッジ時間 | 7,622 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 2 |
| other | AC * 10 RE * 32 |
ソースコード
#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];
}
bool ok = false;
for (int i = 0; i <= N * 2 - 1; i++){
if (A[i] == A[i + 1]){
ok = true;
}
}
for (int i = 0; i <= N * 2 - 3; i++){
int x = (A[i + 1] - A[i] + 3) % 3;
int y = (A[i + 2] - A[i + 1] + 3) % 3;
int z = (A[i + 3] - A[i + 2] + 3) % 3;
if (x == y && y == z){
ok = true;
}
}
for (int i = 0; i <= N * 2 - 3; i++){
vector<bool> used(3, false);
for (int j = 0; j < 4; j++){
used[A[i + j]] = true;
}
for (int j = 0; j < 3; j++){
if (!used[j]){
ok = true;
}
}
}
if (ok){
cout << 0 << endl;
} else {
assert(false);
for (int i = 0; i < 3; i++){
vector<int> B(N * 2 + 1);
for (int j = 0; j <= N * 2; j++){
B[j] = (A[j] + i) % 3;
}
bool ok2 = true;
for (int j = 0; j <= N * 2; j++){
if (abs(B[j + 1] - B[j]) >= 2){
ok2 = false;
}
}
if (ok2){
swap(A, B);
break;
}
}
if (A[0] == 1){
cout << 0 << endl;
} else if (A[0] == 0){
if (N % 2 == 1){
cout << 1 << endl;
} else {
cout << 2 << endl;
}
} else {
if (N % 2 == 0){
cout << 1 << endl;
} else {
cout << 2 << endl;
}
}
}
}
SSRS