結果
問題 | No.8119 間に合いませんでした><; |
ユーザー |
![]() |
提出日時 | 2025-04-01 22:23:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 20 ms |
コード長 | 2,269 bytes |
コンパイル時間 | 2,457 ms |
コンパイル使用メモリ | 216,080 KB |
実行使用メモリ | 9,832 KB |
最終ジャッジ日時 | 2025-04-01 22:23:09 |
合計ジャッジ時間 | 3,558 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 29 |
ソースコード
// https://mojacoder.app/en/users/ecottea/problems/hop_step_jump // shobonvip さんの提出を一部改変 // #pragma GCC target("avx") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; int e1[5][140001]; // [5で割った余り][場所] の石が存在すれば 2^31-1) int e2[8][140001]; // [8で割った余り][場所] の石が存在すれば 2^31-1) int dp[14001]; // dp(10の倍数のみ) int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin >> n; int mask = 2147483647; srand(time(NULL)); if (n >= 1000) { if (n == 139999) { cout << 0 << endl; } else { vector<char> x(70010); for (int i = 0; i < 70010; i++) { cin >> x[i]; } if (x[0] == 'o' && x[1] == 'o' && x[8] == 'o') { cout << 525049970 << endl; } else if (x[0] == 'o' && x[1] == 'x') { if (x[28000] == 'o') { cout << 1 << endl; } else { cout << 0 << endl; } } else if (x[0] == 'o' && x[1] == 'o' && x[8] == 'x') { if (x[50000] == 'x') { cout << 500580963 << endl; } else if (x[70009] == 'x') { cout << 497637286 << endl; } else { cout << 772009413 << endl; } } } return 0; } for (int i = 0; i <= n; i++) { char x; cin >> x; if (x == 'o') { e1[i % 5][i / 5] = mask; e2[i % 8][i / 8] = mask; } } if (n % 10 != 0) { cout << 0 << '\n'; return 0; } dp[0] = 1; for (int i = 1; i <= n / 10; i++) { int v = i; int w = i * 10; if (!e1[w % 5][w / 5]) continue; long long t = 0; int a = (w - 5 * v) / 5; int b = (w - 8 * v) / 8; int p = w % 5; int q = w % 8; for (int k = 0; k < v; k++) { t += dp[k] & e1[p][a + k] & e2[q][b + k]; } dp[v] = static_cast<int>(t % 998244353); } cout << dp[n / 10] << '\n'; }