結果
| 問題 | No.3070 Collecting Coins Speedrun 2 |
| コンテスト | |
| ユーザー |
Tehom
|
| 提出日時 | 2026-07-29 01:28:44 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| + 394µs | |
| コード長 | 1,128 bytes |
| 記録 | |
| コンパイル時間 | 4,034 ms |
| コンパイル使用メモリ | 374,880 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-29 01:28:54 |
| 合計ジャッジ時間 | 6,395 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repl(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
template <typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;}
template <typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;} return false;}
void solve(){
int n; cin >> n;
vector<int> a(n);
int minus=0,plus=0;
rep(i,0,n){
cin >> a[i];
if(a[i]<0)minus++;
if(a[i]>0)plus++;
}
using mint=modint998244353;
if(minus == 0 && plus == 0){
cout << "1\n";
return;
}
if(minus == 0 || plus == 0){
if(minus == 0) swap(minus,plus);
mint ans=mint(2).pow(minus-1);
if(n != minus) ans*=2;
cout << ans.val() << "\n";
return;
}
mint ans=mint(2).pow(minus-1)*mint(2).pow(plus-1);
ans*=2;
if(minus+plus != n)ans*=3;
cout << ans.val() << "\n";
return;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T=1;
// cin >> T;
while(T--) solve();
}
Tehom