SPOJ Partial

September 16, 2017 | Author: Gaurav Mahal | Category: Mathematics, Science
Share Embed Donate


Short Description

The website is considered both an automated evaluator of user-submitted programs ...... !!!!! ..... as well as an online...

Description

   

Archives of the Sphere Online Judge partial problemset      

Editors: Buda IM Minh^^ avinash Ziad Ouf Felix Halim Phông Tôm T-7 islam (Tjandra Satria Gunawan)(???) Andrés Mejía-Posada Ricardo Oliveira [UFPR] Ramy Vu+o+ng Trung Hie^’u Nghia Thanh-Vy Hua bashrc is back Duc

Nikola P Borisov Venezuelan Programming League Damon Doucet Dulguun Batmunkh Aufar Gilbran Mir Wasi Ahmed Trân Ha?i Đăng Zhang Zhiyong Melvin Mateus Dantas [ UFCG ] Ahmad Zaky Infinity Atef David Moran Mostafa mahmoud sieunhan ahmed.abdrabo Alex, DE & Friends    

1

Last updated: 2013-06-29 16:32:45

2

Preface This electronic material contains a set of algorithmic problems, forming the archives of the Sphere Online Judge (http://www.spoj.com/), partial problemset. The document can be accessed at the following URLs: in PostScript format: http://www.spoj.com/problems/partial.ps in Portable Document Format: http://www.spoj.com/problems/partial.pdf These resources are constantly updated to synchronise with the ever-changing hypertext version of the problems, and to include newly added problems. If you have obtained this document from another source, it is strongly recommended that you should download the current version from one of the aforementioned URLs.   Enjoy problem-solving at the Sphere Online Judge!                     Disclaimer from the Editors. Despite our best efforts, it is possible that this document contains errors or that some of the content differs slightly from its original hypertext form. We take no responsibility for any such faults and their consequences. We neither authorise nor approve use of this material for any purpose other than facilitating problem solving at the Sphere Online Judge site; nor do we guarantee its fitness for any purpose whatsoever. The layout of the problems in this document is the copyright of the Editors named on the cover (as determined by the appropriate footers in the problem description). The content is the copyright of the respective Editor unless the copyright holder is otherwise stated in the ’resource’ section. The document as a whole is not protected by copyright, and fragments of it are to be regarded independently. No responsibility is taken by the Editors if use or redistribution of this document violates either their or third party copyright laws. When referring to or citing the whole or a fragment of this document, please state clearly the aforementioned URLs at which the document is to be found, as well as the resources from which the problems you are referring to originally came. Remarks concerning this document should be sent to the following e-mail address: [email protected].

3

Table of Contents 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45.

Problem PT07I (1486. The Ants in a Tree) Problem REDUCT (3077. Copier Reduction) Problem CONDIG (3079. Consecutive Digits) Problem PAINTER (3080. Painter) Problem PRIMESUB (3082. Primary X-Subfactor Series) Problem PACK1 (3088. Packing) Problem SYMORD (3095. Symmetric Order) Problem BOOKSH (3096. Overflowing Bookshelf) Problem FLOWLAY (3097. Flow Layout) Problem GRAFT (3098. Tree Grafting) Problem UPTIME (3132. Server Relocation) Problem LINEARPA (3185. Linear Pachinko) Problem FRSEARCH (3186. Frugal Search) Problem GOGOGORE (3187. Go Go Gorelians) Problem MST (3188. Minimum Spanning Tree) Problem CONNECT2 (3448. Connect) Problem SUMSQ (3449. Sum of Squares) Problem FASTW (3450. Fast Width ) Problem BOIFAC (3610. BOI 97 - Factorial) Problem BOI97TE (3677. BOI 97 - Task Execution) Problem BOI97SN (4108. BOI 97 - Street Network) Problem BRHQUADR (5167. Quadratics) Problem SBRICKS (5201. Stacks of Bricks) Problem SBRICKS2 (5202. Stacks of Bricks 2) Problem BRHAR (5535. Accelerated Reading) Problem BRHPHYS (5536. Physics Grade) Problem BRHWURD (5537. Words) Problem BRHMAIL (5538. Chain Mail) Problem BRHMUSIC (5539. Musical Frequencies) Problem SARRAY (6409. Suffix Array) Problem CUTBOARD (6610. Căt ba?ng) Problem MBUS (6671. Xe buýt) Problem INSUL (6952. Cách nhie^.t) Problem NKMATMA (6987. Mât mă) Problem SCRAMBLE (7670. SCRAMBLE1) Problem DUGOVI (8195. Borrowing money) Problem INSULENG (8559. Insulation) Problem SAMDRAW (8595. Artistic Samhita) Problem BGEEK (8601. Brainfuck Geek!!! (Bonus Question)) Problem SALESMAN (8760. Salesman) Problem KAMION (9027. KAMION) Problem NTKM (9028. DIEULINH) Problem ANTJOUR (9548. The Journey of the Ant) Problem MMO85 (9601. MMO85) Problem CPP (9740. Closest Pair Problem)

4

46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89.

Problem MRPATH (10178. Most Reliable Path) Problem TRAKA (10337. TRAKA) Problem PALINCOD (11131. Palindrome or not) Problem REDOKS (11400. Redoks) Problem RPL_T1 (11733. Find our next planet!) Problem RPL_T2 (11734. Take & Run) Problem OPC2408B (12054. Cipher) Problem IOI11GRD (12189. Tropical Garden ) Problem T8GELO (12263. GELO) Problem T8MOBIL (12264. Mobil Ajaib) Problem T8PIANO (12265. Piano) Problem T8STPD (12266. String Periodik) Problem T8SHADOW (12267. Shadow) Problem WARAKOM (12601. PiggybankRI) Problem INFORMAC (12879. INFORMACIJE) Problem RIOI_3_3 (12942. Spy Office) Problem RIOI_3_4 (12947. Cheaters) Problem NOINCDEC (13025. Making the Grade) Problem V_AYP1_A (13561. Kart) Problem V_AYP1_B (13562. Knight Circuit) Problem V_AYP1_C (13563. Iridium) Problem V_AYP1_D (13564. Time) Problem V_AYP1_E (13565. Secret) Problem V_AYP1_F (13566. A little help for Yon) Problem V_AYP2_A (13567. Very Triangular) Problem V_AYP2_B (13568. Sub-matrix Average) Problem V_AYP2_C (13569. Magic) Problem V_AYP2_D (13570. Military) Problem V_AYP2_E (13571. Lazy Decision) Problem V_AYP2_F (13572. Mirrors) Problem GMLIFE (13737. Game of Life) Problem DISCRT (13866. Discrete Roots) Problem HICHEEL1 (14057. Šidet tegš ?nts?gt) Problem HICHEEL2 (14059. Šidet gurvalžin) Problem HICHEEL3 (14060. Šidet oočir) Problem HICHEEL4 (14061. Šidet toonuud) Problem HICHEEL5 (14062. Šidet ?segn??d) Problem MFNNM (14440. Davy Jones’s Organ) Problem SHUNT (14460. Scavenger Hunt) Problem TREAP (14702. Yet another range difference query!) Problem RACEHUB (14756. Rice Hub - IOI) Problem SKIPLIST (14759. Yet another strings problem !!) Problem SCRIVIOI (14859. Scrivener - IOI 2012) Problem TOKI1493 (15228. Swap (Original))

5

SPOJ Problem Set (partial)

1486. The Ants in a Tree Problem code: PT07I In Amber’s childhood, he usually liked to observe some little things for tickling his little curiosity. He often found it interesting to climb up a tree, sit on a branch and watch the movement of a group of lovely ants on the branches of the tree. Amber finds there are n ant holes and m ants in the tree now. Because of his careful observation, he knows all ants’ behaviors, the i-th ant wanna travel from one hole s i to another hole t i at the speed v i . During the ant’s travel, if two ants arrive at the same position (meet or chase), they will touch their feelers for exchanging the information about food or danger. Even at the moment that the travel starts or finishes, the ant can also touch other’s feelers. But after the travel finishes, the ant will enter into the hole and never touch feelers. What amber wonders is to count the times of touchings during the whole traveling process. Consider there are n - 1 branches in the tree. Each branch connects the adjacent ant holes and has a particular length. Assume there is always a path that consists of branches between any two ant holes. Assume that no two ants have the same speeds and the touching doesn’t cost any time.

Input Input consists of multiple testcases. The first line contains one integer t (1
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF