結果
| 問題 |
No.1741 Arrays and XOR Procedure
|
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2021-11-12 22:33:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 771 bytes |
| コンパイル時間 | 3,846 ms |
| コンパイル使用メモリ | 229,676 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 19:54:07 |
| 合計ジャッジ時間 | 6,005 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,ll>>>;
#define INF 1000000000
#define MOD 998244353
#define MAX 300000
int main(){
int N;
cin>>N;
vector<int> B(N);
for(int i=0;i<N;i++){
cin>>B[i];
}
vector<int> cnt(N,0);
for(int i=1;i<N;i++){
int x=i;
cnt[i]=cnt[i-1];
while(x%2==0){
x/=2;
cnt[i]++;
}
}
int x=0;
for(int i=0;i<N;i++){
if(B[i]==1&&cnt[N-1]-cnt[i]-cnt[(N-1)-i]==0){
x=1-x;
}
}
ll zero=0;
ll one=0;
if(x==0){
zero=1;
}else{
one=1;
}
for(int i=0;i<N;i++){
if(B[i]==-1){
ll sum=(zero+one)%MOD;
zero=sum;
one=sum;
}
}
cout<<one<<'\n';
}
monnu