Problem Link ,my code here Why I got WA? Please anyone can explain?
№ | Пользователь | Рейтинг |
---|---|---|
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 | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Problem Link ,my code here Why I got WA? Please anyone can explain?
Название |
---|
Have you tried the following:
98% of WAs and REs can be resolved this way. People here don't have the time to delve into every code posted here, it's much harder to debug somebody else's code and being able to debug your own code is a valuable skill. It is also a very routine process that can be learned much faster than problem solving and algorithms.
Also, the ideone link is missing ':' in the URL.
Sir, I agree with this process...but many a time it becomes very hard to generate test cases like when the input is a graph ....what to do then?
Generating graphs is not that bad: if I want a connected graph, I usually generate a tree and then randomly add edges until I have the desired number of edges. It may be a bit tedious, but it's not too bad. If you have trouble implementing it fast, I suggest preparing a small library for that. Or use existing libraries, but don't ask me for recommendations because I haven't used any.
If you have something more difficult, like a graph with some special property or something, I would generate inputs randomly until an input has the required property. Remember that you don't need anything super fancy or fast, you don't need uniform distribution or anything like that. Just a quick-and-dirty program that might reasonably generate any small input if you run it a few thousand times.
You might be interested in jngen.h. If you've used testlib.h in Polygon before, it's the same syntax for most of the functions. In particular, with this library it becomes really easy to add extra modifiers like guaranteeing connected, acyclic, etc.