結果
問題 | No.1741 Arrays and XOR Procedure |
ユーザー |
![]() |
提出日時 | 2021-11-12 23:03:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 717 bytes |
コンパイル時間 | 1,975 ms |
コンパイル使用メモリ | 193,892 KB |
最終ジャッジ日時 | 2025-01-25 17:26:35 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 35 WA * 6 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; const int MOD=998244353; bool is_nCk_odd(int n, int k){ return (n&k)==k; } ll modpow(ll x,ll n){ ll ans=1; while(n){ if(n&1) ans=ans*x%MOD; x=x*x%MOD; n/=2; } return ans; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector<int> B(n); rep(i,n) cin>>B[i]; int now=0; ll cnt=0,bnt=0; rep(i,n){ if(is_nCk_odd(n-1,i)){ if(B[i]>=0) now^=B[i]; else cnt++; } else{ if(B[i]==-1) bnt++; } } cout<<modpow(2,bnt)*modpow(2,cnt-1)%MOD<<endl; return 0; }