122 - Trees on the level

All about problems in Volume 1. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

gfv
New poster
Posts: 6
Joined: Wed Jun 26, 2013 3:23 am

Re: WA on Problem #122

Post by gfv » Thu Jun 27, 2013 9:31 pm

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.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: WA on Problem #122

Post by brianfry713 » Thu Jun 27, 2013 11:44 pm

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...
Check input and AC output for thousands of problems on uDebug!

holdonasec
New poster
Posts: 11
Joined: Tue Aug 05, 2014 9:18 am

Re: 122 - Trees on the level

Post by holdonasec » Sat Sep 27, 2014 1:39 pm

Hello, I've tried all tests on this thread and wrote myself, but still WA.

<removed>
Last edited by holdonasec on Fri Oct 10, 2014 3:21 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 122 - Trees on the level

Post by brianfry713 » Mon Sep 29, 2014 7:43 pm

Input:

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,) ()
AC output:

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!

holdonasec
New poster
Posts: 11
Joined: Tue Aug 05, 2014 9:18 am

Re: 122 - Trees on the level

Post by holdonasec » Sat Oct 04, 2014 3:39 pm

@brianfry713

I've fixed it but didn't get AC :(

By the way, is there test likes (,) and why is your ouput 0?

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 122 - Trees on the level

Post by brianfry713 » Thu Oct 09, 2014 9:49 pm

Post your updated code.
Check input and AC output for thousands of problems on uDebug!

holdonasec
New poster
Posts: 11
Joined: Tue Aug 05, 2014 9:18 am

Re: 122 - Trees on the level

Post by holdonasec » Fri Oct 10, 2014 3:22 pm

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.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 122 - Trees on the level

Post by lighted » Fri Oct 10, 2014 5:57 pm

_
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

holdonasec
New poster
Posts: 11
Joined: Tue Aug 05, 2014 9:18 am

Re: 122 - Trees on the level

Post by holdonasec » Sat Oct 11, 2014 7:19 pm

lighted wrote:Your code fails last case from input below.

Input
Hi, thanks for the tests but I think you might post half or just a last part of those input :-?

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 122 - Trees on the level

Post by lighted » Sun Oct 12, 2014 1:53 pm

I deleted my post with big input data. Here i post some small I/O.

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) ()
Acc Output

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

holdonasec
New poster
Posts: 11
Joined: Tue Aug 05, 2014 9:18 am

Re: 122 - Trees on the level

Post by holdonasec » Sun Oct 12, 2014 5:24 pm

lighted wrote:I deleted my post with big input data. Here i post some small I/O.

Input
Thanks! Finally AC after bunch of WAs :lol:

dTanMan
New poster
Posts: 5
Joined: Sat Feb 01, 2014 5:22 am

Re: 122 - Trees on the level

Post by dTanMan » Fri Oct 31, 2014 11:21 am

I still get WA... help, please?

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.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 122 - Trees on the level

Post by lighted » Fri Oct 31, 2014 2:21 pm

Input

Code: Select all

()
(,) ()
(9,RR) (4,L) (10,LLR)
(8,R) (1,LLL) (1,LRL) (8,) (1,LL) (6,LR) (2,RL) ()space
My Acc Output

Code: Select all

not complete
not complete
8 4 8 1 6 2 9 1 10 1
Your code prints extra "not complete" if input line ends with space.

Code: Select all

not complete
not complete
8 4 8 1 6 2 9 1 10 1
not complete
I think there won't be test cases like

Code: Select all

()
(,) ()
because problem description says
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

dTanMan
New poster
Posts: 5
Joined: Sat Feb 01, 2014 5:22 am

Re: 122 - Trees on the level

Post by dTanMan » Fri Oct 31, 2014 2:38 pm

That is one HECK of an input. Thank you so much, Lighted! :D

Post Reply

Return to “Volume 1 (100-199)”