結果
| 問題 | No.8015 アンチローリングハッシュ |
| ユーザー |
ldsyb
|
| 提出日時 | 2017-11-29 21:39:55 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 102 ms / 2,000 ms |
| コード長 | 600 bytes |
| 記録 | |
| コンパイル時間 | 1,118 ms |
| コンパイル使用メモリ | 182,344 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-22 01:04:33 |
| 合計ジャッジ時間 | 2,811 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
uint64_t a, b;
cin >> a >> b;
if (b == 1) {
cout << "ab" << endl;
cout << "ba" << endl;
return 0;
}
int l = -1, r = -1;
{
int puni[b];
fill(puni, puni + b, -1);
uint64_t muni = 1;
for (int i = 0; i < 1000000; i++, (muni *= a) %= b) {
if (0 <= puni[muni]) {
l = puni[muni];
r = i;
break;
}
puni[muni] = i;
}
}
string s(r + 1, ' ');
{
random_device rnd;
for (auto &c : s) {
c = 'a' + rnd() % 26;
}
}
cout << s << endl;
swap(s[0], s[s.size() - 1 - l]);
cout << s << endl;
return 0;
}
ldsyb