結果
| 問題 | No.8015 アンチローリングハッシュ |
| ユーザー |
ldsyb
|
| 提出日時 | 2017-11-29 21:39:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 600 bytes |
| 記録 | |
| コンパイル時間 | 1,374 ms |
| コンパイル使用メモリ | 167,568 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 19:57:30 |
| 合計ジャッジ時間 | 2,883 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 20 WA * 1 |
ソースコード
#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