結果

問題 No.3070 Collecting Coins Speedrun 2
ユーザー ooaiu
提出日時 2025-03-21 22:10:25
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 826 bytes
コンパイル時間 3,101 ms
コンパイル使用メモリ 278,344 KB
実行使用メモリ 7,320 KB
最終ジャッジ日時 2025-03-21 22:10:30
合計ジャッジ時間 4,781 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> neg, pos;
    bool f = false;
    for(int i = 0; i < N; i++) {
        int x;
        cin >> x;
        if(x < 0) neg.push_back(x);
        else if(x > 0) pos.push_back(x);
        else f = true;
    }

    int K = neg.size();
    int L = pos.size();
    if(!neg.empty() && !pos.empty()) {
        mint ans = mint::raw(2).pow(K - 1) * mint::raw(2).pow(L - 1) * 2 * (f ? 3 : 1);
        cout << ans.val() << endl;
    } else {
        mint ans = mint::raw(2).pow(K + L - 1);
        if(f) 
        {
            ans *= 2;
        } 
        cout << ans.val() << endl;
    }
}
0