COLORCAT - Magical colorful cats (easy)
There is a circle with n cats, includes white cats, red cats and green cats. When two cats with different color talk with each other, they both change to third color. If they are same color, nothing will happen.
At each step, the 1st cat talks with 2nd cat, the 2nd cat talks with the 3rd cat,… and the nth cat talks with 1st cat.
Given the original color of n cats, your task is find the color of n cats after k steps.
Input :
- First line : n and k (1 ≤ n ≤ 20000, 1 ≤ k ≤ 30000)
- Second line : n characters, the i-th charater denotes color of the i-th cat at first state
Output :
- n characters denotes the color of n cats after k steps.
Sample :
Input :
3 1
GRR
Output :
RGR
Input :
5 4
WRWRW
Output :
GGGWG
Note : After solved this problem, you may want to try BLCATS
hide comments
monish007:
2015-08-02 12:05:14
ANY HINT PLEASE
|
|
Kata:
2015-01-29 11:38:50
At the time I publish this problem, my brute force solution couldn't pass in 1s, but my optimized solution could pass (also in 0.3s), so I set time limit to 1s. But some day after, I found that only a little optimizations make it pass in 1s, so I changed it. It's my fault that I didn't notice it any more.
|
|
Min_25:
2015-01-29 10:39:21
As far as I remember, the time limit of this problem has been changed twice; 1.00 -> 0.50 -> 0.30s.
|
|
Kata:
2015-01-29 05:40:31
I have changed the time limit after publish the problem some days and leave a comment, but it was deleted (?). Because it's a old problem, I didn't notice it. Sorry.
|
|
Mitch Schwartz:
2015-01-29 05:09:44
Why was time limit changed so that Robert Gerbicz no longer gets AC? That doesn't seem fair.
|
|
Kata:
2015-01-29 03:08:06
No, but it need some special optimizations. |
|
Ivan Katanic:
2015-01-27 18:03:35
Time limit seems very tight..is O(n*log(n)*log(k)) supposed to pass? Last edit: 2015-01-27 18:03:53 |
Added by: | Kata |
Date: | 2014-03-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | VNOI |