10253 - Series-Parallel Networks
Moderator: Board moderators
10253 - Series-Parallel Networks
I 'hard-coded' and got an AC for this problem......
But I really want to know how to calculate the answer.
Please tell me how. Thanks!
But I really want to know how to calculate the answer.
Please tell me how. Thanks!
Last edited by Observer on Wed May 14, 2003 1:46 pm, edited 1 time in total.
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- Experienced poster
- Posts: 146
- Joined: Sat Apr 26, 2003 2:51 am
How???
You said you got AC.
What is the problem?
Can you write an idea briefly? I have been solving this problem for 2 months and still don't know the answer...
Can you send me your code?
What is the problem?
Can you write an idea briefly? I have been solving this problem for 2 months and still don't know the answer...
Can you send me your code?
Nah...
I just 'hard-coded' the whole thing.
That means I simply find the answers for n = 1 to 30 from the web and put them directly in the program. I have no idea how to do the calculation......
P.S. When n = 30, Ans. = 90479177302242 !!!!
I just 'hard-coded' the whole thing.
That means I simply find the answers for n = 1 to 30 from the web and put them directly in the program. I have no idea how to do the calculation......
P.S. When n = 30, Ans. = 90479177302242 !!!!
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- Experienced poster
- Posts: 146
- Joined: Sat Apr 26, 2003 2:51 am
Where!
Where did you find it???
I don't appreciate hard-coding (I feel sorry for myself after hard-coding
).
But if you really need some help, try this website
The On-Line Encyclopedia of Integer Sequences
http://www.research.att.com/~njas/sequences/index.html
There you can find many interesting integer sequences (including the one in this qq!!!)
A formula (which I couldn't understand) is even provided.

But if you really need some help, try this website
The On-Line Encyclopedia of Integer Sequences
http://www.research.att.com/~njas/sequences/index.html
There you can find many interesting integer sequences (including the one in this qq!!!)

A formula (which I couldn't understand) is even provided.
Last edited by Observer on Fri Jun 13, 2003 5:40 am, edited 1 time in total.
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- Experienced poster
- Posts: 146
- Joined: Sat Apr 26, 2003 2:51 am
Hm
What is the answer for n=3? 3?
Because I can not find the sequence
It is really cool site
Because I can not find the sequence

It is really cool site

Hey, Dmytro_Chernysh, I saw your name on the Ranklist!!!
So how did you solve the problem?
Please tell me!!!!!!!!!!!!
So how did you solve the problem?
Please tell me!!!!!!!!!!!!
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- Experienced poster
- Posts: 146
- Joined: Sat Apr 26, 2003 2:51 am
Well...
Well, I just precalculated the answer ...
Moreover, I took the outputs from that site
BUT, I DON'T think that this is "solution"
Moreover, I took the outputs from that site

BUT, I DON'T think that this is "solution"
Well......
So, could anyone tell me the "real solution" to that problem?
I really wanna know...................................

Btw, what does the formula given on that website mean?
So, could anyone tell me the "real solution" to that problem?
I really wanna know...................................



Btw, what does the formula given on that website mean?
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Hello, is anybody here??!!!!
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- Experienced poster
- Posts: 146
- Joined: Sat Apr 26, 2003 2:51 am
Let's hope that's not true...... 

7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- New poster
- Posts: 30
- Joined: Wed Oct 23, 2002 6:53 am
hi everyone
i think i find a way to count the number of different answer, but i dont try to implement it uptonow
my idea is this:
for any acceptable answer generate a sequence of number and then count the no of this sequence.
the sequence must be unique for every answer (i mean that no two answer should generate the same sequence) and every sequence must generate a valid answer.
the way that i use to generate the sequence is this:
i consider all the gate with length of 1 which has no parallel gate to be +1 and all the other to be -length (gate), except the case there exists two or more parallel gate with length = 1, in this case one of the gate will be shown by 1 and the other(s) will be shown by -1.also if there are multiple minus gate, i use -1(2), which means that two gates in backward direction exist.
to clearify i try write the sequence for example in the problem 10253, for n= 4:
1 1 1 1
1 -1(3)
1 1 1 -1(1)
1 1 -2 (2)
1 1 -2(1) 1
1 -1(1) 1 -2(1) is it correct
1 1 -1 (2)
1 1 1 -3(1)
1 -1(1) 1 -1(1)
1 1 -1 -1
i hope this idea works.
i think it is easy to avoid the repeated answer by checking their sequence
i think i find a way to count the number of different answer, but i dont try to implement it uptonow

my idea is this:
for any acceptable answer generate a sequence of number and then count the no of this sequence.
the sequence must be unique for every answer (i mean that no two answer should generate the same sequence) and every sequence must generate a valid answer.
the way that i use to generate the sequence is this:
i consider all the gate with length of 1 which has no parallel gate to be +1 and all the other to be -length (gate), except the case there exists two or more parallel gate with length = 1, in this case one of the gate will be shown by 1 and the other(s) will be shown by -1.also if there are multiple minus gate, i use -1(2), which means that two gates in backward direction exist.
to clearify i try write the sequence for example in the problem 10253, for n= 4:
1 1 1 1
1 -1(3)
1 1 1 -1(1)
1 1 -2 (2)
1 1 -2(1) 1
1 -1(1) 1 -2(1) is it correct
1 1 -1 (2)
1 1 1 -3(1)
1 -1(1) 1 -1(1)
1 1 -1 -1
i hope this idea works.
i think it is easy to avoid the repeated answer by checking their sequence
-
- Experienced poster
- Posts: 151
- Joined: Wed Aug 21, 2002 12:07 am
- Location: Seoul, Korea
- Contact:
I suffered from stupid mistakes I made in solving this problem and I just got AC.
You can tackle this problem with dynamic programming. You should focus on there are two types of networks: one kind which are parallel connected, and another kind which are serial connected.
You'll have enumerable number of partitioning edges among serial(parallel) connected sections (since N <= 30). The sections are independant to each other.
I posted my solution to find help when it didn't work, but deleted it because it might be a spoiler.
Hope this could be some help.
ps. Guess what? This is my 700th problem!
You can tackle this problem with dynamic programming. You should focus on there are two types of networks: one kind which are parallel connected, and another kind which are serial connected.
You'll have enumerable number of partitioning edges among serial(parallel) connected sections (since N <= 30). The sections are independant to each other.
I posted my solution to find help when it didn't work, but deleted it because it might be a spoiler.
Hope this could be some help.
ps. Guess what? This is my 700th problem!

JongMan @ Yonsei