2011 ACM-ICPC Asia Phuket Regional Programming Contest
Test Cases and some solution guide of Contest Problems (4 November 2011)

 

Contest problems (pdf file)

 

Problem A. Water Gate Management

Problem Creator: Seksun Suwanmanee, Dept. of Computer Engineering, Prince of Songkla University, Hatyai Campus, Thailand

Test Cases   

Input

Output

n=6, m=7, input_file size < 1 KB

output_file size < 1 KB, 7 lines

6

720000 120000

50000 60000

130000 45000     

1200000 150000

1800000 250000

1000000 50000

7

5000000 7

5000000 30

50000000 10

50000000 11

30000000 20

5000000 40

100000000 20

 

Case 1: 50000

Case 2: 50000

Case 3: IMPOSSIBLE

Case 4: 570000

Case 5: 170000

Case 6: 45000

Case 7: IMPOSSIBLE

 

Problem B. Binary Search Tree

Problem Creator: Seksun Suwanmanee, Dept. of Computer Engineering, Prince of Songkla University, Hatyai Campus, Thailand

Solution guide

            You can use linked-list data structure to represent a binary tree. Firstly, construct a binary search tree from the input values using the BST condition to insert the node into the tree. From the resulted binary search tree, just print out all tree nodes by post-order method.

            An example of C solution program is here.

Test Cases   

Input

Output

8583 nodes, input_file size = 48 KB

output_file size = 48 KB, 8583 lines

17658

17034

481

210

166

137

19

16

6

1

10

136

32

23

60

54

47

...

 

1

10

6

16

23

35

39

50

47

59

57

55

54

64

61

66

77

...

 

Problem C. Fun Coloring

Problem Creator: Sanpawat Kantabutra, Dept. of Computer Engineering, Chiangmai University, Chiangmai, Thailand

Solution guide

            An example of C solution program is here.

 

Test Cases   

Input

Output

k=13, input_file size = 6 KB, 824 lines

output_file size = 13 bytes, 1 line

13

15 51

8 11 4

7 10 14

11 9 12

8 4 7

15 5 9

9 10 7

4 12 2

15 9 1

9 10 3

4 15 10

12 7 10

14 9 13

7 4 5

...

NNNNNNYYYYNNN

 

 

Problem D. Twin Apparent Primes!!

Problem Creator: Shahriar Manzoor, Dept. of Computer Science and Engineering, Southeast University, Bangladesh  (Special Thanks: Derek Kisman)

 

Test Cases   

Input

Output

300 test cases, input_file size = 3 KB

output_file size = 1,246 KB, 300 lines

3661 1632

4071 4737

3575 576

4803 7532

4942 4982

3948 1643

4037 7819

4106 2954

4343 851

4972 7095

4214 7783

4777 5322

4776 4209

4092 3476

4009 4572

4866 2612

3786 4145

...

 

19011123001050213946062605864018722280611539439866950537...
37531879815696604420784327690500233161189698800113172959...
...

One of possible solutions

You can test your solution at UVa Online Judge(problem ID=12349)

 

 

 

Problem E. Queen Game

Problem Creator: Abdullah al Mahmud, (Ph.D candidate) University of Central Florida, USA (Special Thanks: Jane Alam Jan, Shahriar Manzoor)

 

Test Cases   

Input

Output

50 test cases, input_file size = 637 KB

output_file size =172 bytes, 50 lines

50

16 1000000000000000 967

10 4582949529600

12 28746303686100

14 8786471331456

14 19638250748160

11 10623170960820

12 7757770651904

10 11327391617724

1 17854944307200

3 21661942579200

5 7505630546400

1 6413496122880

2 21079055576832

...

 

NO

NO

NO

YES

YES

NO

YES

YES

NO

YES

NO

YES

NO

NO

...

 

Problem F. Spelling Suggestion

Problem Creator: Chalathip Thumkanon, Dept. of Computer Engineering, Eastern Asia University, Thailand

Solution guide

            An example of C solution program is here.

 

Test Cases   

Input

Output

713 test cases, input_file size = 915 KB

output_file size = 24 KB, 713 lines

! 1qQ`~2@

" '[{;:

# 3eE2@4$

$ 4rR3#5%

% 5tT4$6^

& 7uU6^8*

' "[{;:

( 9oO8*0)

) 0pP9(-_

* 8iI7&9(

+ =]}-_\|

, <kKmM.>

- _[{0)=+

. >lL,</?

/ ?;:.>

0 )pP9(-_

1 !qQ`~2@

2 @wW1!3#

...

 

Abdul:0:Abdul

Abel's:0:Abel's

Abuja:0:Abuja

Accc#r&aC:8:Accra accrual

chson:2:Dyson chain

Acrux:0:Acrux

Adirondacks:0:Adirondacks

A7rdaiRi<:9:Adriatic Arcadia Aurelio Aurelius Sardinia bursitis prairie sarcastic

Advent':2:Advent Advent's Advents

Afghan's:0:Afghan's

An%ssB:4:Antwan

UvAgiala-'s=B:13:Aguilar's Catalan's Yugoslav's vagina's vanilla's

AlM`abeaiaAn:10:Alabaman Alabamian

Abaia:3:Aglaia Asia

Alcestis:0:Alcestis

...

 

Problem G. Coalescing Continents

Problem Creator: Sohel Hafiz, (Ph.D candidate) University of Texas, San Antonio, USA (Special Thanks: Arifuzzaman Arif, Shahriar Manzoor)

 

Test Cases   

Input

Output

200 test cases, input_file size = 83 KB

output_file size = 3 KB, 200 lines

200

 

....................

....................

....................

....................

....................

.......xx...........

.............x......

.............x......

.............x......

.............x......

....................

....................

..........xxx.......

..........xxx.......

.x........xxx.......

.x........xxx..xxx..

.x..................

.x..................

...

 

Case 1: 32

Case 2: invalid data

Case 3: 12

Case 4: 15

Case 5: 0

Case 6: 11

Case 7: 27

Case 8: invalid data

Case 9: 14

Case 10: 7

Case 11: 17

Case 12: 11

Case 13: 3

Case 14: invalid data

Case 15: 25

Case 16: 44

Case 17: 15

Case 18: 17

Case 19: 25

Case 20: invalid data

...

 

Problem H. Fence Making

Problem Creator: Shahriar Manzoor, Dept. of Computer Science and Engineering, Southeast University, Bangladesh  (Special Thanks: Derek Kisman, Jane Alam Jan)

 

Test Cases   

Input

Output

999 test cases, input_file size = 26 KB

output_file size = 12 KB, 999 lines

9682 9719 18 29 71757646

5746 5958 19 24 1942485264

6485 6864 4 23 1026299517

6287 7026 2 46 1658392984

9759 10331 4 42 751957217

5016 5516 15 99 1649298355

8241 8635 15 63 611553970

6855 7112 3 73 948820016

8015 8814 13 64 402753549

5440 6326 16 114 1563418310

6544 7191 17 25 864105122

8542 9529 6 11 978066874

8564 8731 7 47 1807808526

9818 10442 10 83 813016776

6340 6647 20 88 1289721729

6297 6681 15 55 819755050

...

 

15404518

1918408970

5357053312

37581090094

7652145750

57149197096

6297174670

11103477864

8946619968

99930874208

3337036198

2969800614

6541309416

16671398698

18414408582

...

 

Problem I. Paths in a Tree

Problem Creator: Jane Alam Jan, Google, USA (Special Thanks: Derek Kisman, Shahriar Manzoor)

 

Test Cases   

Input

Output

29 test cases, input_file size = 3.47 MB

output_file size < 1 KB, 29 lines

29

19567

7263 2470

17238 19339

7491 9662

3696 8030

8033 1006

2340 11349

1880 15351

10532 8721

2719 1093

15066 3661

10933 3027

1319 1323

1165 3512

2935 14627

15188 4974

12116 12399

7453 14681

5051 15010

11705 323

3795 6278

6210 12390

12588 4327

13586 15396

12892 14710

11211 18086

11500 8633

9315 12534

...

 

Case 1: 10956

Case 2: 9510

Case 3: 9962

Case 4: 11214

Case 5: 9519

Case 6: 9442

Case 7: 11151

Case 8: 10211

Case 9: 11056

Case 10: 10367

Case 11: 8517

Case 12: 10237

Case 13: 10891

Case 14: 10123

Case 15: 9920

Case 16: 9395

Case 17: 10380

Case 18: 9574

Case 19: 1

Case 20: 1

Case 21: 1

Case 22: 3

Case 23: 4

Case 24: 3

Case 25: 7

Case 26: 4

Case 27: 5

Case 28: 2

Case 29: 3

 

 

Problem J. Consecutive Sums

Problem Creator: Shahriar Manzoor, Dept. of Computer Science and Engineering, Southeast University, Bangladesh  (Special Thanks: Derek Kisman)

 

Test Cases   

Input

Output

1499 test cases, input_file size = 17 KB

output_file size = 5 KB, 1499 lines

706885990

1126149661

1517286715

199611050

416562165

1819355334

130992000

1254453113

1085865879

84663468

1870976423

1589449431

1496747197

1630044113

910547564

12285677

941086008

144758698

1284171333

...

 

18

486

90

30

90

162

126

18

486

486

162

162

54

18

54

6

30

18

18

...

 

Last Update: 2011-11-22