結果

問題 No.3070 Collecting Coins Speedrun 2
ユーザー Hydrogen332
提出日時 2025-03-31 02:02:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 784 bytes
コンパイル時間 3,827 ms
コンパイル使用メモリ 275,512 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-31 02:02:51
合計ジャッジ時間 5,928 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()

#include <atcoder/modint>
using namespace atcoder;
using mint = modint998244353;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int N;
    cin >> N;
    int L = 0, R = 0;
    bool zero = false;
    rep(i, 0, N) {
        int C;
        cin >> C;
        if (C == 0) zero = true;
        else if (C < 0) ++L;
        else ++R;
    }
    
    mint ans = 1;
    if (L != 0) ans *= mint(2).pow(L - 1);
    if (R != 0) ans *= mint(2).pow(R - 1);
    
    if (L*R > 0) {
        ans *= 2;
        if (zero) ans *= 3;
    } else if (zero) ans *= 2;
    
    cout << ans.val() << '\n';
}
0