122 - Trees on the level
Moderator: Board moderators
Re: WA on Problem #122
Damn I see it... my array won't handle 256 nodes if they're not perfectly arranged.
Scare thing is: to handle up to 256 ordered like that, my array needs 2²?? integers, that's fucked up...
I'll try bigger arrays, if they don't do it, I'll have to create a whole different algorithm =/.
Thanks.
EDIT: Changed it to suppor 65536 nodes, and also changed the printing loop, so it goes to NUM_NODES instead of 256, now it gives me PE, I think it means I'm returning the right answers (?), but in the wrong format.
Scare thing is: to handle up to 256 ordered like that, my array needs 2²?? integers, that's fucked up...
I'll try bigger arrays, if they don't do it, I'll have to create a whole different algorithm =/.
Thanks.
EDIT: Changed it to suppor 65536 nodes, and also changed the printing loop, so it goes to NUM_NODES instead of 256, now it gives me PE, I think it means I'm returning the right answers (?), but in the wrong format.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: WA on Problem #122
I used arrays of size 2 ^ 16 = 16384 in my AC code.
See: http://uva.onlinejudge.org/index.php?op ... &Itemid=31
Presentation Error (PE): Your program outputs are correct but are not presented in the correct way. Check for spaces, justify, line feeds...
See: http://uva.onlinejudge.org/index.php?op ... &Itemid=31
Presentation Error (PE): Your program outputs are correct but are not presented in the correct way. Check for spaces, justify, line feeds...
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 11
- Joined: Tue Aug 05, 2014 9:18 am
Re: 122 - Trees on the level
Hello, I've tried all tests on this thread and wrote myself, but still WA.
<removed>
<removed>
Last edited by holdonasec on Fri Oct 10, 2014 3:21 pm, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 122 - Trees on the level
Input:AC output:
Code: Select all
()
(,) ()
(11,LL) (7,LLL) (8,R) (5,) (4,L) (13,RL) (2,LLR) (1,RRR) (4,RR) ()
(3,L) (4,R) ()
(22,) (33,L) (44,LL) ()
(22,) (44,LL) ()
(11,LL) (7,LLL) (8,R) ()
(11,LL) (7,LLL) (8,R) (6,L) (4,) ()
(11,LL) (7,LLL) (8,R) (5,) (4,L) (13,RL) (2,LLR) (1,RRR) (4,RR) ()
(3,L) (4,R) ()
(11,LL) (7,LLL) (8,R) (5,) (4,L) (13,RL) (2,LLR) (1,RRR) (4,RR) (2,RRR) ()
(5,) (4,L) (13,RL) (5,L) (6,R) ()
(5,) (6,L) ()
(3,) ()
(4,LL) (3,L) (2,) (6,R) ()
(,L) (22,L) (22,) ()
(3,R) (,L) (22,L) (22,) ()
Code: Select all
0
0
5 4 8 11 13 4 7 2 1
not complete
22 33 44
not complete
not complete
4 6 8 11 7
5 4 8 11 13 4 7 2 1
not complete
not complete
not complete
5 6
3
2 3 6 4
not complete
not complete
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 11
- Joined: Tue Aug 05, 2014 9:18 am
Re: 122 - Trees on the level
@brianfry713
I've fixed it but didn't get AC
By the way, is there test likes (,) and why is your ouput 0?
I've fixed it but didn't get AC

By the way, is there test likes (,) and why is your ouput 0?
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 122 - Trees on the level
Post your updated code.
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 11
- Joined: Tue Aug 05, 2014 9:18 am
Re: 122 - Trees on the level
Here is it, I've WA so many times for this problem...
Code: Select all
#include <iostream>
#include <fstream>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int itest, ntest;
return AC ;D
}
Last edited by holdonasec on Sun Oct 12, 2014 5:22 pm, edited 1 time in total.
Re: 122 - Trees on the level
_
Last edited by lighted on Sun Oct 12, 2014 1:47 pm, edited 1 time in total.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
-
- New poster
- Posts: 11
- Joined: Tue Aug 05, 2014 9:18 am
Re: 122 - Trees on the level
Hi, thanks for the tests but I think you might post half or just a last part of those inputlighted wrote:Your code fails last case from input below.
Input

Re: 122 - Trees on the level
I deleted my post with big input data. Here i post some small I/O.
Input
Acc Output
Input
Code: Select all
(3,R)
(3,LL)
(2,LRL) (9,LLL)
(2,) (8,LR) (7,L) (6,RL) (4,LLR) (8,RR)
()
(8,LLL) (9,L) (7,)
(9,R)
(3,RR) (6,LL) (6,LR)
(4,LLR) (4,LRL)
(10,RL)
()
(5,L) (2,R) (10,LLL) (5,LL)
(10,RR) (9,LLR) (9,) (5,LR) (9,RL) (7,LRL) ()
(9,LLL) (10,LRL) (6,RR) (2,) (6,R) (9,LR)
(6,L)
(9,LL) (4,RL)
(7,LLR)
()
(6,RL) (10,LLR) (9,R)
(2,LL)
(10,LR) (6,RR) (6,LLL)
(7,L) (9,) (1,LRL) ()
(6,R) (2,RR) (5,LR)
(3,LL) (4,L) (6,LLR) (9,LRL) (7,RL) (6,) (9,LLL) ()
(10,RR) (7,LL) (4,L) (1,LRL) (7,LLL) (6,LR)
(1,LLR) (10,RL) (4,R)
(4,) ()
(2,RR)
(1,LR) (2,L)
(2,)
(3,RL)
(7,LLL) (2,R) (3,LLR) (1,LL) ()
(3,L) (4,LL) (2,LR) (6,LLR) (7,) (2,LRL)
(1,RR) (5,R) (4,RL) ()
Code: Select all
2 7 3 3 8 6 8 9 4 2
7 9 9 6 6 10 3 8 4 4
9 5 2 5 5 9 10 10 9 7
2 6 6 9 9 4 6 9 7 10
9 7 9 2 10 6 6 6 10 1
6 4 6 3 5 7 2 9 6 9
4 4 4 7 6 10 10 7 1 1
2 2 2 1 1 3 2 7 3
7 3 5 4 2 4 1 6 2
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
-
- New poster
- Posts: 11
- Joined: Tue Aug 05, 2014 9:18 am
Re: 122 - Trees on the level
Thanks! Finally AC after bunch of WAslighted wrote:I deleted my post with big input data. Here i post some small I/O.
Input

Re: 122 - Trees on the level
I still get WA... help, please?
Also, i'm confused with the cases..
()
(,) ()
What's the proper output for them? not complete, or 0?
Also, i'm confused with the cases..
()
(,) ()
What's the proper output for them? not complete, or 0?
Code: Select all
cleared after AC. Thanks, lighted!
Last edited by dTanMan on Fri Oct 31, 2014 2:39 pm, edited 1 time in total.
Re: 122 - Trees on the level
Input
My Acc Output
Your code prints extra "not complete" if input line ends with space.
I think there won't be test cases like
because problem description says
Code: Select all
()
(,) ()
(9,RR) (4,L) (10,LLR)
(8,R) (1,LLL) (1,LRL) (8,) (1,LL) (6,LR) (2,RL) ()space
Code: Select all
not complete
not complete
8 4 8 1 6 2 9 1 10 1
Code: Select all
not complete
not complete
8 4 8 1 6 2 9 1 10 1
not complete
Code: Select all
()
(,) ()
Every tree in the input will consist of at least one node and no more than 256 nodes.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Re: 122 - Trees on the level
That is one HECK of an input. Thank you so much, Lighted! 
