結果
問題 |
No.3070 Collecting Coins Speedrun 2
|
ユーザー |
![]() |
提出日時 | 2025-03-21 22:07:40 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 2,994 ms |
コンパイル使用メモリ | 277,600 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-21 22:07:49 |
合計ジャッジ時間 | 4,649 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 6 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/modint> using namespace atcoder; using mint=modint998244353; using namespace std; #define rep(i,N) for(i=0;i<N;i++) #define ll long long int main(void){ ll N; ll C[100009]; bool zero=0; ll i,j,k; cin>>N; rep(i,N){ cin>>C[i]; if(C[i]==0)zero=1; } sort(C,C+N); ll M=0; if(C[0]<0)M+=abs(C[0]); if(C[N-1]>0)M+=C[N-1]; ll corner=0; if(C[0]<0)corner++; if(C[N-1]>0)corner++; if(zero)corner++; mint ans=mint(2).pow(N-corner); if(C[0]*C[N-1]<0)ans*=2; if(zero)ans*=3; cout<<ans.val()<<endl; return 0; }