結果
| 問題 |
No.3070 Collecting Coins Speedrun 2
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2025-03-22 04:14:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 655 bytes |
| コンパイル時間 | 3,797 ms |
| コンパイル使用メモリ | 275,304 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-22 04:14:07 |
| 合計ジャッジ時間 | 5,224 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
const int MOD=998244353;
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;
V<int> C(n);
bool b=false;
rep(i,n){
cin>>C[i];
if(C[i]==0) b=true;
}
if(b && C[0]<0 && C[n-1]>0) cout<<3*modpow(2,n-2)%MOD<<endl;
else cout<<modpow(2,n-1)<<endl;
return 0;
}
umezo