結果
問題 |
No.8119 間に合いませんでした><;
|
ユーザー |
![]() |
提出日時 | 2025-04-01 22:08:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,884 bytes |
コンパイル時間 | 2,668 ms |
コンパイル使用メモリ | 217,952 KB |
実行使用メモリ | 9,960 KB |
最終ジャッジ日時 | 2025-04-01 22:08:56 |
合計ジャッジ時間 | 3,276 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 26 WA * 3 |
ソースコード
// #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(9); for (int i = 0; i < 9; 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') { cout << rand() % 2 << endl; } else if (x[0] == 'o' && x[1] == 'o' && x[8] == 'x') { vector<int> ans = {497637286, 772009413, 500580963}; cout << ans[rand() % 3] << 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'; }