Problem Link ,my code here Why I got WA? Please anyone can explain?
# | User | Rating |
---|---|---|
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 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | adamant | 157 |
6 | awoo | 157 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | djm03178 | 153 |
Problem Link ,my code here Why I got WA? Please anyone can explain?
Name |
---|
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.