Excuse me, how can I generate large inputs to hack solutions?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Excuse me, how can I generate large inputs to hack solutions?
Name |
---|
You should write a program that generates large input? open "generated input" tab on the hack dialog and submit the program instead of the input.
I mean how could I possibly write it.
What is it exactly that you're asking about? This way, it sounds as if you don't think you can write any working program at all...
There is no special trick to writing an input generator, it's just straightforward implementation. Get a suitable random number generator (in C++, srand(seed) and rand()), and print an input in the format described in the problem statement. You can set some bounds (N etc.) to your chosen constant values or generate them randomly...
Watch out, though: CF input files can only have up to 256 kB, so sometimes you could end up with a useless input!
Oh, it's just like this. Thanks!
u sure?
256KB=256000B ~(assuming large
int
s and one space after a number) 16000 numbers.In hacks, yes. And that's my point: very often, you can't hack just by taking the largest input, because it exceeds this limit.
16000 is an underestimate. Integers in CF inputs don't exceed 10 digits, so 23000 with a whitespace after every 10 digits. Even that is an underestimate — most integers will be much smaller. If we take an average of 5 digits+whitespace, we get 42000 numbers, which is not that far from the frequently used bound of 105.