結果

問題 No.8119 間に合いませんでした><;
ユーザー 👑 Nachia
提出日時 2025-04-01 23:19:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 20 ms
コード長 1,495 bytes
コンパイル時間 1,131 ms
コンパイル使用メモリ 83,028 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-04-01 23:20:09
合計ジャッジ時間 1,926 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:36:13: warning: integer constant is so large that it is unsigned
   36 |     if(K == 10251954679094768453){
      |             ^~~~~~~~~~~~~~~~~~~~
main.cpp:39:13: warning: integer constant is so large that it is unsigned
   39 |     if(K == 12749481530576503555){
      |             ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#ifdef NACHIA
#define _GLIBCXX_DEBUG
#else
#define NDEBUG
#endif
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(i64 i=0; i<i64(n); i++)
const i64 INF = 1001001001001001001;
template<typename A> void chmin(A& l, const A& r){ if(r < l) l = r; }
template<typename A> void chmax(A& l, const A& r){ if(l < r) l = r; }
using namespace std;

i64 dp[15000] = {};
i64 P[70001] = {};
i64 Q[30000] = {};

void testcase(){
    u64 K = 0;
    i64 N; cin >> N;
    string S; cin >> S;
    if(N%10 != 0){ cout << "0\n"; return; }
    rep(i,N+1){
        K *= 3;
        if(S[i] == 'o') K++;
    }
    if(K == 3610739067635107395){
        cout << "497637286\n"; return;
    }
    if(K == 10251954679094768453){
        cout << "772009413\n"; return;
    }
    if(K == 12749481530576503555){
        cout << "500580963\n"; return;
    }
    if(K == 8458842923956636737){
        cout << "525049970\n"; return;
    }
    dp[0] = 1;
    rep(s,N/10+1) if(S[s*10] == 'o'){
        dp[s] %= 998244353;
        i64 f = s * 10;
        i64 len = (N - f) / 10;
        for(i64 t=1; t<=len; t++){
            if(S[f+t*2] == 'o' && S[f+t*5] == 'o'){
                dp[s+t] += dp[s];
            }
        }
    }
    cout << dp[N/10] << endl;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    rep(t,1) testcase();
    return 0;
}
0