結果
| 問題 | No.1717 Levi-Civita Triangle | 
| コンテスト | |
| ユーザー |  vjudge1 | 
| 提出日時 | 2024-08-22 10:30:06 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 519 bytes | 
| コンパイル時間 | 671 ms | 
| コンパイル使用メモリ | 67,932 KB | 
| 最終ジャッジ日時 | 2025-02-23 23:17:47 | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | WA * 2 TLE * 1 -- * 39 | 
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:19:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |                 scanf("%d",&a[i]);
      |                 ~~~~~^~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:29:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |         int T;scanf("%d",&T);
      |               ~~~~~^~~~~~~~~
            
            ソースコード
#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;
}
            
            
            
        