Submit | All submissions | Best solutions | Back to list |
ABCD - Colours A, B, C, D |
Consider a table with 2 rows and 2N columns (a total of 4N cells). Each cell of the first row is coloured by one of the colours A, B, C, D such that there are no two adjacent cells of the same colour. You have to colour the second row using colours A, B, C, D such that:
- There are exactly N cells of each colour (A, B, C and D) in the table.
- There are no two adjacent cells of the same colour. (Adjacent cells share a vertical or a horizontal side.)
It is guaranteed that the solution, not necessarily unique, will always exist.
Input
[a natural number N ≤ 50000]
[a string of 2N letters from the set {A, B, C, D}, representing the first row of the table]
Output
[a string of 2N letters from the set {A, B, C, D}, representing the second row of the table]
Example
Input: 1 CB Output: AD
Input: 2 ABAD Output: BCDC
Added by: | Adrian Satja Kurdija |
Date: | 2011-03-13 |
Time limit: | 0.300s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |
Resource: | inspired by a math puzzle |
hide comments
|
|||||||||||||
2012-05-04 16:34:13 amit
Same Problem! Getting WA in test case 18. |
|||||||||||||
2012-05-04 08:44:21 amit
punit : your answer is wrong for DBADBA |
|||||||||||||
2012-04-29 17:19:58 VV
getting TLE in test case 16 :( |
|||||||||||||
2012-04-29 13:28:58 :D
It's seems that form some time now the jugde runs all tests cases and checks them at the end. It was misleading for me as well. If I solve this problem, I will try to check if special judge works properly. Also to all people writing comments: Please refrain from using pointless shortcuts like "u r", "plz" and such. English on this site is hard to understand without users trying to cripple it on purpose. |
|||||||||||||
2012-03-22 18:30:07 harry
your* |
|||||||||||||
2012-03-22 18:29:35 harry
@punit: in total u r using B 4 times whereas n is 3.. @all: after 18 when der is wrong ans it doesnt mean ur code is not satisfying case 18, i once just submitted any code nd still it gave wrong ans after 18.... it is so beacause first the judge runs all the input files on pur code and after that it starts checking output for each case....so you cant figure out which case is not being satisfied by your code.. |
|||||||||||||
2012-03-04 06:45:12 amit kumar
getin wrng ans at judge 18.......................plzzzzzzzzz explain |
|||||||||||||
2012-02-13 18:56:25 niv
i am getting wrong answer at judge 18 , the cases i have tried are all working fine.....plz give the test case where it's going wrong |
|||||||||||||
2012-02-05 06:38:20 punit_
Same error WA in test 18, n working good with ur case of 3 DBADBA ACBACB |
|||||||||||||
2012-01-27 15:08:24 steven finn
me to have same problem it runs fine till test case 17 and gives wrong answer at test case 18. please help me. |