Excuse me, how can I generate large inputs to hack solutions?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
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.