結果
問題 | No.1717 Levi-Civita Triangle |
ユーザー |
|
提出日時 | 2021-10-22 23:15:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 521 ms |
コンパイル使用メモリ | 64,640 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-23 07:43:06 |
合計ジャッジ時間 | 2,454 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream>using namespace std;int N;int A[2<<17],B[2<<17];main(){cin>>N;for(int i=0;i<=2*N;i++)cin>>A[i];bool ok=true;for(int i=0;i<2*N;i++){B[i]=(A[i+1]-A[i]+3)%3;if(B[i]==0)ok=false;}for(int i=0;i<2*N;i+=2)if(B[i]!=B[i+1]||i>0&&B[i]==B[i-1])ok=false;if(ok){cout<<(B[0]==1^N%2==1?2:1)<<endl;}else cout<<0<<endl;}