MOSTYCOD - Humans Life Code
Imagine you are a Human Being ..
So you have some parameters , and those paramters contain values.
If you can imagine this,you can understand the Fact that Humans Store Their Parameters
In A Big Array ... (Actually The Array Is Of Size 00963999206048 bit)
[We will not discuss the meaning of the parameters here]
If You want to know what is the value of some parameter
you should go throw your mind .. surfing the internal array until reach the place for the parameter.
The Most Important Thing To Know .. is WHERE ARE YOU NOW !
And If We Suppose That Your parameters will not change until you consider to do this
(Actually Thats Happend By surfing the internal array until reach the parameter Place
And Then Change It
And The Most Important Thing To Know Here..Is What Is The value stored Before Change
(But Why?
Because Humans Can Only Change Their Parameters By Increasing/Decreasing Its values
(You Should Know That Humans Born (you don't have to know how or why) with initial value of ZERO
For Every Place in their internal array)))
The only way to know where are you (In the Internal Array)
and what Is the Value there IS to follow you from Born
to the point you are in now (you know humans lives on Average 00963113324820 ms on their planet Earth (The Average Brain Life)
and it's a little bit hard to follow them from the millisecond Zero To The millisecond 00963113324819 )...
Let's Talk A little About Humans Lifes
It's Not So Complicated,As They Always move on ,(actually they can't stop the time until now :D Or even Go Back)..
they have an Internal Stack To Save A Check Points In their LIFE ..
These Check Points are the moments they call (Taking Decisions)
These Points Make two Branches In Humans Lifes (One Branch is to go on and
complete their life,executing every thing they supposed to do until reach the Memory Time,
Thats Also Make Two Branches one Is to Skip Memory Time And Go On
And The Other is (the Only Time They Go Back) they pop the last check point
in their internal stack and go back to it,repeating every thing they've done from that moment)
(Second Branch IS That They DO NOTHING UNTIL they reach the memory time(discussed before)
and as they have No Memories They Skip The Memory time(never go back) and go on forward)
To Simulate Humans Life We Can write Mosty's Code.
What is Mosty's code?
Denote The Only 11 Actions Humans Do As Follow:
BORN denotes Born ...(where human starts his life with empty stack and zero_value Places in intenral array of parameters)
DIE denotes Die ...(where human End his life and rise/fall to paradise/Hell respectively ...
(actually it's a temporary pleasure/pain until the Judge Day Which We Will Not Discuss Here
(Which after it comes the endless pleasure/pain depends of what he done during his Short Life))
ENTER denotes Enter His Internal Array
(Note: Humans Never Die When They Are in Their Internal Array (until they goes out)
Except in One situation will be Discussed later.)
EXIT denotes Exit His Internal Array
(Note : ignore any actions out of The Internal Array)
(Note : when We Enter The Intenal array for the first time,So we are in place zero
Else we stay in the last place we were in)
DEEP denotes moving Deeper In Mind (internal array)
(Note: if we were in the Deepest Place In mind then,we went deeper,we reach the zero place(as a modular Mind))
FLOAT denotes moving Up Through the Mind (internal Array)
(Note: if we were in Place Zero,Then We Floated Up We reach The Deepest place in mind)
INCREASE denotes increase the value stored in place(that we are in now) by one.
DECREASE denotes decrease the Value Stored in place(that we are in now) by one
CHECKPOINT denotes moments of(Take A Decision) (described before)
MEMORY denoted Memory time when you human decide to go back or continue your life.
(Note: humans take a decision of executing their LifeCode included
After The CHECKPOINT AND before its associated MEMORY
IF and Only IF The Value He had in the last visited place in his mind was not ZERO
Else he will skip his LifeCode Included in that partition until he skips the associated Memory)
There is another 2 Actions(about interacting each other)We Will Not Discuss here.
Following One Human At Time You Are Going To Write A Program which Print
the values Of all Visited Places In His Mind (ONLY VISITED(ONLY))
using this form
PlaceNumber --> ItsValue
When to print ?
As you know values changes over his life ... so we will Define The Action '*****'
Which Denotes To The Moment Of 'Self Evaluation'
The Input Is a part of One Human Life
But You Can Suppose these things :
1-The Human already Born , and he is old enough to enter his MIND .
2-he has already entered his mind(internal array).
3-He Has an initial values in his mind (you will get them in input).
4-he has initial place (also you will get it).
5-The Human Will Not Exit His Internal Array During The Analyziz.
6-The LifeCode (in this version)Contains only The Following Actions:
[DEEP,FLOAT,INCREASE,DECREASE,CHECKPOINT,MEMORY,*****]
7-*****.
Input Form:
First Line gives M P A S (separated by spaces)
M : The Number Of already visited places (so you will get their values in the second line)...[0<M<50].
P : The Last Place this Human Were In his mind...[0<=P<M].
A : The Number Of Actions You Will Analyze...[0<A<1000].
S : The Number Of 'Self Evaluation' action will appeare ...[0<=S<100].
[Note : for every 'Self Evaluation' action you should print the value of all visited places(as discussed later)]
Second Line Initiate The Values Of The First M value (from 0 to M-1) of internal array.
Then Comes The A action Of this Human,7 in each line except the last one contain less.
The Values V[0] V[1] ... V[M-1] are 32 bit integers (so that 0-1=-1 and 2147483647+1=-2147483648)
[note that A includes S].
Outputform:
for Every 'Self Evaluation' action you should print the values in places of internal array
using this form
PlaceNumber --> ItsValue
You Should Print a jasmine flower before PlaceNumber
when PlaceNumber == The Last Place we've visited .
[what the hell is jasmine flower ? '*' ]
[note the spaces before and after the arrow]
[Note: You can suppose that Humans Never Float in Mind When they are in place zero
or So that WILL KILL HIM (the only way to die during a mind trip)]
EXAMPLES:
Example1(Easy):
Input:
1 0 7 1
5
DEEP CHECKPOINT MEMORY FLOAT INCREASE DECREASE *****
Output:
*0 --> 5
1 --> 0
[the only place we've changed is 0 but we visit 1 also]
[note that we haven't enter the check point]
[note the Jasmin Flower]
Example2(medium):
Input:
5 2 15 4
0 1 2 3 4
INCREASE INCREASE CHECKPOINT DECREASE DEEP ***** INCREASE
INCREASE FLOAT MEMORY ***** DEEP ***** DECREASE
*****
Output:
0 --> 0
1 --> 1
2 --> 3
*3 --> 3
4 --> 4
0 --> 0
1 --> 1
2 --> 2
*3 --> 5
4 --> 4
0 --> 0
1 --> 1
2 --> 1
*3 --> 7
4 --> 4
0 --> 0
1 --> 1
2 --> 0
*3 --> 9
4 --> 4
0 --> 0
1 --> 1
*2 --> 0
3 --> 11
4 --> 4
0 --> 0
1 --> 1
2 --> 0
*3 --> 11
4 --> 4
0 --> 0
1 --> 1
2 --> 0
*3 --> 10
4 --> 4
Exmple3(HARD):
input:
1 0 6 0
1
CHECKPOINT DEEP FLOAT INCREASE DECREASE MEMORY
output:
AUTISM
[the last example not exists in this version :p
(actually I couldn't prevent myself from delete it as an example (btw it's true))]
Example3(HARD)[real one]:
Input:
1 0 82 11
0
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE
INCREASE INCREASE CHECKPOINT DECREASE DEEP INCREASE INCREASE
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE DEEP
DEEP DEEP INCREASE INCREASE INCREASE INCREASE INCREASE
FLOAT FLOAT FLOAT FLOAT MEMORY DEEP CHECKPOINT
DECREASE DEEP INCREASE DEEP INCREASE FLOAT FLOAT
MEMORY DEEP DECREASE ***** DEEP DECREASE DECREASE
DECREASE ***** ***** FLOAT INCREASE INCREASE INCREASE
INCREASE ***** DEEP DEEP ***** FLOAT FLOAT
INCREASE INCREASE INCREASE INCREASE ***** DEEP DEEP
***** FLOAT DECREASE DECREASE ***** FLOAT *****
DEEP INCREASE ***** INCREASE *****
Output:
0 --> 0
1 --> 0
*2 --> 71
3 --> 72
4 --> 45
0 --> 0
1 --> 0
2 --> 71
*3 --> 69
4 --> 45
0 --> 0
1 --> 0
2 --> 71
*3 --> 69
4 --> 45
0 --> 0
1 --> 0
*2 --> 75
3 --> 69
4 --> 45
0 --> 0
1 --> 0
2 --> 75
3 --> 69
*4 --> 45
0 --> 0
1 --> 0
*2 --> 79
3 --> 69
4 --> 45
0 --> 0
1 --> 0
2 --> 79
3 --> 69
*4 --> 45
0 --> 0
1 --> 0
2 --> 79
*3 --> 67
4 --> 45
0 --> 0
1 --> 0
*2 --> 79
3 --> 67
4 --> 45
0 --> 0
1 --> 0
2 --> 79
*3 --> 68
4 --> 45
0 --> 0
1 --> 0
2 --> 79
*3 --> 69
4 --> 45
[if you noticed that S don't give the actual value of 'Self Evaluation'
you don't have to print more than 100 of it]
[as This human is not full trained in mind trips he will not go deeper than 10000 place
also he can't make a nested CHECKPOINTES of a depth more than 100]
last Example :
input:
10 9 180 1
0 0 0 0 0 0 0 0 0 13986
CHECKPOINT CHECKPOINT CHECKPOINT DECREASE DEEP INCREASE FLOAT
CHECKPOINT DECREASE DEEP INCREASE FLOAT CHECKPOINT DECREASE
DEEP INCREASE FLOAT CHECKPOINT DECREASE DEEP INCREASE
FLOAT CHECKPOINT DECREASE DEEP INCREASE FLOAT CHECKPOINT
DECREASE DEEP INCREASE FLOAT CHECKPOINT DECREASE DEEP
INCREASE FLOAT CHECKPOINT DECREASE DEEP INCREASE FLOAT
CHECKPOINT DECREASE DEEP INCREASE FLOAT CHECKPOINT DECREASE
DEEP INCREASE FLOAT FLOAT INCREASE DEEP DEEP
CHECKPOINT DECREASE MEMORY FLOAT CHECKPOINT DECREASE DEEP
DEEP INCREASE FLOAT FLOAT MEMORY MEMORY MEMORY
MEMORY MEMORY MEMORY MEMORY MEMORY MEMORY MEMORY
MEMORY DEEP DEEP CHECKPOINT DECREASE FLOAT FLOAT
INCREASE DEEP DEEP MEMORY FLOAT FLOAT MEMORY
FLOAT CHECKPOINT DECREASE DEEP DEEP DEEP INCREASE
FLOAT FLOAT FLOAT MEMORY DEEP DEEP CHECKPOINT
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE
INCREASE INCREASE INCREASE INCREASE INCREASE INCREASE CHECKPOINT
DECREASE FLOAT FLOAT INCREASE DEEP DEEP MEMORY
MEMORY DEEP CHECKPOINT DECREASE FLOAT INCREASE DEEP
MEMORY FLOAT MEMORY FLOAT FLOAT CHECKPOINT *****
CHECKPOINT DECREASE MEMORY FLOAT MEMORY
Output:
0 --> 0
1 --> 0
2 --> 0
3 --> 0
4 --> 0
5 --> 0
6 --> 0
7 --> 0
8 --> 54
9 --> 56
10 --> 57
11 --> 51
*12 --> 49
13 --> 0
14 --> 0
15 --> 0
0 --> 0
1 --> 0
2 --> 0
3 --> 0
4 --> 0
5 --> 0
6 --> 0
7 --> 0
8 --> 54
9 --> 56
10 --> 57
*11 --> 51
12 --> 0
13 --> 0
14 --> 0
15 --> 0
0 --> 0
1 --> 0
2 --> 0
3 --> 0
4 --> 0
5 --> 0
6 --> 0
7 --> 0
8 --> 54
9 --> 56
*10 --> 57
11 --> 0
12 --> 0
13 --> 0
14 --> 0
15 --> 0
0 --> 0
1 --> 0
2 --> 0
3 --> 0
4 --> 0
5 --> 0
6 --> 0
7 --> 0
8 --> 54
*9 --> 56
10 --> 0
11 --> 0
12 --> 0
13 --> 0
14 --> 0
15 --> 0
0 --> 0
1 --> 0
2 --> 0
3 --> 0
4 --> 0
5 --> 0
6 --> 0
7 --> 0
*8 --> 54
9 --> 0
10 --> 0
11 --> 0
12 --> 0
13 --> 0
14 --> 0
15 --> 0
________________________________________________________________________
Thanks For Mitch Schwartz for his last problems where the idea has come from.
hide comments
nadstratosfer:
2019-03-01 16:24:25
SourSpinach's comment is misleading, "straight simulation" doesn't stand a chance; vide last example with multiple nested loops in 10^4 range. In fact I'm not sure what we're expected here, since I've actually compiled that case in Human Mind and it still ran longer than TL here. I'm wondering whether the accepted solutions had to deal with such/current testcases, although writing an optimizing compiler doesn't seem above skills of users who passed this. |
|
Priyank Namdev:
2015-03-03 19:08:43
whoaaaa
|
|
Jacob Plachta:
2013-07-24 09:41:29
I feel I must advertise that the expected solution is straight simulation. Cases could easily be made for which this times out, but they're not included in the problem.
|
|
Mitch Schwartz:
2013-06-24 05:51:31
Interesting description. :)
|
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-06-24 05:51:31
longest problem description I ever seen :-P
|
Added by: | Mostafa 36a2 |
Date: | 2013-06-23 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Go Deeper and Deeper in Mind.. |