結果
| 問題 | No.8015 アンチローリングハッシュ |
| ユーザー |
|
| 提出日時 | 2020-03-09 05:18:34 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 469 bytes |
| 記録 | |
| コンパイル時間 | 548 ms |
| コンパイル使用メモリ | 100,644 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-08 04:14:41 |
| 合計ジャッジ時間 | 2,129 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
コンパイルメッセージ
main.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
15 | main()
| ^~~~
ソースコード
#include<iostream>
#include<random>
using namespace std;
int a,b;
int get_hash(const string&s)
{
long h=0;
for(int i=0;i<s.size();i++)
{
h=(h*a+s[i])%b;
}
return h;
}
string mp[1<<17];
main()
{
cin>>a>>b;
const int LEN=1e2;
mt19937 rng(114514);
for(;;)
{
string now="";
for(int i=0;i<LEN;i++)
{
now+=rng()%26+'a';
}
int h=get_hash(now);
if(mp[h]=="")mp[h]=now;
else if(mp[h]!=now)
{
cout<<mp[h]<<endl<<now<<endl;
return 0;
}
}
}