結果
| 問題 |
No.1717 Levi-Civita Triangle
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-26 16:00:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 485 bytes |
| コンパイル時間 | 842 ms |
| コンパイル使用メモリ | 66,700 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-26 16:01:39 |
| 合計ジャッジ時間 | 2,728 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 42 |
コンパイルメッセージ
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]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#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(){
solve();
return 0;
}
lam6er