結果
| 問題 |
No.3070 Collecting Coins Speedrun 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-21 23:02:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 583 bytes |
| コンパイル時間 | 2,091 ms |
| コンパイル使用メモリ | 195,320 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 23:02:29 |
| 合計ジャッジ時間 | 3,273 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#include<atcoder/modint>
using namespace atcoder;
using mint=modint998244353;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll N;
cin>>N;
ll P=0,Q=0;
vector<ll> C(N);
for(int i=0;i<N;i++){
cin>>C[i];
(C[i]>0?P:Q)=max((C[i]>0?P:Q),abs(C[i]));
}
mint an=1;
if(P==0&&Q==0){
cout<<1<<endl;
return 0;
}
for(int i=0;i<N;i++){
if(C[i]==0){
if(P>0&&Q>0)an*=3;
else if(P>0||Q>0)an*=2;
}
else if((C[i]>0?P:Q)!=abs(C[i]))an*=2;
}
if(P>0&&Q>0)an*=2;
cout<<an.val()<<endl;
}