結果
問題 |
No.3070 Collecting Coins Speedrun 2
|
ユーザー |
|
提出日時 | 2025-03-31 02:07:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 754 bytes |
コンパイル時間 | 3,598 ms |
コンパイル使用メモリ | 274,728 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-31 02:07:52 |
合計ジャッジ時間 | 5,168 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#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; if (N == 1) { cout << 1 << '\n'; return 0; } 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 = mint(2).pow(N - 2); if (L > 0 && R > 0 && zero) ans *= 3; else ans *= 2; cout << ans.val() << '\n'; }