Excuse me, how can I generate large inputs to hack solutions?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Excuse me, how can I generate large inputs to hack solutions?
Название |
---|
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.