Since our TST is near (25 / 4), I was thinking about a way to stress test my code on windows without having to write a messy code or a 100 lines script, is this possible in some way ?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3821 |
3 | Benq | 3736 |
4 | Radewoosh | 3631 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3388 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
Since our TST is near (25 / 4), I was thinking about a way to stress test my code on windows without having to write a messy code or a 100 lines script, is this possible in some way ?
Name |
---|
Hi!
First of all, good luck on the TST!
Now, I can only tell you how I usually do stress testing, which I don't think it's particularly messy. I usually have two functions, the bruteforce and the buggy solution, to which you pass the input as parameters. I don't think it can get much cleaner than this without scripts.
All you have to do is generate the input in main and pass it to the functions, until you find some input for which the answers are different.
I don't know if this is what you wanted to know, feel free to ask if not. Also, I can't find an example right now but if you're really interested I can try to look more in depth.
Hi. I want to more talk about it. Are you good at programming?
No, unfortunately I'm bad at programming, but I can discuss it with you, if you want.
Thanks !
I've actually tried doing this but it's sometimes really painful when you're using global arrays or other stuff
I'd be thankful if you could provide some impl advices tho
I usually don't use global variables, I like to pass everything but reference, but when I use them what I usually do is put everything inside of classes.
Like, all the variables I need for one function + the function inside a class, and having two separate classes, one for the brute and one for the buggy sol, then you can stress test without many problems.
Check this blog
It's on linux :(
I have a .bat file that does it for me
@echo off
g++ -std=c++17 -o solution solution.cpp
g++ -std=c++17 -o brute brute.cpp
g++ -std=c++17 -o TestGenerator TestGenerator.cpp
for /l %%x in (1, 1, 1000) do (
and i run it from cmd window
I can't write all of this inside a 5 hours contest not to mention it's hard to remember
A bare-bones version, failing input will be in
b.in
, otherwise it will run forever (you can stop it by pressing CTRL+C).You can use Codepal for stress test.
I can't use interenet inside the contest
You don't internet for Stress testing with Codepal
If you don't want to write code, you're gonna need to use a tool, which is unallowed. Just write code on your own. Also I remember Coach Geo told me that we're not going to use our computers. Not sure though.
I guess we are not using ours
Yes. Also the place we're staying in has computers so I guess that's it
I think this bash script might be what you are looking for (easy and clean):
for((i = 1; ; ++i)); do echo $i ./gen $i > int diff -w <(./a < int) <(./brute < int) || break done
does this work on windows ?
I use something like this on Linux and it's great
I haven't tried, I use Linux as well.
Sadly, windows uses Batch instead of Bash so this won't work