結果
問題 |
No.3070 Collecting Coins Speedrun 2
|
ユーザー |
![]() |
提出日時 | 2025-03-21 23:19:29 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 905 bytes |
コンパイル時間 | 3,648 ms |
コンパイル使用メモリ | 275,736 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-21 23:19:35 |
合計ジャッジ時間 | 5,341 ms |
ジャッジサーバーID (参考情報) |
judge7 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define INF 9e18; #define mod 998244353 ll Power(ll a,ll b,ll m){ ll Answer=1; for(int i=1;i<=b;i++) Answer=(Answer*a)%m; return Answer; } int main(){ cin.tie(0)->sync_with_stdio(0); cout.tie(0); ll N; cin>>N; vector<ll>c(N); rep(i,N) cin>>c.at(i); ll ans=0; ll my_cnt=0,pl_cnt=0; bool zero=false; rep(i,N){ if(c.at(i)>0) pl_cnt++; else if(c.at(i)<0) my_cnt++; else zero=true; } if(pl_cnt==0){ ans=Power(2,my_cnt-1,mod); } else if(my_cnt==0){ ans=Power(2,pl_cnt-1,mod); } else{ ans=Power(2,my_cnt-1,mod)*Power(2,pl_cnt-1,mod); ans%=mod; ans*=2; if(zero==true) ans*=3; } ans%=mod; if(ans<0) ans+=mod; cout<<ans<<endl; }