10559 - Blocks

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

Moderator: Board moderators

abishek
Experienced poster
Posts: 131
Joined: Mon Dec 15, 2003 5:41 am

Post by abishek »

0:00.219 1708 Ulan Degenbaev C++ 2003/10/30-13:19:59.766 2036487 (H0)
2 0:00.236 16448 Lou TianCheng C++ 2003/10/25-02:50:03.341 2020364 (H0)
3 0:00.469 4300 Der-Johng Sun C++ 2003/12/09-04:18:17.965 2131251 (H0)
4 0:00.582 1024 Gebrochenes Herz C++ 2003/10/08-14:49:17.315 1965002 (H0)
5 0:00.863 16496 Ying Wang@ZSU
i think you cannot achieve those time using a O(n^3) algorithm. but may be i am wrong too, as the memory usage of some of them is very high indeed, i will think about this problem now to try to optimise the time, and trade of some more memory. tell me if you get any ideas! :D
bye
abi

Revenger
Experienced poster
Posts: 132
Joined: Sun Apr 14, 2002 12:27 pm
Location: Russia

Post by Revenger »

I think that 0.8 sec can be achieved using a O(n^3) algorithm. I am not sure about that 0.2 sec can be achieved but I belive. Abishek, please, check your inbox.

lord_burgos
New poster
Posts: 43
Joined: Mon Oct 13, 2003 4:54 pm
Location: Mexico
Contact:

Re: 10559

Post by lord_burgos »

Der-Johng Sun wrote:Try This:

1
165
1 2 3 2 1 1 5 1 1 1 1 10 1 4 4 41 4 4 1 43 4 4 4 41 4 4 42 4 4 1 13 1 1 1 2 3 2 1 11 1 1 1 1 1 19 1 4 4 41 4 4 1 4 34 4 4 24 4 4 4 4 4 11 1 1 1 1 21 3 2 1 12 1 1 1 1 15 1 1 44 4 4 4 4 1 4 41 4 4 14 4 4 4 4 4 12 1 1 1 1 20 3 2 1 1 1 1 1 1 1 1 1 4 4 4 4 4 1 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 2 3 2 1 1 1 1 1 1 1 1 1 4 4 4 4 4 1 4 4 4 4 4 4 4 4 4 4 1 1 1 1

Answer: 5021
My accepted output is

Case 1: 4957

chuzpa
New poster
Posts: 33
Joined: Fri Jun 18, 2004 8:39 am
Location: Mexico
Contact:

More I/O's

Post by chuzpa »

I've tried this problem but I've got WA, if someone please could post more inputs / outputs for this problem it would be great ...

I've tried the followings ...

INPUT :

Code: Select all

12
165 
1 2 3 2 1 1 5 1 1 1 1 10 1 4 4 41 4 4 1 43 4 4 4 41 4 4 42 4 4 1 13 1 1 1 2 3 2 1 11 1 1 1 1 1 19 1 4 4 41 4 4 1 4 34 4 4 24 4 4 4 4 4 11 1 1 1 1 21 3 2 1 12 1 1 1 1 15 1 1 44 4 4 4 4 1 4 41 4 4 14 4 4 4 4 4 12 1 1 1 1 20 3 2 1 1 1 1 1 1 1 1 1 4 4 4 4 4 1 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 2 3 2 1 1 1 1 1 1 1 1 1 4 4 4 4 4 1 4 4 4 4 4 4 4 4 4 4 1 1 1 1 

2
1 2 

3
1 2 1

6
1 2 1 1 2 1
220
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
10
1 2 3 4 5 6 7 8 9 10

20
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10

9

1 2 2 2 2 3 3 3 1

1

1

32 
1 2 3 2 3 3 3 4 4 4 5 4 4 4 4 4 3 3 3 2 2 3 3 3 3 1 3 3 5 1 1 1

8
1 2 3 4 4 3 2 1

10
1 2 3 4 1 4 3 2 9 1
OUTPUT:

Code: Select all

Case 1: 5021
Case 2: 2
Case 3: 5
Case 4: 18
Case 5: 48400
Case 6: 10
Case 7: 22
Case 8: 29
Case 9: 1
Case 10: 258
Case 11: 16
Case 12: 18
By the way the first input is the one above this message ...
thanks ...

lord_burgos
New poster
Posts: 43
Joined: Mon Oct 13, 2003 4:54 pm
Location: Mexico
Contact:

Re: More I/O's

Post by lord_burgos »

My Accepted Output is :

Code: Select all

Case 1: 4957
Case 2: 2
Case 3: 5
Case 4: 18
Case 5: 48400
Case 6: 10
Case 7: 22
Case 8: 29
Case 9: 1
Case 10: 258
Case 11: 16
Case 12: 18
More Input:

Code: Select all

20

200
2 5 1 1 1 5 3 5 1 7 5 7 2 1 5 4 7 7 3 1 2 1 1 3 7 3 4 4 3 1 7 5 2 6 5 2 5 1 2 5 2 6 5 2 1 2 1 7 6 4 5 3 5 1 6 4 2 6 4 5 4 6 4 7 7 3 4 3 4 5 4 4 4 4 6 5 7 5 2 3 5 2 4 5 1 6 2 3 4 2 5 7 6 4 3 1 2 1 4 7 2 1 1 1 2 3 5 3 1 6 4 4 1 1 1 6 6 6 2 5 4 3 6 7 1 7 3 7 3 1 4 3 2 7 1 6 5 7 6 6 5 2 4 7 3 6 2 6 1 2 4 7 5 7 6 3 7 4 7 1 5 1 5 1 6 5 1 2 7 6 4 6 5 5 2 2 7 3 5 4 4 3 3 6 1 2 3 5 4 3 2 7 3 2 1 4 2 3 4 6 

200
1 3 1 1 3 2 4 7 2 3 7 7 2 5 3 7 4 6 7 4 4 3 6 6 6 6 6 2 7 2 1 5 7 5 3 7 5 2 4 1 3 5 2 3 3 1 3 1 5 5 5 5 7 4 5 2 6 2 5 6 6 5 6 4 6 5 6 3 2 5 3 7 2 7 6 4 7 4 1 7 4 3 3 5 7 3 1 4 2 6 2 7 7 2 3 4 7 1 4 7 3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 5 6 1 6 2 4 6 2 6 4 6 1 3 3 5 7 4 6 7 6 1 5 2 3 7 2 3 7 7 7 5 2 5 6 6 2 5 6 2 2 6 3 3 3 4 4 2 4 7 3 3 5 7 3 1 5 1 7 3 5 3 5 1 1 5 2 5 6 3 4 6 4 5 6 1 6 3 2 7 6 2 5 6 7 2 5 5 2 4 2 1 7 7 5 4 5 1 6 3 6 4 2 5 6 5 1 1 2 5 1 7 7 5 7 7 4 1 4 1 4 6 4 5 7 7 7 1 4 1 1 5 2 6 7 6 2 3 5 5 1 2 3 

Output:

Code: Select all


Case 1: 1484
Case 2: 1632
Case 3: 1532
Case 4: 1760
Case 5: 1440
Case 6: 1600
Case 7: 1416
Case 8: 1870
Case 9: 1498
Case 10: 1748
Case 11: 1788
Case 12: 1692
Case 13: 1784
Case 14: 1474
Case 15: 1642
Case 16: 1558
Case 17: 2048
Case 18: 1714
Case 19: 1922
Case 20: 1512

hungson175
New poster
Posts: 2
Joined: Mon Feb 19, 2007 3:34 pm
Contact:

Post by hungson175 »

Funny , I have 2 Accepted Programs , which give different answers for the input of lord_burgos: ( On test 13 and 20 )

Code: Select all

Case 1: 1484
Case 2: 1632
Case 3: 1532
Case 4: 1760
Case 5: 1454
Case 6: 1604
Case 7: 1416
Case 8: 1870
Case 9: 1498
Case 10: 1748
Case 11: 1788
Case 12: 1694
Case 13: 1802
Case 14: 1494
Case 15: 1642
Case 16: 1558
Case 17: 2048
Case 18: 1718
Case 19: 1922
Case 20: 1512
And

Code: Select all

Case 1: 1484
Case 2: 1632
Case 3: 1532
Case 4: 1760
Case 5: 1454
Case 6: 1604
Case 7: 1416
Case 8: 1870
Case 9: 1498
Case 10: 1748
Case 11: 1788
Case 12: 1694
Case 13: 1816
Case 14: 1494
Case 15: 1642
Case 16: 1558
Case 17: 2048
Case 18: 1718
Case 19: 1922
Case 20: 1522

lord_burgos
New poster
Posts: 43
Joined: Mon Oct 13, 2003 4:54 pm
Location: Mexico
Contact:

Post by lord_burgos »

I suppose, I am wrong :(, but , I don't know

jah
New poster
Posts: 38
Joined: Wed Apr 20, 2005 12:23 am

Post by jah »

My output:

Code: Select all

Case 1: 1484
Case 2: 1632
Case 3: 1532
Case 4: 1760
Case 5: 1454
Case 6: 1604
Case 7: 1416
Case 8: 1870
Case 9: 1498
Case 10: 1748
Case 11: 1788
Case 12: 1694
Case 13: 1816
Case 14: 1494
Case 15: 1642
Case 16: 1558
Case 17: 2048
Case 18: 1718
Case 19: 1922
Case 20: 1522
This is the output I get. I think it's exactly the same as hungson 2nd version.

This was a nice problem. My algorithm is an optimized O(n^5) in the worst case but it runs in 2,3 secs (A very pessimistic bound).

Post Reply

Return to “Volume 105 (10500-10599)”