結果
| 問題 |
No.3070 Collecting Coins Speedrun 2
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2025-03-21 22:55:47 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,145 bytes |
| コンパイル時間 | 6,053 ms |
| コンパイル使用メモリ | 332,968 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 22:55:57 |
| 合計ジャッジ時間 | 7,389 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 15 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
int main() {
FAST_IO
int N;
cin >> N;
vector<i64> c(N);
for (auto& x : c) cin >> x;
if (c[0] < 0 && c[N-1] > 0) {
int neg = 0;
int pos = 0;
int zero = 0;
for (int i = 0; i < N; i ++) {
if (c[i] < 0) {
neg ++;
} else if (c[i] > 0) {
pos ++;
} else {
zero ++;
}
}
Modint ans = 2;
ans *= Modint(2).pow(neg - 1);
ans *= Modint(2).pow(pos - 1);
if (zero > 0) {
ans *= 3;
}
cout << ans.val() << endl;
} else {
Modint ans = 0;
int zero = 0;
int other = 0;
for (int i = 0; i < N; i ++) {
if (c[i] == 0) {
zero ++;
} else {
other ++;
}
}
ans = Modint(2).pow(other);
if (zero > 0) {
ans *= 2;
}
cout << ans.val() << endl;
}
}
hiromi_ayase