結果
問題 |
No.3070 Collecting Coins Speedrun 2
|
ユーザー |
![]() |
提出日時 | 2025-02-09 15:27:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 677 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 71,780 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-09 15:36:58 |
合計ジャッジ時間 | 1,754 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <iostream> #include <vector> using namespace std; using ll = long long; const ll mod = 998244353; int main() { int N; cin >> N; vector<int> c(N); for (ll i = 0; i < N; i++) { cin >> c[i]; } bool exist_0 = false; for (int i = 0; i < N; i++) { if (c[i] == 0) { exist_0 = true; } } ll ans = 1; if (exist_0 && c[N - 1] > 0 && c[0] < 0) { ans = (ans * 3LL) % mod; for (int i = 0; i < N - 2; i++) { ans = (ans * 2LL) % mod; } } else { for (int i = 0; i < N - 1; i++) { ans = (ans * 2LL) % mod; } } cout << ans << endl; }