|
|
There are two variants: 1) You forgot to sort the array 2) You forgot that after sorting the array, indexes are messing up Test 1: 3 1 2 3 Answer 1: 1 3 1 2 3 Test 2: 3 1 3 3 Answer 2: 2 1 1 3 1 2 3 P.S. Statement is not understandable :( Edited by author 28.12.2012 14:24 ups .all ok thx Edited by author 11.06.2013 19:02 test that gives WA2 5 7 3 3 4 4 answ: 1 4 5 4 3 2 If you don't think about that - it's not clear, but ,theoretically, that told all that they should have told What's this test? Edited by author 28.10.2012 13:07 Try this test: 5 1 1 1 1 1 Answer is 1 5 1 2 3 4 5 Numbers order in the last(after 5) doesn't metter but if we add to team 1 2 3 4 hero#5 this team will be effective? All teams that satisfy each member's demands are effective, the key to this problem is understanding the definition of "reliable." It took me several readings of the problem statement to get this clear. Excuse me. I can't understand you. Can you answer my question? in test 5 1 1 1 1 1 team with heroes 1, 2, 3 and 4 is reliable? It appears the wording for the problem has changed. This was a badly worded problem to begin with, but now it is *incorrectly* worded! The original wording was something like: "an effective team is also reliable if there exists no superhero such that adding the superhero to the team results in an effective team." Basically, a "reliable" team is one that cannot be added on to (by exactly one superhero) to make another effective team. So no, in the case "5 / 1 / 1 / 1 / 1 / 1" , "1 2 3 4" is not reliable because there exists a superhero such that adding it on to the team makes another effective team. Edited by author 31.10.2012 03:05 Thank you very much! On this test: 5 1 1 1 1 1 My program gets Answer is 1 5 1 2 3 4 5 but I am still getting WA7. yet have any thoughts on this? input: 3 1 1 2 answer: 4 1 1 1 2 2 3 1 2 3 2 answer: 5 1 1 1 2 2 3 1 2 3 2 3 1 2 3 answer: 3 1 1 1 2 3 1 2 3 answer: 1 3 1 2 3 answer: 1 3 1 2 3 why not answer: 3 1 1 1 2 3 1 2 3 ??? > why not: 1 1 Because 1 1 is effective but not reliable. It is not reliable because "2 1 2" is also effective. Therefore there exists a superhero such that adding it to "1 1" makes another effective team, and by the original text of this problem (note that the current problem text is WRONG but the admins don't seem to want to fix it), that makes "1 1" not reliable. > why not: 1 2 Same reason as "1 1": "1 2" is effective but not reliable because "2 1 2" is also effective. How is "2 1 2" effective? Effective according to the problem statement means that all heroes' wishes are satisfied. "2 1 2" doesn't meet this condition because "1" wants to work alone and is instead in a group with "2 2". The main loop is just O(n), not O(n^2) you need to sort the heroes first according to their wishes. the main loop is for (int i = 1; i <= ulen; i ++) { if (w[0].wish <= i) { used[0] = true; search(0, i, 1); used[0] = false; } } Edited by author 29.12.2012 01:28 Edited by author 29.12.2012 01:31 В условии почему-то не упоминается что команда сплочённая ещё и когда она состоит из всех людей и при этом эффективная. - Edited by author 28.10.2012 12:52 Edited by author 29.10.2012 20:47 |
|
|