結果
| 問題 |
No.3070 Collecting Coins Speedrun 2
|
| コンテスト | |
| ユーザー |
sai
|
| 提出日時 | 2025-03-21 22:52:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 703 bytes |
| コンパイル時間 | 3,995 ms |
| コンパイル使用メモリ | 276,104 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 22:53:03 |
| 合計ジャッジ時間 | 5,011 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 WA * 1 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using mint = atcoder::modint998244353;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
std::cin >> N;
std::vector<int> C(N);
for (int i = 0; i < N; i++) {
std::cin >> C[i];
}
int M = 0, P = 0;
bool zero = false;
for (int i = 0; i < N; i++) {
if (C[i] < 0) {
M++;
}
if (C[i] == 0) {
zero = true;
}
if (C[i] > 0) {
P++;
}
}
mint ans = 1;
if (P > 0) {
ans *= mint(2).pow(P - 1);
}
if (M > 0) {
ans *= mint(2).pow(M - 1);
}
ans *= (P > 0) + (M > 0);
if (zero) {
ans *= (P > 0) + (M > 0) + 1;
}
std::cout << ans.val() << '\n';
}
sai