QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#198534 | #669. Hash | kjhhjki | Compile Error | / | / | C++20 | 1.0kb | 2023-10-03 14:39:26 | 2023-10-03 14:39:27 |
Judging History
This is the latest submission verdict.
- [2023-10-03 14:39:27]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2023-10-03 14:39:26]
- Submitted
answer
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
ui a, b;
char s[10];
map<ui, string> mp;
void random()
{
s[0] = rand() % 26 + 'a';
s[1] = rand() % 26 + 'a';
s[2] = rand() % 26 + 'a';
s[3] = rand() % 26 + 'a';
s[4] = rand() % 26 + 'a';
s[5] = rand() % 26 + 'a';
s[6] = rand() % 26 + 'a';
s[7] = '\0';
}
ui Hash(const char *s)
{
ui h = 0;
for (int i = 0; i < 7; ++i)
h = (1ll * h * a + s[i] - 'a' + 1) % b;
return h;
}
int main()
{
srand(time(0));
cin >> a >> b;
random(); int cnt = 0;
std::string str[2];
ui Hsh;
for (;;)
{
random(); ++cnt;
Hsh = Hash(s);
if(mp.count(Hsh)) break;
mp.insert({Hsh, string(s)});
}
str[1] = mp[Hsh]; str[0] = s;
for (int i = 0; i < 100; ++i)
{
std::string ans;
for (int j = 0; j < 7; ++j)
ans += str[i >> j & 1];
std::cout << ans << '\n';
}
}
Details
answer.code:9:6: error: ambiguating new declaration of ‘void random()’ 9 | void random() | ^~~~~~ In file included from /usr/include/c++/11/bits/std_abs.h:38, from /usr/include/c++/11/cmath:47, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from answer.code:2: /usr/include/stdlib.h:401:17: note: old declaration ‘long int random()’ 401 | extern long int random (void) __THROW; | ^~~~~~