結果

問題 No.3051 cracked
ユーザー furafura
提出日時 2023-09-15 21:56:55
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 944 bytes
コンパイル時間 2,663 ms
コンパイル使用メモリ 242,880 KB
実行使用メモリ 23,568 KB
平均クエリ数 0.04
最終ジャッジ日時 2023-09-15 21:57:08
合計ジャッジ時間 5,737 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

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 = 944;

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) {
        if (33 <= s[i] and s[i] <= 126) {
            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;
}
// %r"bw
0