COLONY - Linearian Colony
Description
- Every Linearian is either red or blue.
- A Linearian colony is a straight line, aligned N-S with the magnetic field.
- A colony starts with single red Linearian.
- Every year, each Linearian produces an offspring of the opposite color. After birth, the parent moves just south of the offspring. (Since everyone is born at once, this does make for a lot of jostling, but everyone stays in order.)
N ----------- S Year 0: R Year 1: BR Year 2: RBBR Year 3: BRRBRBBR Year 4: RBBRBRRBBRRBRBBR
Input
Output
Input | Input |
---|---|
3 6 |
51 123456789012345 |
Output | Output |
blue |
red |
hide comments
sumit jain:
2013-10-30 07:10:59
can any one tell me...m getting WA on 7th file(i think)...dont know what is the problem...its working fine on my pc :\ |
|
Mitch Schwartz:
2013-10-29 21:20:41
@Mostafa: I meant for speed comparison. :) Having multiple test files each with just one case amplifies the effect of server instability, puts languages with startup time (like Java) at more of a time disadvantage, and limits the number of cases that can be given. For here, there is a nice solution that is both very concise and very fast. It is not a hard problem but involves some logic and I think it is well designed, which is why I moved it from partial (I have no idea why it was published there) to classical. Last edit: 2013-10-29 21:21:03 |
|
Mostafa 36a2:
2013-10-29 20:42:47
@Mitch Schwartz : there (i think) 7 input files .. and the probability of getting AC with random answer is 0.0078125 .
|
|
BLANKRK:
2013-10-29 15:15:39
that ws realy silly mistake... this ezy one cost me 3 WA... |
|
Akhilesh Anandh:
2013-10-29 14:22:24
Please tell me why I'm getting WA. Submission id 10375706
|
|
Ouditchya Sinha:
2013-10-26 15:54:05
Piece of Cake... :) |
|
tuhin:
2013-10-26 10:50:04
defintely not a tutorial problem |
|
Mahesh Mishra:
2013-10-26 07:31:29
Note that indexing is from zero not one.. |
|
Mitch Schwartz:
2013-10-25 00:40:28
Moved to classical, but it would have been better to include many test cases per input file. |
Added by: | BYU Admin |
Date: | 2013-10-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM32-GCC ASM64 MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET |