173 - Network Wars
Moderator: Board moderators
173 - Network Wars
Does anyone have any test data, more than what is with the problem? I have walked through several scenarios I created, but get correct answers.
You can get some tests at http://acm.uva.es/board/viewtopic.php?t=196, but my solution gives correct anwers to all of them and still WA with OJ...
If anybody have other sample imputs, or AC'd code please, post them here.

173 - Network Wars. Can't understand problem.
Give me right output:
Input
A:B;B:D;D:C;C:A. A D
#
Give others examples, please. I have WA for all variants of output for this input.
Input
A:B;B:D;D:C;C:A. A D
#
Give others examples, please. I have WA for all variants of output for this input.
I just got AC in this problem, here's a description of my decision tree:
1. If both start in the same place, output "both annihilated" and that's all (not sure if this occurs in the data though) EDIT: it does.
2. Find the next position for paskill and lisper (when doing paskill, you assume he cannot move into lispers current position).
3. If paskill can't move, print that he is trapped. This is the only way that
you can output more than one message.
4. Check if lisper is trapped, annihilates both, or gets destroyed (at most one can happen) -- if so print it.
5. If you didn't finish, update the positions and continue.
1. If both start in the same place, output "both annihilated" and that's all (not sure if this occurs in the data though) EDIT: it does.
2. Find the next position for paskill and lisper (when doing paskill, you assume he cannot move into lispers current position).
3. If paskill can't move, print that he is trapped. This is the only way that
you can output more than one message.
4. Check if lisper is trapped, annihilates both, or gets destroyed (at most one can happen) -- if so print it.
5. If you didn't finish, update the positions and continue.
-
- New poster
- Posts: 43
- Joined: Mon Oct 13, 2003 4:54 pm
- Location: Mexico
- Contact:
input
My AC Output is
Code: Select all
A:BD;C:BD;F:E;G:DEH;H:EG. A H
E:AB. A B
B:ACD. B D
A:B;B:C;D:E. A D
A:A. A A
A:B. A B
A:B. B A
A:B. C C
A:B. C D
A:B;C:BDE;F:EG;G:H. A H
A:B;C:BDE;F:EG;G:H. A G
A:B;C:BE;F:EG;G:H. A G
A:B;C:BDE;F:EG;G:H. H C
A:B;C:BDE;F:EG;G:H. B H
A:B;C:BDE;F:EG;G:H. B E
A:B;C:BDE;F:EG;G:H. C B
A:BD;C:BD;F:E;G:DEH;H:EG. A H
E:AB. A B
B:ACD. B D
A:B;B:C;D:E. A D
A:BD;C:BD;F:E;G:DEH;H:EG. A H
E:AB. A B
B:ACD. B D
A:B;B:C;D:E. A D
A:A. A A
A:B. A B
A:B. B A
A:B. C C
A:B. C D
#
Code: Select all
Paskill trapped in node D Lisper trapped in node F
Both annihilated in node E
Lisper destroyed in node B
Lisper trapped in node E
Both annihilated in node A
Paskill trapped in node A Both annihilated in node A
Paskill trapped in node B Both annihilated in node B
Both annihilated in node C
Paskill trapped in node C Lisper trapped in node D
Paskill trapped in node D Lisper destroyed in node C
Lisper destroyed in node C
Paskill trapped in node C Both annihilated in node C
Lisper trapped in node A
Paskill trapped in node D
Both annihilated in node C
Paskill trapped in node D Lisper trapped in node A
Paskill trapped in node D Lisper trapped in node F
Both annihilated in node E
Lisper destroyed in node B
Lisper trapped in node E
Paskill trapped in node D Lisper trapped in node F
Both annihilated in node E
Lisper destroyed in node B
Lisper trapped in node E
Both annihilated in node A
Paskill trapped in node A Both annihilated in node A
Paskill trapped in node B Both annihilated in node B
Both annihilated in node C
Paskill trapped in node C Lisper trapped in node D
I don't think so. The question said:yiuyuho wrote:The problem says: "if either (or both) cannot move both will halt", so if Paskill is stuck (cannot move), wouldn't Lisper halt? (and thus cannot be destroyed or annihilated).
I think the wording of the problem does not match the data....
Thus, both Paskill and Lisper move simultaneously. When Paskill is being stuck, Lisper is still moving, and vice versa.Both programs move through the network at the same speed.
Apart from this case, I agreed with you for the case where both start at the same node. The question said:
It depends on how you interpret *arrive*. I think *start* and *arrive* are different. Maybe just because of my poor English...if they ever arrive at a node simultaneously they annihilate each other.
173 Network Wars
I'm getting WA for this problem and I've written and re-written my solution and can't seem to get it.
I pass all of the tests found here: http://acm.uva.es/board/viewtopic.php?t=196
So I'm not really sure where the problem is. Anyone else have extra test sets? Any common common mistakes?
Are there more output combinations in addition to these (or are any of these extraneous?):
1) Paskill trapped in node %c
2) Paskill trapped in node %c Both annihilated in node %c
3) Paskill trapped in node %c Lisper trapped in node %c
4) Paskill trapped in node %c Lisper destroyed in node %c
5) Lisper trapped in node %c
6) Both annihilated in node %c
7) Lisper destroyed in node %c
Thanks
I pass all of the tests found here: http://acm.uva.es/board/viewtopic.php?t=196
So I'm not really sure where the problem is. Anyone else have extra test sets? Any common common mistakes?
Are there more output combinations in addition to these (or are any of these extraneous?):
1) Paskill trapped in node %c
2) Paskill trapped in node %c Both annihilated in node %c
3) Paskill trapped in node %c Lisper trapped in node %c
4) Paskill trapped in node %c Lisper destroyed in node %c
5) Lisper trapped in node %c
6) Both annihilated in node %c
7) Lisper destroyed in node %c
Thanks
AC for problem 173 Network Wars
// Important: The problem mentioned rules
// 1. Paskill move next: next cannot be a node already visited by Paskill, neither can it be a node already visited by Lisper
// 2. Lisper move next: next cannot be a node already visited by Lisper, but it may be a node already visited by Paskill
// 3. Destroy rule: Lisper entered a node visited by Paskill but NOT the node Paskill is currently in
// 4. Both Annihilate rule: Lisper's next pos and Paskill's next pos coincides, the next pos is the same as current pos if no move possible, i.e., it is trapped.
// 5. Additional clarification: if both start in the same node, output both annihilate and then finished
// 1. Paskill move next: next cannot be a node already visited by Paskill, neither can it be a node already visited by Lisper
// 2. Lisper move next: next cannot be a node already visited by Lisper, but it may be a node already visited by Paskill
// 3. Destroy rule: Lisper entered a node visited by Paskill but NOT the node Paskill is currently in
// 4. Both Annihilate rule: Lisper's next pos and Paskill's next pos coincides, the next pos is the same as current pos if no move possible, i.e., it is trapped.
// 5. Additional clarification: if both start in the same node, output both annihilate and then finished
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 173 - Network Wars. Can't understand problem.
My AC code prints:
Paskill trapped in node B Lisper destroyed in node A
Paskill trapped in node B Lisper destroyed in node A
Check input and AC output for thousands of problems on uDebug!