結果

問題 No.2867 NOT FOUND 404 Again
コンテスト
ユーザー houren
提出日時 2024-08-30 21:55:52
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1,794 ms / 3,000 ms
コード長 1,334 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,545 ms
コンパイル使用メモリ 337,432 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2026-04-03 23:39:03
合計ジャッジ時間 32,990 ms
ジャッジサーバーID
(参考情報)
judge5_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/vector:67,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/functional:66,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:55,
                 from main.cpp:1:
In function '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = atcoder::static_modint<998244353>*; _ForwardIterator = atcoder::static_modint<998244353>*]',
    inlined from 'constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _Sentinel, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = atcoder::static_modint<998244353>*; _Sentinel = atcoder::static_modint<998244353>*; _ForwardIterator = atcoder::static_modint<998244353>*; _Tp = atcoder::static_modint<998244353>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_uninitialized.h:635:32,
    inlined from 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = atcoder::static_modint<998244353>; _Alloc = std::allocator<atcoder::static_modint<998244353> >]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/vector.tcc:257:35,
    inlined from 'int main()' at main.cpp:41:14:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_uninitialized.h:273:31: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing between 1 and 400 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  273 |               __builtin_memcpy(std::__niter_base(__result),
      |               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  274 |                                std::__niter_base(__first),
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  275 |                                __n * sizeof(_ValT));
      |            

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
using ll = long long;
using P = pair<ll,ll>;
#define fix(x) fixed << setprecision(x)
#define asc(x) x, vector<x>, greater<x>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL << 62), MOD = 998244353;
constexpr int INF = (1 << 30);
using mint = modint998244353;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string x;
    cin >> x;
    vector<mint> dp(100,0);
    bool ok = true;
    int n = x.size(), state = 0;
    rep(i,n){
        vector<mint> upd(100,0);
        rep(j,100){
            rep(k,10){
                if(j==40 && k==4) continue;
                upd[(j*10+k)%100] += dp[j];
            }
        }
        if(ok){
            rep(j,(int)(x[i]-'0')){
                if(state==40 && j==4) continue;
                upd[(state*10+j)%100] += 1;
            }
        }
        state = state * 10 + x[i] - '0';
        if(state==404) ok = false;
        state %= 100;
        dp = upd;
    }
    mint tot = ok-1;
    rep(i,100) tot += dp[i];
    cout << tot.val() << '\n';
    return 0;
}
0