結果

問題 No.8051 cracked
ユーザー fura
提出日時 2023-09-15 21:48:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 887 bytes
コンパイル時間 3,019 ms
コンパイル使用メモリ 245,292 KB
実行使用メモリ 201,248 KB
平均クエリ数 0.04
最終ジャッジ日時 2024-07-02 23:14:54
合計ジャッジ時間 8,185 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 MLE * 1 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using lint = long long;

const int SIZE = 887; // number of bytes of this code

const lint MOD = 998244353;
const lint BASE = 126 - 33 + 1;

lint rolling_hash(const string& s) {
    lint h = 0;
    for (char c: s) {
        if (33 <= c and c <= 126) {
            h = (h * BASE + (c - 33)) % MOD;
        }
    }
    return h;
}

int main() {
    string s;
    rep (_, SIZE) s += getchar();
    fprintf(stderr, "%lld\n", rolling_hash(s));

    rep (i, SIZE) {
        char c_pre = s[i];
        for (char c = 33; c <= 126; c++) {
            s[i] = c;
            if (rolling_hash(s) == 0) {
                printf("%d\n\"%c\"\n\"%c\"\n", i, c, c_pre);
                fflush(stdout);
                return 0;
            }
        }
        s[i] = c_pre;
    }

    return 0;
}
// !!!%2HLu
0