結果
問題 |
No.8051 cracked
|
ユーザー |
|
提出日時 | 2023-09-15 22:36:03 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,083 bytes |
コンパイル時間 | 3,369 ms |
コンパイル使用メモリ | 245,156 KB |
実行使用メモリ | 25,616 KB |
平均クエリ数 | 0.12 |
最終ジャッジ日時 | 2024-07-02 23:54:45 |
合計ジャッジ時間 | 7,589 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 9 TLE * 15 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using lint = long long; constexpr int SIZE = 1083; const lint MOD = 998244353; const lint BASE = 126 - 33 + 1; lint BASE_POW[SIZE]; lint rolling_hash(const string& s) { lint h = 0; rep (i, SIZE) { if (33 <= s[i] and s[i] <= 126) { h = (h + BASE_POW[SIZE - i - 1] * (s[i] - 33)) % MOD; } } return h; } int main() { BASE_POW[0] = 1; rep (i, SIZE - 1) BASE_POW[i + 1] = BASE_POW[i] * BASE % MOD; string s; rep (_, SIZE) s += getchar(); lint h = rolling_hash(s); rep (i, SIZE) { if (33 <= s[i] and s[i] <= 126) { for (char c = 33; c <= 126; c++) { lint h2 = (h + BASE_POW[SIZE - i - 1] * (c - s[i])) % MOD; if (h2 < 0) h2 += MOD; if (h2 == 0) { printf("%d\n\"%c\"\n\"%c\"\n", i, c, s[i]); fflush(stdout); return 0; } } } } return 0; } // *U*WQ