結果
問題 | No.1717 Levi-Civita Triangle |
ユーザー |
![]() |
提出日時 | 2021-10-22 22:59:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 873 bytes |
コンパイル時間 | 511 ms |
コンパイル使用メモリ | 65,524 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-23 06:51:04 |
合計ジャッジ時間 | 2,259 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 |
ソースコード
#include <iostream> using namespace std; int main() { int n; cin >> n; n = n * 2 + 1; int a[200005]; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < n - 4; i++){ if(a[i] != a[i + 4]){ cout << 0 << endl; return 0; } } for(int i = 1; i < n - 2; i += 2){ if(a[i] != a[i + 2]){ cout << 0 << endl; return 0; } } if(n % 4 == 1){ if((a[0] + 1) % 3 == a[1] && (a[1] + 1) % 3 == a[2]) cout << 2 << endl; else if((a[0] + 2) % 3 == a[1] && (a[1] + 2) % 3 == a[2]) cout << 1 << endl; else cout << 0 << endl; } else{ if((a[0] + 1) % 3 == a[1] && (a[1] + 1) % 3 == a[2]) cout << 1 << endl; else if((a[0] + 2) % 3 == a[1] && (a[1] + 2) % 3 == a[2]) cout << 2 << endl; else cout << 0 << endl; } }