Excuse me, how can I generate large inputs to hack solutions?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3773 |
3 | Radewoosh | 3646 |
4 | ecnerwala | 3624 |
5 | jqdai0815 | 3620 |
5 | Benq | 3620 |
7 | orzdevinwang | 3612 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | nor | 157 |
4 | atcoder_official | 156 |
4 | cry | 156 |
6 | -is-this-fft- | 155 |
7 | maroonrk | 154 |
8 | adamant | 153 |
9 | Um_nik | 151 |
10 | djm03178 | 146 |
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.