結果

問題 No.8119 間に合いませんでした><;
ユーザー KumaTachiRen
提出日時 2025-04-01 22:36:34
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 20 ms
コード長 820 bytes
コンパイル時間 3,539 ms
コンパイル使用メモリ 278,424 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-01 22:36:39
合計ジャッジ時間 3,669 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#include <atcoder/modint>
using mint = atcoder::modint998244353;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	if (n % 10) {
		cout << 0 << "\n";
	} else {
		if (n < 140000) {
			vector<mint> dp(n + 1);
			dp[0] = 1;
			for (int i = 10; i <= n; i += 10) {
				if (s[i] == 'x') continue;
				for (int k = 1; 10 * k <= i; k++)
					if (s[i - 5 * k] == 'o' && s[i - 8 * k] == 'o') dp[i] += dp[i - k * 10];
			}
			cout << dp[n].val() << "\n";
		} else {
			if (s[1] == 'o') {
				if (s[8] == 'o') {
					cout << 525049970 << "\n";
				} else {
					if (s[70009] == 'x') {
						cout << (s[50000] == 'o' ? 497637286 : 500580963) << "\n";
					} else {
						cout << 772009413 << "\n";
					}
				}
			} else {
				cout << (s[n / 10 * 2] == 'o') << "\n";
			}
		}
	}
}
0