Branching Computations

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Consider a language which consists of 5 commands. It operates on a list of integers, which is initially [0], a list containing only 0.

You will be given lines of input corresponding to separate trials, each starting with the list being [0].

Commands:

v : "branch". Replace each integer N in the list with [N-1, N+1], flattening the result
< : "trim left". Removes the leftmost element in the list.
> : "trim right". Removes the rightmost element.
^ : "sum". Replaces the list with a list containing the sum of the integers in the list.
/ : "product". Replaces the list with a list containing the product of all integers in the list.

Notes: the empty sum is 0 and the empty product is 1.

For example, the input "v" would generate [-1, 1], and the input "vv" would generate [-2, 0, 0, 2].

--conor_obrien

Options

exec is denied

rejudge feature is enabled

4day(s) and 17:10:15 before deadline (05/29 04:02:09 JST), all source codes will be revealed after the deadline

Sample input:_

v
vv
vvv
vv<
v/
vvv<<^
v>v>v>
>^
</
<

Sample output:

[-1, 1]
[-2, 0, 0, 2]
[-3, -1, -1, 1, -1, 1, 1, 3]
[0, 0, 2]
[-1]
[4]
[-3]
[0]
[1]
[]

Sample input:_

vvvvv/vv<v>^v
vvv/v<^
^v^
vv<>v<v>v>>>^
vvvvvvv
vvvvv>>>>>>>>>>>>>/vvv^

Sample output:

[7381125, 7381127]
[10]
[0]
[-1]
[-7, -5, -5, -3, -5, -3, -3, -1, -5, -3, -3, -1, -3, -1, -1, 1, -5, -3, -3, -1, -3, -1, -1, 1, -3, -1, -1, 1, -1, 1, 1, 3, -5, -3, -3, -1, -3, -1, -1, 1, -3, -1, -1, 1, -1, 1, 1, 3, -3, -1, -1, 1, -1, 1, 1, 3, -1, 1, 1, 3, 1, 3, 3, 5, -5, -3, -3, -1, -3, -1, -1, 1, -3, -1, -1, 1, -1, 1, 1, 3, -3, -1, -1, 1, -1, 1, 1, 3, -1, 1, 1, 3, 1, 3, 3, 5, -3, -1, -1, 1, -1, 1, 1, 3, -1, 1, 1, 3, 1, 3, 3, 5, -1, 1, 1, 3, 1, 3, 3, 5, 1, 3, 3, 5, 3, 5, 5, 7]
[29160]

Sample input:_

vv>vv>>>>v^v<vv>^v>v>v>vvv>/vvvv<<
v<v<v<v<v<vvv
v<v<v<v<vvv/vv^vv^v/^
v>v>v>v<v>vv<>vv<>>/vvv

Sample output:

[-827131647449, -827131647447, -827131647449, -827131647447, -827131647447, -827131647445, -827131647449, -827131647447, -827131647447, -827131647445, -827131647447, -827131647445, -827131647445, -827131647443]
[2, 4, 4, 6, 4, 6, 6, 8]
[142883999999]
[-138, -136, -136, -134, -136, -134, -134, -132]

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1rotary-o1130.03702018/05/18 01:38:060B / 53B / 57B
2Histocrat1140.03992018/05/17 00:20:090B / 47B / 60B

Ruby2 _

RankUserSizeTimeDateStatistics
1rotary-o1080.17112018/05/21 00:21:030B / 49B / 56B
2Histocrat1100.15242018/05/16 23:59:570B / 40B / 65B
3angel_p571100.16552018/05/17 17:15:000B / ?B / ?B
4letranger1250.16852018/05/19 08:11:330B / 51B / 69B

Perl _

RankUserSizeTimeDateStatistics
1tails1120.03522018/05/15 15:48:460B / 36B / 73B
2%201250.03342018/05/23 01:10:200B / 43B / 78B

Python _

RankUserSizeTimeDateStatistics
1llhuii1470.07442018/05/19 07:47:060B / 70B / 58B
2hallvabo1470.12152018/05/20 00:16:240B / 70B / 58B
3lynn1580.07282018/05/19 04:24:050B / 83B / 70B
4dianne1600.07242018/05/18 15:40:550B / 86B / 64B
5Da1600.07742018/05/20 10:45:080B / ?B / ?B
6_2260.07422018/05/20 10:58:170B / ?B / ?B

Python3 _

RankUserSizeTimeDateStatistics
1llhuii1310.12242018/05/18 21:27:080B / 60B / 49B
2mypetlion1500.12522018/05/18 01:22:450B / 73B / 60B

C _

RankUserSizeTimeDateStatistics
1tails2280.03162018/05/23 14:45:200B / 102B / 124B

GolfScript _

RankUserSizeTimeDateStatistics
1tails630.08922018/05/15 14:15:050B / 7B / 54B

gs2 _

RankUserSizeTimeDateStatistics
1tails290.19802018/05/15 14:26:3711B / 11B / 6B
2whio290.21202018/05/16 01:26:5911B / 10B / 7B

Burlesque _

RankUserSizeTimeDateStatistics
1Hendrik650.05062018/05/17 06:49:140B / 32B / 33B

Scala _

RankUserSizeTimeDateStatistics
1rotary-o1567.72482018/05/17 01:55:290B / 94B / 57B

Language Ranking_

RankLangUserSizeScore
1gs2tails2910000
2GolfScripttails634603
3BurlesqueHendrik654461
4Ruby2rotary-o1082685
5Perltails1122589
6Rubyrotary-o1132566
7Python3llhuii1312213
8Pythonllhuii1471972
9Scalarotary-o1561858
10Ctails2281271

return to the top page