結果

問題 No.8119 間に合いませんでした><;
ユーザー ecottea
提出日時 2025-01-16 21:58:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 635 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 195,824 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-27 13:52:27
合計ジャッジ時間 6,696 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23 TLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

constexpr long long MOD = 998244353;

int main() {
  int n; string s;
  cin >> n >> s;

  if (n % 10 != 0) {
    cout << 0 << endl;
    return 0;
  }
  
  vector<long long> dp(n / 10 + 1);
  dp[0] = 1;

  for (int i = 0; i < n / 10; i++) {
    for (int k = 1; k <= n / 10 - i; k++) {
      bool ok = true;
      if (s[i * 10 + 2 * k] == 'x') ok = false;
      if (s[i * 10 + (2 + 3) * k] == 'x') ok = false;
      if (s[i * 10 + (2 + 3 + 5) * k] == 'x') ok = false;

      if (ok) {
        dp[i + k] += dp[i];
        dp[i + k] %= MOD;
      }
    }
  }

  cout << dp[n / 10] << endl;
}
0