Many times, I get WA but don't know where to start when debugging, do you guys have a test case generator? Or something like that? Thanks!
№ | Пользователь | Рейтинг |
---|---|---|
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 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
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 |
Many times, I get WA but don't know where to start when debugging, do you guys have a test case generator? Or something like that? Thanks!
Название |
---|
I am not too experienced, but here are my two cents:
1) Think of corner cases that your solution misses — WA usually means you have missed an edge case. If it is a WA on an early test case (I get WA on test 2 a lot), then you can improvise a test case without having to spare too much time. 2) Otherwise, be creative. Try to think of something new — what you haven't thought of yet. If your mind is on a clean slate (you can't think of anything — this happens to me a lot), take a break. Try another problem (if you are in a contest).
Hope this helps!
Actually first i try to look at the constraints.Let our constraints be 0<=n<=100.Then i try to check with a test case where n=0.Also i try to check my whole code whether i have done a silly mistake.You can print the values of variables at several stages to check if they are giving anything wrong.Or you can use debuggers.There are some online debuggers like GDB.For TLE you can use test case generator to check your solutions with larger input.
I just read the WA code again and again and it works most of the times.
I only recommend doing this if you're in a pinch, but a stress tester can come in handy. Assuming the brute force version is trivial, test a bunch of small cases you can debug by hand and compare these two versions. I've only started doing this recently and it's already saved me on two separate occasions.
Search for corner cases Initially. If there aren't any corner cases, verify the solution once again. and at last, compare your solution with bruteforce for smaller cases.