Cryptogram 3
Time Limit
For 10 test cases, 60 seconds for C/C++ and 120 seconds for Java.
Submittal Limit
99 times (Submittal limit decremented by 1 after each submittal)
Scoring
When an answer is submitted, it is tested with the given input.txt and the result is notified in real time. The result can be one of following.
Pass: All test cases resulted in correct answers.
Fail: The test generated wrong or partially correct answers, runtime error, time out, etc.
[Problem]
There is a cryptogram consisting of a list of numbers between 0 ~ 999999. There is an urgent need to modify the cryptogram. This cryptogram can only be modified by a specially manufactured system.
This system provides the three functions as follows:
1. I(insert) x, y, s:Y number of numbers are inserted in front of x. s is a list of numbers to be inserted.[ex) I 3 2 123152 487651 ]
2. D(delete) x, y:Delete y number of numbers next to x. [ ex) D 4 4 ]
3. A(add)y, s:Add y number of numbers at the end of the cryptogram.
s is a list of numbers to be added [ ex) A 2 421257 796813 ].
Create a program to modify the cryptogram when a character sting generated by listing the command created in accordance with above rule and then output the first 10 numbers of the modified result.
[Input]
First line:Length of the original cryptogram. N (2000 ≤ N (integer) ≤ 4000)
Second line:Original cryptogram
Third Line:Number of commands (250 ≤ N (integer) ≤ 500)
Fourth line:Command
A test case consists of four lines as shown above. There are 10 test cases.
[Output]
Output the test case number following the ‘#’ symbol. It is followed by a space and then the first 10 items of the modified cryptogram.
length of the longest palindrome.
[Input Example]
3198
801199 482510 422184 242474 876697 940126 116534 339876 247263 458098 825098 223019 514111 303365 893555 243643 601338 454353 574796 689563 658854 865075 999888 791926 506889 150144 881247 837754 384870 933366 151318 687639 496390 595628 735176 968833 750368...
425
I 3186 6 111702 108909 437791 460849 808743 573893 A 6 902149 801457 885061 112389 207283 358796 A 1 989955 D 1100 5 D 613 9 D 998 1 D 2199 8 D 587 6 D 143 8 D 1945 6 I 5 1 362947 I 7 4 625354 271596 881263 415567 D 2452 10 A 6 351214 252282 334858 374262 106813 994606 I 1511 6 620092 829075 862184 856364 360195 511867 D 1320 6 A 8 871822 227120 817588 231183 650912 326064 820579 435543 D 2700 9 D 2175 9...
2480
462938 344563 399723 402947 549987 412958 420530 303429 692228 880290 950090 345253 201473 654529 200533 208289 931176 689125 751855 263503 586373 771415 616316 329388 671296 159465 930131 534966 554443 543621 857436 778109 367173 183314 320579 535313 592073...
486
A 3 901476 874927 362782 I 2368 7 286743 531172 693997 463259 976783 950242 673417 I 1466 3 145128 911981 664388 A 6 297281 402815 844393 472552 109416 648820 A 7 204996 777689 213612 161950 105193 439798 213002 D 142 8 I 330 3 803653 583330 161345...
...
[Output Example]
#1 471034 815406 542284 170257 228297 740370 785047 677617 834173 648732
#2 364373 466241 450661 237978 437060 679163 812457 727955 262600 218437
...
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.