Peak Detection

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

Given a sequence a_0, a_1, ... , a_{n-1} of integer values as an input.
Detect all "peak" and mark using '*'.
If a_i is a "peak",
1. There exist 2 index l and r, s.t. l < i < r, a_i - a_l > 9, a_i - a_r > 9.
2. a_i is a max value of the subsequence a_{l+1}, ... ,a_{r-1}.

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

10
0
9
0
10
0
11
0
10
1
11
1
10
0
9
1
11
5
15
4
15
7
0
5
10
15
20
15
10
5
0
5
10
15
20
15

Sample output:

10
0
9
0
10*
0
11*
0
10
1
11*
1
10
0
9
1
11
5
15*
4
15*
7
0
5
10
15
20*
15
10
5
0
5
10
15
20
15

Sample input:_

14
14
1
16
17
10
9
19
11
18
2
14
18
4
10
12

Sample output:

14
14
1
16
17
10
9
19*
11
18
2
14
18*
4
10
12

Sample input:_

14
14
1
16
17
10
7
19
11
18
2
14
18
4
10
12

Sample output:

14
14
1
16
17*
10
7
19*
11
18
2
14
18*
4
10
12

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1leonid510.08852008/02/03 02:35:580B / 23B / 25B
2shinh1200.09352008/02/02 17:22:370B / 56B / 63B
3tabasa1960.12182008/02/04 17:04:3014B / 107B / 56B

Perl _

RankUserSizeTimeDateStatistics
1ySas (cheat)610.07282008/02/03 13:47:550B / 27B / 33B

Python _

RankUserSizeTimeDateStatistics
1kt3k920.08942008/02/02 15:55:190B / 47B / 41B
2kt3k870.09742008/03/05 18:13:130B / 45B / 40B

Scheme _

RankUserSizeTimeDateStatistics
1murky-satyr1220.31342008/07/04 01:40:230B / 76B / 41B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima(embed)1540.35882008/02/26 14:39:360B / 90B / 46B

Io _

RankUserSizeTimeDateStatistics
1murky-satyr1673.36452008/02/11 05:32:270B / 117B / 40B
2murky-satyr1212.41782008/06/18 09:06:430B / 79B / 35B

JavaScript _

RankUserSizeTimeDateStatistics
1murky-satyr1470.07712008/02/05 01:35:470B / 67B / 79B
2murky-satyr740.07232008/06/18 08:13:260B / 40B / 32B

Lua _

RankUserSizeTimeDateStatistics
1murky-satyr1060.05592008/06/18 08:45:300B / 63B / 37B

Smalltalk _

RankUserSizeTimeDateStatistics
1murky-satyr1800.40492008/02/11 05:36:200B / 107B / 63B
2murky-satyr1150.49832008/06/18 08:32:000B / 69B / 40B

BASIC _

RankUserSizeTimeDateStatistics
1yt1302.40112008/02/27 14:43:370B / 80B / 40B

J _

RankUserSizeTimeDateStatistics
1I., S.690.15272012/03/10 14:07:450B / 17B / 52B
2pooq810.16422009/01/10 23:53:390B / 32B / 39B

C _

RankUserSizeTimeDateStatistics
151b(embed)890.04622008/02/05 19:24:234B / 44B / 41B
251b1580.06692008/02/02 18:26:101B / 66B / 91B

D _

RankUserSizeTimeDateStatistics
151b1970.06202008/02/07 19:23:030B / 102B / 89B

OCaml _

RankUserSizeTimeDateStatistics
1ksk1180.14332009/08/15 16:24:130B / 72B / 38B

Haskell _

RankUserSizeTimeDateStatistics
1test3100.19532008/02/02 15:21:210B / 142B / 68B

Ada _

RankUserSizeTimeDateStatistics
1yt2600.08432008/02/27 15:10:130B / 186B / 50B

Pascal _

RankUserSizeTimeDateStatistics
1uru3930.11442008/02/08 00:28:1410B / 245B / 88B
2uru3020.03912009/07/27 23:58:390B / 194B / 73B

AWK _

RankUserSizeTimeDateStatistics
1marcof1720.24572008/02/14 01:48:391B / 79B / 86B
2nn(embed)730.03242008/07/08 10:22:560B / 38B / 35B
3nn1330.05052008/07/08 01:49:560B / 56B / 76B

sed _

RankUserSizeTimeDateStatistics
1emoken(embed)1070.06032008/02/10 22:10:280B / ?B / ?B

Postscript _

RankUserSizeTimeDateStatistics
1yshl(embed)650.54352008/02/05 19:40:1926B / 26B / 13B
2yshl(bin)1140.52872008/02/02 18:27:1743B / 47B / 21B
3yshl1910.43422008/02/02 18:27:070B / 133B / 23B

GolfScript _

RankUserSizeTimeDateStatistics
1tails440.14672012/03/10 15:53:180B / 21B / 23B

Vim _

RankUserSizeTimeDateStatistics
1nn1030.07252009/11/28 00:04:180B / 50B / 36B

goruby _

RankUserSizeTimeDateStatistics
1leonid450.14512011/03/18 09:16:090B / 24B / 20B
2murky-satyr460.35502008/09/16 15:10:030B / 24B / 20B

Groovy _

RankUserSizeTimeDateStatistics
1murky-satyr949.62472008/03/13 13:17:270B / 62B / 28B

Language Ranking_

RankLangUserSizeScore
1GolfScripttails4410000
2gorubyleonid459777
3Rubyleonid518627
4PerlySas (cheat)617213
5Postscriptyshl(embed)656769
6JI., S.696376
7AWKnn(embed)736027
8JavaScriptmurky-satyr745945
9Pythonkt3k875057
10C51b(embed)894943
11Groovymurky-satyr944680
12Vimnn1034271
13Luamurky-satyr1064150
14sedemoken(embed)1074112
15Smalltalkmurky-satyr1153826
16OCamlksk1183728
17Iomurky-satyr1213636
18Schememurky-satyr1223606
19BASICyt1303384
20Common LISPkozima(embed)1542857
21D51b1972233
22Adayt2601692
23Pascaluru3021456
24Haskelltest3101419

return top