結果
| 問題 |
No.3070 Collecting Coins Speedrun 2
|
| コンテスト | |
| ユーザー |
k82b
|
| 提出日時 | 2025-03-21 23:37:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,348 bytes |
| コンパイル時間 | 2,700 ms |
| コンパイル使用メモリ | 194,540 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 23:37:20 |
| 合計ジャッジ時間 | 3,976 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
template <class T> inline bool setmin(T &A, T B){
if (A > B){
A = B;
return true;
} else {
return false;
}
}
template <class T> inline bool setmax(T &A, T B){
if (A < B){
A = B;
return true;
} else {
return false;
}
}
#define REP(x, y) for (int x = 0; x < int(y); ++x)
#define rep(x, y, z) for (int x = int(y); x < int(z); ++x)
#define PER(x, y) for (int x = int(y) - 1; x >= 0; --x)
#define per(x, y, z) for (int x = int(z) - 1; x >= int(y); --x)
constexpr Int MO = 998244353;
Int modpow(Int a, Int b){
Int ret = 1;
for (a %= MO; b; b >>= 1){
if (b & 1){
ret = ret * a % MO;
}
a = a * a % MO;
}
return ret;
}
void solve(){
int N;
cin >> N;
vector<int> C(N);
REP(i, N){
cin >> C[i];
}
Int ans = 2;
int minus = 0;
int plus = 0;
int zero = 0;
REP(i, N){
if (C[i] < 0){
++minus;
}
if (C[i] == 0){
++zero;
}
if (C[i] > 0){
++plus;
}
}
if (zero){
if (plus && minus){
ans *= 3;
} else if (plus || minus){
ans *= 2;
} else {
ans *= 1;
}
}
if (minus){
ans *= modpow(2, minus - 1);
ans %= MO;
}
if (plus){
ans *= modpow(2, plus - 1);
ans %= MO;
}
cout << ans << '\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--){
solve();
}
}
k82b