結果
| 問題 | No.1717 Levi-Civita Triangle |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-08-22 10:30:06 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 519 bytes |
| 記録 | |
| コンパイル時間 | 320 ms |
| コンパイル使用メモリ | 83,304 KB |
| 実行使用メモリ | 18,944 KB |
| 最終ジャッジ日時 | 2026-07-05 12:00:55 |
| 合計ジャッジ時間 | 5,032 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | WA * 2 TLE * 1 -- * 39 |
ソースコード
#include <iostream>
#include <cstdio>
using namespace std;
const int N=1e5+5;
int n,a[2*N];
bool calc(){
for(int i=0;i<n;i++)
if((a[i]==0)^(i&1))
return true;
for(int i=2;i<n;i+=2)
if(a[i-2]==a[i])
return true;
return false;
}
void solve(){
scanf("%d",&n);
n=n*2+1;
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
if(a[1]){
int x=3-a[1];
for(int i=0;i<n;i++)
a[i]=(a[i]+x)%3;
}
if(calc()) puts("0");
else printf("%d\n",a[n-1]);
}
int main(){
int T;scanf("%d",&T);
while(T--) solve();
return 0;
}
vjudge1