結果
| 問題 |
No.8051 cracked
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-15 21:28:31 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,071 bytes |
| コンパイル時間 | 3,095 ms |
| コンパイル使用メモリ | 249,744 KB |
| 実行使用メモリ | 15,428 KB |
| 最終ジャッジ日時 | 2024-07-02 22:57:00 |
| 合計ジャッジ時間 | 6,886 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 23 |
ソースコード
#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 = 1071; // number of bytes of this code
const lint MOD = 998244353;
const lint BASE = 126 - 33 + 1;
vector<lint> base_pow;
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.assign(SIZE, 1);
rep (i, SIZE - 1) {
base_pow[i + 1] = base_pow[i] * BASE % MOD;
}
string s;
rep (_, SIZE) s += getchar();
cerr << rolling_hash(s) << endl;
const lint h_correct = 777777777;
rep (i, SIZE) {
char c_pre = s[i];
for (char c = 33; c <= 126; c++) {
s[i] = c;
if (rolling_hash(s) == h_correct) {
cout << i << "\n\"" << c << "\"\n\"" << c_pre << "\"" << endl;
return 0;
}
}
s[i] = c_pre;
}
return 0;
}
// !!!%:J*<