problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03146
u934868410
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s = int(input())\na = set()\na.add(s)\nindex = 1\nwhile True:\n if s % 2 == 0:\n s = int(s/2)\n else:\n s = 3*s + 1\n\n if s in a:\n print(index)\n exit()\n else:\n index += 1\n a.add(s)', 's = int(input())\na = set()\na.add(s)\nindex = 2\nwhile True:\n if s % 2 == 0:\n s = int(s/2)\n else:...
['Wrong Answer', 'Accepted']
['s376197117', 's030758160']
[3060.0, 3060.0]
[17.0, 18.0]
[193, 193]
p03146
u936985471
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s=int(input())\ncur=set([s])\ni=1\nwhile True:\n i=i+1\n if s%2==0:\n s=s//2\n else:\n s=3*s+1\n if s in cur:\n print(i)\n else:\n cur.add(s)', 's=int(input())\nc=set([s])\ni=1\nwhile True:\n i+=1\n if s&1:\n s=3*s+1\n else:\n s//=2\n if s in c:\n print(i)\n break\n c.add(s)\n']
['Time Limit Exceeded', 'Accepted']
['s373048601', 's198450216']
[20560.0, 2940.0]
[2104.0, 17.0]
[146, 136]
p03146
u940279019
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['a = [int(input())]\n\nfor i in range(100000):\n if a[i] % 2 == 0:\n a.append(a[i]//2)\n else:\n a.append(3*a[i] + 1)\n \n if a[i+1] in a[:i]\n print(i+2)\n break\n ', 'a = [int(input())]\n\nfor i in range(100000):\n if a[i] % 2 == 0:\n a.append(a[i]//2)\n else:\n a.append(...
['Runtime Error', 'Runtime Error', 'Accepted']
['s544445640', 's739155862', 's087995569']
[2940.0, 2940.0, 2940.0]
[20.0, 17.0, 17.0]
[186, 187, 177]
p03146
u945945701
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
[' i = int(input())\n seen = set()\n seen.add(i)\n temp = i\n for x in range(0,1000000):\n if(temp%2 == 0):\n temp = temp/2\n else:\n temp = 3*temp+1\n if(temp in seen):\n print(x)\n break\n else:\n seen.add(temp)', 'i = int(input())\nseen = set()\ns...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s361993469', 's377730877', 's532747254', 's821340950', 's853672916', 's465828032']
[2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 17.0, 20.0, 18.0]
[268, 258, 211, 188, 212, 241]
p03146
u949620431
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s = int(input())\nli = []\nli.append(s)\n\nfor i in range(1, 1000000):\n\tif li[i-1] % 2 == 0:\n\t\ta = int(li[i-1] /2)\n\t\tif a in li:\n\t\t\tprint(i + 1)\n\t\t\tbreak\n\t\telse:\n\t\t\tli.append(a)\n \n\telse:\n\t\tb = 3 * li[i-1] + 1\n\t\tif b in li:\n\t\t\tprint(i + 1)\n\t\t\tbreak\n\t\telse:\n\t\t\tli...
['Wrong Answer', 'Accepted']
['s586525543', 's580172653']
[3060.0, 3060.0]
[18.0, 18.0]
[287, 277]
p03146
u957722693
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s=int(input())\nnums=[]\nnums.append(s)\ni=2\nwhile(1):\n if i%2==0:\n new=int(i/2)\n if new in nums:\n print(i)\n break\n nums.append(new)\n else:\n new=3*i+1\n if new in nums:\n print(i)\n break\n nums.append(new)\n i+=1\n ', 's=int(input())\nnums=[]\nnums.append(s)\ni=2\nw...
['Wrong Answer', 'Accepted']
['s155899611', 's548951692']
[2940.0, 3060.0]
[19.0, 17.0]
[249, 270]
p03146
u957872856
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['S = int(input())\nl = []\nwhile (S not in l):\n l.append(S)\n if S%2 == 0:\n S //= 2\n else:\n S = 3*S+1\nprint(len(S)+1)', 'S = int(input())\nl = []\nwhile (S not in l):\n l.append(S)\n if S%2 == 0:\n S //= 2\n else:\n S = 3*S+1\nprint(len(l)+1)']
['Runtime Error', 'Accepted']
['s554895958', 's311286646']
[2940.0, 2940.0]
[17.0, 17.0]
[122, 122]
p03146
u957957759
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s=int(input())\n\nif s==4 or s==2 or s==1:\n print(4)\n \nl=[]\nelse:\n for i in range(10**6+1):\n l.append(s)\n if l.count(4)>2:\n break\n elif s%2==0:\n s=s//2\n else:\n s=3*s+1\n x=l.index(4)\n\n l=l[x+1:]\n y=l.index(4)\n\n print(y+...
['Runtime Error', 'Accepted']
['s142288021', 's655766352']
[2940.0, 3064.0]
[17.0, 17.0]
[302, 307]
p03146
u959225525
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['a=[]\na.append(s)\n\nwhile 1:\n if s%2==0:\n s=s/2\n a.append(s)\n else:\n s=3*s+1\n a.append(s)\n if len(a)!=len(set(a)):\n print(len(a))\n exit()', 's=int(input())\na=[]\na.append(s)\n\nwhile 1:\n if s%2==0:\n s=s/2\n a.append(s)\n else:\n ...
['Runtime Error', 'Accepted']
['s374512065', 's569762297']
[2940.0, 3060.0]
[17.0, 18.0]
[186, 201]
p03146
u963915126
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s = int(input())\n\nlog = set()\nset.add(s)\nfor i in range(1001000):\n if s%2==0:\n s //=2\n else:\n s = 3*s+1\n\n if s in log:\n print(i+2)\n break\n\n log.add(s)', 's = int(input())\n\nlog = set()\nlog.add(s)\nfor i in range(1001000):\n if s%2==0:\n s //=2\n els...
['Runtime Error', 'Accepted']
['s366886644', 's459616595']
[3060.0, 3060.0]
[18.0, 17.0]
[190, 190]
p03146
u972892985
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s = int(input())\nl = []\n\nwhile(s not in l):\n l.aplend(s)\n \n if s%2 == 0:\n s//=2\n else:\n s=3*s+1\nprint(len(l)=1)', 's = int(input())\nl = []\n\nwhile(s not in l):\n l.append(s)\n \n if s%2 == 0:\n s//=2\n else:\n s=3*s+1\nprint(len(l)+1)']
['Runtime Error', 'Accepted']
['s390336801', 's055079478']
[2940.0, 3188.0]
[17.0, 18.0]
[121, 121]
p03146
u987637902
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['# ABC116\n\ns = int(input())\nS = [str(s)]\ni = 1\nwhile True:\n if s % 2 == 0:\n i += 1\n s = s//2\n S.append(str(s))\n if S.count(str(s)) == 2:\n print(i)\n print(S)\n exit()\n else:\n i += 1\n s = 3 * s + 1\n S.append(str(s))\n...
['Wrong Answer', 'Accepted']
['s736484276', 's487670850']
[9196.0, 9132.0]
[31.0, 27.0]
[418, 352]
p03146
u993435350
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['S = int(input())\n\nINF = 10 ** 9 \n\nlist = [S]\n\ncon = 0\n\nfor i in range(INF):\n\tif S % 2 == 0:\n\t\tS = int(S / 2)\n\t\tlist.append(S)\n\t\tcon += 1\n\n\telse:\n\t\tS = (3 * S) + 1\n\t\tlist.append(S)\n\t\tcon += 1\n\n\n\tif S in list[:i]:\n\t\tbreak\n\n\n\nprint(con)', 'S = int(input())\n\nINF = 10 ** 9 \n\nl...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s055583925', 's269466069', 's788842250', 's429802716']
[3060.0, 3060.0, 3064.0, 3060.0]
[18.0, 18.0, 18.0, 17.0]
[233, 265, 269, 236]
p03146
u994543150
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['s=int(input())\n\ndef collatz(n):\n if n%2==0:\n n=n/2\n else: \n n=3*n+1\n return int(n)\n\nl=[s]\nwhile s!=1:\n s=collatz(s)\n l.append(s)\n\nif s==1:\n print(4)\nelif s==2:\n print(4)\nelse:\n print(len(l)+1)', 's=int(input())\n\ndef collatz(n):\n if n%2==0:\n n=n/2\...
['Wrong Answer', 'Accepted']
['s076148178', 's658559924']
[9080.0, 9116.0]
[27.0, 29.0]
[230, 236]
p03146
u994935583
2,000
1,048,576
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following condi...
['def resolve():\n N = int(input())\n ans = 1\n for i in range(1000000):\n if N == 1 or N == 2 or N == 4:\n break\n elif N % 2 == 0 :\n N = N//2\n ans = ans + 1\n else:\n N = 3*N+1\n ans = ans+1 \n print(ans + 3)', 'def resolve():\n...
['Wrong Answer', 'Accepted']
['s343321450', 's829890780']
[2940.0, 3060.0]
[17.0, 17.0]
[286, 296]
p03147
u012694084
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nh = [0] + list(map(int, input().split()))\n\nfor i in range(1, N):\n h[i] = max(0, h[i] - h[i - 1])\n\nprint(sum(h))\n', 'N = int(input())\nh = list(map(int, input().split()))\n\nfor i in range(N - 1, 0, -1):\n h[i] = max(0, h[i] - h[i - 1])\n\nprint(sum(h))\n']
['Wrong Answer', 'Accepted']
['s520800751', 's857814943']
[2940.0, 2940.0]
[18.0, 18.0]
[132, 134]
p03147
u013408661
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=list(map(int,input().split()))\ncount=0\nwhile h.count(0)!=len(h):\n stack=[]\n substack=[]\n for i in range(len(h)):\n if h[i]!=0:\n substack.append(i)\n else:\n substack.append(i)\n stack.append(substack)\n substack=[]\n h=[]\n for i in range(len(stack)):\n count+...
['Runtime Error', 'Accepted']
['s431994604', 's601487868']
[3064.0, 3064.0]
[17.0, 24.0]
[332, 547]
p03147
u013629972
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['# import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\nimport numpy as np\n\n\n\n# inf = 10 ** 20\n# eps = 1.0 / 10**10\n# mod = 10**9+7\n# dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\n# ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s125857069', 's400465298', 's582842150', 's749177468']
[12368.0, 21164.0, 12232.0, 12468.0]
[156.0, 344.0, 158.0, 166.0]
[1608, 1771, 1469, 1697]
p03147
u017415492
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=list(map(int,input().split()))\nd=[]\na=[]\nx=0\nfor i in range(1,n-1):\n if h[i-1]>h[i]<h[i+1]:\n a.append(h[i])\n x=1\nfor i in range(1,n-1):\n if h[i-1]<h[i]>h[i+1]:\n d.append(h[i])\n x=1\nif x==0:\n print(h[0])\nelse:\n if n>=2 and h[0]>=h[1]:\n d.append(h[0])\n if n>=2 and ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s479820470', 's779847534', 's465353300']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[356, 304, 442]
p03147
u022979415
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['def main():\n N = int(input())\n height = list(map(int, input().split(" ")))\n target = [0] * N\n result = 0\n print(target)\n while not height == target:\n print(height)\n end = False\n result += 1\n for i in range(N):\n if not end:\n if height[...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s607686872', 's958459907', 's804223074']
[4724.0, 3064.0, 3060.0]
[74.0, 38.0, 32.0]
[573, 674, 577]
p03147
u023229441
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nA=list(map(int,input().split()))+[0]\nans=0\n\nwhile 1:\n for i in range(n):\n if A[i]>0:\n A[i]-=1\n if A[i+1]==0:\n ans+=1\n if A==[0 for i in range(n)]:\n break\nprint(ans)', 'n=int(input())\nA=list(map(int,input().split()))+[0]\nans=0\n\nwhile 1:\n for i in range(n):\n ...
['Time Limit Exceeded', 'Accepted']
['s099509496', 's806367836']
[3060.0, 3060.0]
[2107.0, 21.0]
[204, 222]
p03147
u027253287
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh = list(map(int, input().split()))\ncnt = 0\ndef minus1(arr) :\n for i in range(len(arr)) :\n if(arr[i] != 0) : arr[i] -= 1\n return 0\n\ndef discover0(arr) :\n flag = [0, 0]\n cnt = 0\n for i in range(1, len(arr)) :\n if(arr[i-1] != 0 and arr[i] == 0) :\n flag[0] = 1\n elif(arr[...
['Wrong Answer', 'Accepted']
['s661521962', 's144416256']
[3064.0, 3064.0]
[21.0, 20.0]
[510, 455]
p03147
u036744414
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['# coding:utf-8\n# C - Grand Garden\n\nN = int(input())\nh = list(map(int,input().split()))\nh += [0]\nans = 0\n\nfor _ in range(100):\n for i in range(N+1):\n if h[i] != 0:\n h[i] -= 1\n add = True\n else:\n if add:\n mini_ans += 1\n add = Fa...
['Runtime Error', 'Accepted']
['s488492972', 's949518934']
[3060.0, 3064.0]
[18.0, 21.0]
[317, 411]
p03147
u037430802
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['\n\n\n\n\nN = int(input())\nH = list(map(int, input().split()))\n\nans = 0\nl,r = 0,0\nwhile True:\n if l > N-1 or r > N-1:\n l,r = 0,0\n\n while l < N H[l] == 0:\n l += 1\n\n if l >= N:\n break\n\n r = l\n while r < N and H[r] != 0:\n r += 1\n\n tmp = min(H[l:min(r,N)])\...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s169287769', 's727324807', 's258717710']
[2940.0, 3064.0, 3064.0]
[17.0, 19.0, 19.0]
[700, 751, 429]
p03147
u046592970
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nv = list(map(int, input().split()))\nans = v[0]\nfor i in range(1, n):\n ans += max(v[i]-v[i-1], 0)\nprint(cnt)', 'n = int(input())\nv = list(map(int, input().split()))\nans = v[0]\nfor i in range(1, n):\n ans += max(v[i]-v[i-1], 0)\nprint(ans)']
['Runtime Error', 'Accepted']
['s007278051', 's569923895']
[2940.0, 2940.0]
[17.0, 21.0]
[127, 127]
p03147
u063052907
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nlst_h = list(map(int, input().split()))\n\n\nans = 0\nnow = 0\nfor i in range(N):\n if lst_h[i] > now:\n ans += now\n now = lst_h[i]\n\n\nprint(ans)', 'N = int(input())\nlst_h = list(map(int, input().split()))\n\n\nans = 0\nnow = 0\nfor i in range(N):\n if lst_h[i] > now:\n an...
['Wrong Answer', 'Accepted']
['s507373194', 's775110534']
[2940.0, 2940.0]
[17.0, 18.0]
[167, 179]
p03147
u072717685
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
["import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\ndef main():\n n, *h = map(int, read().split())\n if n == 1:\n print(h[0])\n sys.exit()\n r1 = h[0]\n r2 = h[-1]\n for i1 in range(n - 1):\n if h[i1] < h[i1 + 1]:\n r1 += (h[i1 + 1] - h[i1])\n elif...
['Wrong Answer', 'Accepted']
['s563716130', 's811311224']
[9064.0, 9096.0]
[28.0, 31.0]
[442, 329]
p03147
u077291787
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['# ABC116C - Grand Garden\nn = int(input())\nlst = list(map(int, input().rstrip().split()))\nans = 0\ncur = 0\nfor n, m in zip(lst, lst[1:]):\n if cur < n:\n cur = n\n if cur > m:\n ans += cur - m\n cur = m\nprint(ans)', '# ABC116C - Grand Garden\nn = int(input())\nlst = list(map(int, input(...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s811284073', 's839371238', 's892735926', 's326241879']
[3060.0, 3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[233, 249, 255, 168]
p03147
u082861480
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh_s = list(map(int, input().split()))\n\nwater = 0\npre = 0\nfor now in h_s:\n if now > pre:\n \n water += now - pre\n print(pre, now)\n pre = now\nprint(water)\n ', 'n = int(input())\nh_s = list(map(int, input().split()))\n\nwater = 0\npre = 0\nfor now in h_s:\n if now > pre:\n \n...
['Wrong Answer', 'Accepted']
['s330946306', 's594012256']
[3060.0, 2940.0]
[17.0, 17.0]
[261, 241]
p03147
u087917227
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = input()\nhn = list(map(int, input().split()))\n\nans = 0\n\nwhile sum(hn) > 0:\n ans+= 1\n flag = False\n for i in range(n):\n if hn[i] > 0:\n hn[i] -= 1\n flag = True\n else:\n break\n\nprint(ans)', 'n = int(input())\nhn = list(map(int, input().split()))\n\...
['Runtime Error', 'Accepted']
['s234590908', 's772239438']
[3060.0, 3060.0]
[18.0, 49.0]
[242, 260]
p03147
u094731123
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nflower = input().split()\nfor i in range(n):\n flower[i] = int(flower[i])\nprint(flower)\na = 0\ndef water():\n if sum(flower) == 0:\n a = -1\n elif 0 in flower:\n i = 0\n while flower[i] == 0:\n i += 1\n j = i\n try:\n while flower[j...
['Wrong Answer', 'Accepted']
['s737535520', 's741800992']
[3064.0, 3064.0]
[43.0, 45.0]
[561, 547]
p03147
u112324182
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh = list(map(int,input().split()))\nh.insert(0,0)\nsum = 0\nbottom = 0\nfor i, hn in enumerate(h):\n if (i == 0) :\n continue\n if (hn < h[i-1]):\n print(h[i-1])\n sum += (h[i-1] - bottom)\n bottom = hn\nend = bottom if h[n-1] < h[n] else 0\nprint(sum+end)', 'n = int(input())\nh = list...
['Wrong Answer', 'Accepted']
['s262738820', 's200949660']
[3064.0, 3060.0]
[17.0, 17.0]
[275, 218]
p03147
u118642796
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nh = list(map(int,input().split()))\n\nans = 0\ncheck = 0\nwhile(True):\n for i in range(N):\n if i == 0:\n check = 0\n if check == 0:\n if h[i] != 0:\n check = 1\n ans += 1\n h[i] -=1\n if check == 1:\n ...
['Wrong Answer', 'Accepted']
['s685837584', 's747084737']
[3064.0, 2940.0]
[20.0, 18.0]
[451, 117]
p03147
u118665579
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['import numpy as np\n\nN = int(input())\nH = np.array(list(map(int, input().split())))\ncnt = 0\nf_f = 0 \nn_f = 0 \nv = 0 \n\ncnt = min(H)\nH -=cnt\nfor i in range(max(H)):\n for j in range(N):\n v=0\n if N == 0 and H[j] > 0 and H[j+1] == 0:\n v+=1\n elif H[j] > 0 and H[j-1] == 0:\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s189028880', 's319648192', 's295131032']
[12500.0, 19104.0, 12408.0]
[189.0, 288.0, 188.0]
[417, 483, 457]
p03147
u124025116
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nli = list(map(int,input().split()))\nans = 0\nfor i in range(n):\n if li[i - 1] == 0:\n del li[i - 1]\n n = len(li)\n else:\n ans += li[i - 1]\n for j in range(n):\n li[j - 1] -= 1\nprint(str(ans))', 'N=int(input())\nx=[int(i) for i in input().split()]\nx.append(0)\ncnt=0\nwhile x...
['Runtime Error', 'Accepted']
['s185704236', 's116070008']
[3060.0, 3060.0]
[18.0, 20.0]
[223, 216]
p03147
u130900604
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=[0]+list(map(int,input().split()))+[0]\n\nexbi=[]\nexsm=[]\nfor c,d,e in zip(h[0:],h[1:],h[2:]):\n #print(c,d,e)\n if c<d and d>e:\n exbi.append(d)\n if c>d and d<e:\n exsm.append(d) \n#print(exbi,exsm)\nprint(sum(exbi)-sum(exsm))', 'n=int(input())\nh=[0]+list(map(int,input().split()))+[0...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s416400825', 's842047417', 's372933832']
[3064.0, 3064.0, 2940.0]
[18.0, 17.0, 17.0]
[247, 249, 229]
p03147
u131406102
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['\nimport numpy as np\nn = int(input())\nh = list(map(int, input().split()))\nh = np.array(h)\n\ncount = 0\n\nfor k in range(max(h)):\n j = 0\n for i in range(0,len(h)):\n if h[i]==0 and i!=j:\n h[j:i] = h[j:i] -1\n count = count+1\n j = i + 1\n elif i ==len(h)-1 an...
['Runtime Error', 'Accepted']
['s713297656', 's643875361']
[12420.0, 22188.0]
[187.0, 384.0]
[432, 434]
p03147
u137542041
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['H = [0] + H\ncnt = 0\nfor i in range(1, N + 1):\n cnt += max(H[i] - H[i - 1], 0)\n\n\nprint(cnt)\n', 'N = int(input())\nH = list(map(int, input().split()))\n\nH = [0] + H\ncnt = 0\nfor i in range(1, N + 1):\n cnt += max(H[i] - H[i - 1], 0)\n\n\nprint(cnt)']
['Runtime Error', 'Accepted']
['s739538803', 's493028180']
[9032.0, 9120.0]
[25.0, 26.0]
[94, 147]
p03147
u143509139
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
["N = int(input())\nH = list(map(int, input().split()))\nans = 0\n\n\ndef mizuyari(*f):\n print(f)\n if len(f) == 0:\n return\n min_i = f.index(min(f))\n if f[min_i] != 0:\n global ans\n ans += f[min_i]\n print('ans=', ans)\n f = [i - f[min_i] for i in f]\n print(f)\n ...
['Wrong Answer', 'Accepted']
['s031262496', 's273533057']
[3188.0, 3064.0]
[20.0, 18.0]
[451, 349]
p03147
u159335277
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\n\nv = list(map(int, input().split()))\n\ndef dfs(l, r):\n if l == r:\n return 0\n m = 100\n for i in range(l, r):\n m = min(m, v[i])\n if m == 0:\n return 0\n res = 0\n for i in range(l, r):\n v[i] -= m\n last = 0\n for i in range(l, r):\n if v[i] == 0:\n res += dfs(last,...
['Wrong Answer', 'Accepted']
['s157490367', 's929813780']
[3064.0, 3064.0]
[19.0, 22.0]
[353, 442]
p03147
u160244242
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
["import numpy as np\n\nn = input()\narray = np.array(list(map(int, input().split())))\n\ncount = 0\ndef recur(array):\n global count\n if len(array) == 0 :\n pass\n else:\n print('plus :', min(array))\n count += min(array)\n array = array - min(array)\n for i in range(len(ar...
['Wrong Answer', 'Accepted']
['s789198709', 's755293488']
[12496.0, 20868.0]
[159.0, 338.0]
[520, 484]
p03147
u160939083
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\n\nl_0 = list(map(int , input().split()))\n\nL = [l_0]\n\nm = None\n\ncount = 0\n\nwhile L != []:\n\tfor l in L:\n\t\tlis = l\n\t\tm = min(l)\n\t\tfor i in range(len(l)):\n\t\t\tlis[i] = lis[i] - m\n\t\tcount += m\n\t\tlis = "_".join( list(map(str , lis)) )\n\t\tif lis[0:1] == "0":\n\t\t\tlis = lis...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s169717009', 's818137961', 's867478327', 's035783834']
[3064.0, 3064.0, 3064.0, 3064.0]
[21.0, 17.0, 22.0, 21.0]
[548, 312, 548, 507]
p03147
u166340293
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N=int(input())\nh=list(map(int,input().split()))\ns=0\nmini=100\ndef garden(N,h,s,mini):\n p=[]\n a=0\n b=0\n size=0\n for i in range (N):\n if mini>h[i]:\n mini=h[i]\n if i!=N-1:\n if h[i]>h[i+1]:\n p.append(h[i])\n a+=h[i]\n size+=1\n if i!=N-1 and i!=0:\n if h[i]<h...
['Runtime Error', 'Accepted']
['s660474917', 's653880745']
[5108.0, 2940.0]
[154.0, 17.0]
[706, 124]
p03147
u172035535
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['i = 0\nans = 0\nwhile True:\n if i >= len(S):\n \n break\n for j in range(i+1,len(S)+1):\n #print(S[i:j])\n a = max(S[i:j])\n if j >= len(S):\n #print(1,S[i:j],i,j,ans)\n ans += max(S[i:j])\n i += j\n break\n elif a <= S[j]:\n...
['Runtime Error', 'Accepted']
['s009738338', 's899462814']
[3064.0, 3064.0]
[17.0, 18.0]
[528, 571]
p03147
u175590965
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh = list(map(int,input().split()))\ncnt = 0\nfor i in range(n-1):\n cnt +=min(h[i],h[i+1])\nprint(sum[h]-cnt)', 'n = int(input())\nh = list(map(int,input().split()))\ncnt = 0\nfor i in range(n-1):\n cnt +=min(h[i],h[i+1])\nprint(sum(h)-cnt)\n']
['Runtime Error', 'Accepted']
['s323518140', 's480764907']
[2940.0, 3064.0]
[17.0, 17.0]
[125, 126]
p03147
u177040005
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['import numpy as np\nN = int(input())\nH = np.array(list(map(int,input().split())))\n\nans = 0\nwhile np.max(H) != 0:\n min_h_p = 0\n for i in range(N):\n if H[i] == 0 and min_h_p > 0:\n ans += min_h_p\n H[st:i] -= min_h_p\n break\n elif i == N-1:\n if mi...
['Runtime Error', 'Accepted']
['s193565628', 's889920419']
[15764.0, 12484.0]
[2108.0, 159.0]
[707, 611]
p03147
u177796455
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nlist = input().split()\n\nfor t in range(len(list)):\n list[t] = int(list[t])\n\ncnt = 0\n\nfor idx in range(n):\n t_min = min(list[idx:n])\n for idx2 in range(idx,n):\n if 0 != list[idx2]:\n break\n else:\n list[idx2] = list[idx2]-1\n cnt += 1\n\nprin...
['Wrong Answer', 'Accepted']
['s776812719', 's486162273']
[3060.0, 3064.0]
[17.0, 19.0]
[308, 696]
p03147
u181526702
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nh = list(map(int, input().split()))\n\npeak = []\ntrough = []\nh = [0] + h + [0]\nfor a, b, c in zip(h[:-2], h[1:-1], h[2:]):\n ab = b - a\n bc = c - b\n if ab * bc < 0:\n if bc < 0:\n peak.append(b)\n else:\n trough.append(b)\n\nprint(sum(peak) - sum(tro...
['Wrong Answer', 'Accepted']
['s630394867', 's499349851']
[3064.0, 3064.0]
[17.0, 17.0]
[308, 347]
p03147
u183509493
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh = list(map(int,input().split()))\nans = 0\nfor _ in range(100):\n streak = False\n for i in range(n):\n if h[i] > 0:\n h[i] -= 1\n if streak:\n pass\n else:\n ans += 1\n else:\n streak = False\nprint(ans)\n', 'n = int(input())\nh = list(map(int,input().spl...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s128991402', 's917816101', 's140552353']
[2940.0, 3060.0, 2940.0]
[20.0, 19.0, 26.0]
[253, 236, 275]
p03147
u190850294
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
["import sys\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range...
['Runtime Error', 'Runtime Error', 'Accepted']
['s239500009', 's327492537', 's571526205']
[9072.0, 8924.0, 9224.0]
[23.0, 23.0, 29.0]
[1366, 1366, 1367]
p03147
u194894739
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nH = list(map(int, input().split()))\n\nres = 0; i = 0\nwhile True:\n if max(H) == 0:\n break\n\n while i < N:\n if H[i] == 0:\n i += 1\n else:\n res += 1\n while i < N and H[i] > 0:\n H[i] -= 1\n i += 1\nprint(...
['Time Limit Exceeded', 'Accepted']
['s925472720', 's672683470']
[3064.0, 3188.0]
[2104.0, 18.0]
[307, 405]
p03147
u196746947
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['import sys \nsys.setrecursionlimit(1000)\nn=int(input())\nH=list(map(int,input().split()))\ndef bunkai(H):\n B=[]\n b=0\n f=0\n for i in range(len(H)):\n if H[i]==0:\n if i!=0:\n B.append(H[b:i-1+1])\n b=i+1\n else:\n b=i+1\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s052803410', 's118179726', 's256807533', 's605790987']
[3064.0, 3064.0, 3064.0, 3064.0]
[19.0, 19.0, 19.0, 19.0]
[909, 909, 893, 1005]
p03147
u201463102
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['# coding: utf-8\n# Your code here!\nimport numpy as np\nN = int(input())\nL = np.array(list(map(int, input().split())))\n\ncnt = 0\nwhile np.any(L > 0):\n for i in range(N):\n if L[i] > 0:\n start = i\n end = i + 1\n for j in range(start+1, N):\n end = j\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s061362838', 's791522039', 's030998069']
[14740.0, 12504.0, 12508.0]
[240.0, 166.0, 164.0]
[514, 499, 496]
p03147
u211259428
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nh = list(map(int,input().split()))\n\nlmin = [] \nlmax = [] \n\nfor i in range(i,N-1):\n if (h[i] >= h[i-1]) and (h[i] > h[i+1]):\n lmax.append(h[i])\n \nfor k in range(i,N-1):\n if (h[i] <= h[i-1]) and (h[i] < h[i+1]):\n lmin.append(h[i])\n\nans = sum(lmax) - sum(lmin)\n\npri...
['Runtime Error', 'Runtime Error', 'Accepted']
['s154921728', 's588299043', 's548111567']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[354, 353, 1008]
p03147
u216915417
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\narr = list(map(int,input().split()))\nN+=1\narr.append(0)\nnow = 0\nmin = 100\ncount = 0\nprint(arr)\n\nwhile True:\n min = 100\n if arr[now] == 0:\n now += 1\n if now == N:\n break\n else:\n for i in range(now,N):\n if min > arr[i]:\n if arr[i] == 0:\n last = i...
['Wrong Answer', 'Accepted']
['s535811896', 's465613372']
[3064.0, 3064.0]
[19.0, 19.0]
[464, 453]
p03147
u219607170
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nH = list(map(int, input().split()))\nnum = 0\nwhile H:\n \n for i in range(N):\n if H[i] != 0:\n while H[i] != 0:\n H[i] -= 1\n i += 1\n num += 1\nprint(num)', 'def get_nonzero_range(A):\n start, end = None, None\n N = len(A)\n for i ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s419761958', 's747382112', 's881024492', 's467517161']
[3060.0, 3064.0, 3628.0, 3064.0]
[2104.0, 35.0, 43.0, 35.0]
[261, 568, 590, 560]
p03147
u221998589
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['import numpy as np\n#from numba import njit\n\n\n#A = np.array(list(map(int, input().split())))\nN = int(input())\nh = np.array(list(map(int, input().split())))\n\n\n\ndef solve(N,h):\n s = 0\n while (np.all(h > 0)):\n w = np.where(h > 0)[0]\n l = w[0]\n r = w[0]\n i = 1\n whi...
['Wrong Answer', 'Accepted']
['s048425315', 's887123307']
[27224.0, 27324.0]
[133.0, 220.0]
[556, 548]
p03147
u222668979
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['import cython\n\nn = int(input())\nh = list(map(int, input().split())) + [0]\n\nans,cnt = 0, sum(h)\nwhile cnt > 0:\n l, r = -1, n\n for num, i in enumerate(h):\n if (l == -1) and (i > 0):\n l = num\n if (l > -1) and (i == 0):\n r = num\n ans += 1\n cnt ...
['Runtime Error', 'Accepted']
['s246142857', 's630591069']
[3064.0, 3064.0]
[18.0, 72.0]
[402, 387]
p03147
u223904637
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nl=list(map(int,input().split()))\n\ndef yama(l):\n r=0\n zf=0\n a=[0]*(len(l)+2)\n for i in range(1,len(l)+1):\n a[i]=l[i-1]\n for i in range(0,len(l)+1):\n if a[i]>0 and zf==1:\n r+=1\n zf=0\n else:\n zf=1\nans=0\nwhile yama(l)==0:\...
['Wrong Answer', 'Accepted']
['s991141583', 's748329090']
[3064.0, 3064.0]
[17.0, 22.0]
[390, 410]
p03147
u226849101
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N=int(input())\nh=list(map(int,input().split()))\nans=0\nflag = False\nfor hei in range(1,101):\n for i in range(N+1):\n if h[i] >= hei or i!=N:\n flag = True\n else:\n if flag:\n ans+=1\n flag = False\nprint(ans)\n', 'N=int(input())\nh=list(map(int,input().split()))\nans=0\nflag = Fals...
['Runtime Error', 'Runtime Error', 'Accepted']
['s154242581', 's298539792', 's794047752']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 19.0]
[233, 233, 246]
p03147
u227082700
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=list(map(int,input().split()))\nans=0\nwhile h!=[0]*n:\n b=(h[0]!=0)+0\n for i in range(n):\n if b==1 and h[i]==0:ans+=1;b=0\n if h[i]!=0:h-=1;b=1\n if b==1:ans+=1\nprint(ans)', 'n=int(input())\nh=list(map(int,input().split()))+[0]\nans=0\nwhile sum(h):\n for i in range(n):\n if h[i]>0 ...
['Runtime Error', 'Accepted']
['s501318030', 's137134930']
[3064.0, 3060.0]
[17.0, 22.0]
[193, 161]
p03147
u227476288
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nh = [int(i)-1 for i in input().split()]\nh.append(0)\n\ncnt = 1\nfor H in range(max(h)-1):\n #print(h)\n for i in range(N):\n if h[i] >0:\n h[i] -= 1\n if h[i+1] == 0:\n cnt +=1\n\nprint(cnt)', 'N = int(input())\nh = [int(i) for i in input().split()]...
['Wrong Answer', 'Accepted']
['s688665009', 's981680329']
[3060.0, 3060.0]
[19.0, 19.0]
[246, 242]
p03147
u231615655
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['ctr = 0\n\ndef mizuyari(left, right, array):\n # left <= x <= right\n N = right - left\n if N == 0:\n global ctr\n ctr += array[left]\n elif N == 1:\n mini = max(array[left], array[right])\n ctr += mini\n if array[left] != 0:\n array[left] -= mini\n els...
['Wrong Answer', 'Accepted']
['s070710326', 's750509096']
[3064.0, 3064.0]
[19.0, 18.0]
[953, 912]
p03147
u239342230
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N=int(input())\nH=list(map(int,input().split()))\ncnt=0\nfor i in range(len(H)-1):\n if H[i]>H[i+1]:\n cnt+=1\nprint(max(H)+cnt)', 'N=int(input());a=0;t=0\nfor h in map(int,input().split()):\n a+=max(h-t,0);t=h\nprint(a)']
['Wrong Answer', 'Accepted']
['s035590852', 's272118071']
[2940.0, 2940.0]
[18.0, 17.0]
[132, 88]
p03147
u242196904
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['import numpy as np\nn = int(input())\nh = list(map(int, input().split()))\n\nh = np.array(h)\n\nh_zero = np.hstack([np.zeros(1), h, np.zeros(1)])\n\nd = np.diff(h_zero)\n\na= (d[:-1] * d[1:]) < 0\n\nh_a = h[a == True]\n\ns = 0\nfor k in range(len(h_a)):\n \n if k%2 == 0:\n \n \n if k ==...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s385249229', 's667157877', 's897425713', 's713086829']
[21764.0, 12508.0, 3064.0, 21516.0]
[514.0, 164.0, 19.0, 769.0]
[528, 351, 509, 358]
p03147
u251123951
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['\n\n\n\n\nn = int(input())\nflower_height = list(map(int, input().split()))\ncount=0\ndef mizuyari(a):\n return a-1\n\n\n\n\nfor i in range(n):\n j=i\n while flower_height[i]!=0:\n while i < n-1:\n if flower_height[i+1] != 0: i+=1\n else: break\n flower_height = list(map(m...
['Wrong Answer', 'Accepted']
['s259234632', 's033283030']
[2940.0, 3060.0]
[54.0, 53.0]
[879, 899]
p03147
u259418313
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nflowers = list(map(int, input().split()))\nflowers.append(max(flowers))\ncnt = 0\nfor i in range(sum(flowers)):\n if(all([x<0 for x in flowers])): break\n print(flowers, i, cnt)\n flowers = list(map(lambda x: (x-1), flowers))\n for j in range(n):\n if(flowers[j] > 0 and flowers[j+...
['Runtime Error', 'Accepted']
['s155068343', 's173095245']
[3064.0, 3064.0]
[21.0, 34.0]
[340, 469]
p03147
u262869085
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N =int(input())\nl =[int(i)for i in input().split()]\n\nmin = []\nmax = []\nans =0\nwhile l !=[0]*N:\n ans += 1\n s =False\n for i,j in enumerate(l):\n if s:\n if j == 0:\n break\n if j !=0:\n s =True\n l[i]-=1\n print(l)\nprint(ans)\n', 'def f...
['Wrong Answer', 'Accepted']
['s198803967', 's274267733']
[4724.0, 3060.0]
[88.0, 37.0]
[291, 364]
p03147
u273038590
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh= list(map(int, input().split()))\ncnt=0\nfor i in range(n-1):\n if h[i+1]-h[i]<0:\n print(str(i) + ";" + str(h[i]) + str(h[i+1]))\n cnt = cnt + h[i]- h[i+1]\ncnt += h[n-1]\nprint(cnt)', 'n = int(input())\nh= list(map(int, input().split()))\ncnt=0\nfor i in range(n-1):\n if h[i...
['Wrong Answer', 'Accepted']
['s583971297', 's657280408']
[3060.0, 3060.0]
[17.0, 17.0]
[213, 158]
p03147
u283719735
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['count = 0\n\ndef rec(l, r):\n global count\n global h\n global s\n\n print(l, r)\n if l >= r:\n return\n\n zero = list()\n for i in range(l, r):\n if h[i] == 0:\n zero.append(i)\n\n if len(zero) > 0:\n for i in zero:\n if not (l, i) in s:\n ...
['Wrong Answer', 'Accepted']
['s426938664', 's496293741']
[4232.0, 3572.0]
[100.0, 82.0]
[630, 614]
p03147
u286955577
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['def solve():\n\tN = int(input())\n\th = [int(i) for i in input().split()]\n return N * max(h) - sum(h)\n\nprint(solve())', 'def solve():\n\tN = int(input())\n\th = [int(i) for i in input().split()]\n ans = 0\n\tfor i in range(1, N):\n\t\tans += max(h[i] - (0 if i - 1 < 0 else h[i - 1]), 0)\n\treturn ans\n\nprin...
['Runtime Error', 'Runtime Error', 'Accepted']
['s763651297', 's875151002', 's518179017']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0]
[116, 187, 185]
p03147
u288087195
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['# -*- coding: utf-8 -*-\n\nN = int(input())\nh = list(map(int, input().split()))\n\n\ndef calc(list_h):\n if not list_h:\n return 0\n\n min_height = min(list_h)\n list_h = [list_h[i] - min_height for i in range(len(list_h))]\n zero_indexes = [i for i, x in enumerate(list_h) if x == 0]\n\n if not...
['Wrong Answer', 'Accepted']
['s676381383', 's417858633']
[3188.0, 3188.0]
[18.0, 18.0]
[493, 506]
p03147
u288430479
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nl = [0]+list(map(int,input().split()))\ns = 0\nwhile len(set(l))!=1:\n for i in range(n+1):\n if l[i]==0:\n if l[i+1]==0:\n break\n for j in range(i+1,n+2):\n if l[j]!=0:\n l[j] -=1\n continue\n else:\n s += 1\n break\nprint(s)...
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s224764598', 's244694234', 's227325009']
[3060.0, 3060.0, 3064.0]
[2104.0, 2108.0, 59.0]
[303, 315, 422]
p03147
u294385082
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['多分再帰使うんだろうね', '\nN = int(input())\n*H, = map(int, input().split())\n \nT = [0]*N\nans = 0\ni = 0\nwhile i<N:\n \n if T[i]<H[i]:\n start = i\n high = T[i]+1\n ans = ans + 1\n i = 0\n for j in range(start, N, 1):\n if T[j]<H[j]:\n T[j] = T[j] + 1\n ...
['Runtime Error', 'Accepted']
['s222243752', 's622429138']
[3064.0, 3064.0]
[18.0, 80.0]
[33, 410]
p03147
u296518383
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N=int(input())\nh=list(map(int,input().split()))\n\nw=0\nwhile 1:\n if w==0 and h[0]>0:\n w+=1\n for i in range(N):\n if h[i]>0:\n h[i]-=1\n if i<N-1 and h[i]==0 and h[i+1]>0:\n w+=1\n #print(h) \n if sum(h)==0:\n break\nprint(w)', 'N=int(input())\nh=list(map(int,input().split()))\n\nans=0\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s027086736', 's499476257', 's844938015']
[3060.0, 3064.0, 3060.0]
[20.0, 24.0, 21.0]
[240, 247, 248]
p03147
u300579805
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nA = [0] * N\nfor i in range(N):\n A[i] = int(input())\n\nlst=sorted(set(A))\n\ntarget = {}\nfor i in range(len(lst)):\n target[lst[i]] = i\n \nfor a in A:\n print(target[a])', 'N = int(input())\nH = list(map(int, input().split()))\n\nans = 0\nwhile(max(H)>=0):\n ans +=1\n for i in ...
['Runtime Error', 'Accepted']
['s507665848', 's576293578']
[3060.0, 3064.0]
[18.0, 26.0]
[191, 273]
p03147
u300968187
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh_list = list(map(int, input().split()))\nleft = 0\nright = 0\ncnt = 0\nwhile True:\n stop = False\n for i in range(left, n):\n if h_list[i] <= 0:\n stop = True\n right = i\n break\n if not stop and cnt != 0:\n right = n\n else:\n bre...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s512357575', 's661763666', 's033432422']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 37.0]
[720, 386, 532]
p03147
u304630225
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N=int(input())\nL=[0]+list(map(int,input().split()))\nL.append(0)\nprint(L)\nM=0\nfor i in range(N+1):\n if L[i+1] > L[i] :\n M+=(L[i+1]-L[i])\nprint(M)\n ', 'N=int(input())\nL=[0]+list(map(int,input().split()))\nM=0\nfor i in range(N):\n if L[i+1] > L[i] :\n M+=(L[i+1]-L[i])\nprint(M)']
['Wrong Answer', 'Accepted']
['s513852025', 's273344176']
[3060.0, 2940.0]
[17.0, 17.0]
[151, 125]
p03147
u305366205
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['h = list(map(int, input().split()))\nans = 0\nwhile sum(h) != 0:\n left = float("inf")\n right = float("inf")\n for i in range(n):\n if h[i] > 0:\n left = i\n break\n for j in range(i + 1, n):\n if h[j] <= 0:\n right = j\n break\n if right == fl...
['Runtime Error', 'Accepted']
['s857374669', 's077952765']
[3064.0, 3064.0]
[18.0, 53.0]
[409, 717]
p03147
u309141201
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\n# h = list(map(int, input().split()))\nh = [0]\nfor _ in range(N):\n h.append(int(input()))\nanswer = 0\nfor i in range(1, N+1):\n answer += max(H[i] - H[i-1], 0)\n\nprint(answer)', 'N = int(input())\nH = [0] + [int(a) for a in input().split()]\n# for _ in range(N):\n# h.append(int(input()...
['Runtime Error', 'Accepted']
['s227301780', 's885540806']
[2940.0, 2940.0]
[17.0, 19.0]
[194, 196]
p03147
u311379832
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nh = list(map(int, input().split()))\ncnt = 0\nstart = 0\nend = 0\nwhile True:\n for i in range(N):\n if h[i] != 0:\n start = i\n break\n if start == 0:\n break\n\n end = N\n for i in range(start + 1, N):\n if h[i] == 0:\n end = i\n ...
['Wrong Answer', 'Accepted']
['s921238898', 's294431700']
[3064.0, 3064.0]
[47.0, 47.0]
[459, 509]
p03147
u328755070
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nh = list(map(int, input().split()))\n\ndef minus(l,x):\n for i in range(len(l)):\n l[i] = l[i] - x\n \n\ncount = 0\ncount += min(h)\nminus(h, min(h))\n\nprint(h)\nfor i in range(N-1):\n if h[i] > h[i+1]:\n count -= h[i+1]-h[i]\n \ncount += h[-1]\nprint(count)\n \n\n'...
['Wrong Answer', 'Accepted']
['s185601281', 's997976469']
[3064.0, 3064.0]
[17.0, 17.0]
[296, 281]
p03147
u329232967
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['\ndef count(h_list):\n if len(h_list) == 0:\n return 0\n if len(h_list) == 1:\n return h_list[0]\n if (h_list != 0).all():\n return 1 + count(h_list - 1)\n elif (h_list == 1).all():\n return 1\n return sum([count(x) for x in divide_by_zero(h_list)])\n\n\ndef divide_by_zero(a...
['Runtime Error', 'Accepted']
['s341165290', 's312949312']
[3064.0, 3316.0]
[18.0, 20.0]
[633, 618]
p03147
u332253305
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=list(map(int,input().split()))\nf=[0]*n\ncnt=0\nwhile 1:\n flag=0\n for i in range(n):\n if h[i]!=f[i]:\n f[i]+=1\n flag=1\n elif h[i]==f[i] and flag==1:\n cnt+=1\n flag=0\n if flag:==1\n cnt+=1\n\n if h == f:\n brea...
['Runtime Error', 'Accepted']
['s348735259', 's555172139']
[2940.0, 3060.0]
[17.0, 21.0]
[315, 313]
p03147
u337626942
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=list(map(int, input().split()))\nans=0\n\nfor i in range(n-1):\n ans+=max(h[i+1]-h[i], 0)\n\nprint(ans)', 'n=int(input())\nh=[0]+list(map(int, input().split()))\nans=0\n\nfor i in range(n):\n ans+=max(h[i+1]-h[i],0)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s485632901', 's909688610']
[2940.0, 2940.0]
[17.0, 17.0]
[117, 118]
p03147
u348868667
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['from collections import deque\nimport numpy as np\nN = int(input())\nh = np.array(list(map(int,input().split())))\ncount = 0\ntmp = deque()\ntmp.append(h)\nwhile True:\n st,en = -1,-1\n if len(tmp) == 0:\n break\n count += min(tmp[0])\n tmp[0] -= min(tmp[0])\n if list(tmp[0]) == [0]*len(tmp[0]):...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s234871094', 's793523719', 's872036965']
[12504.0, 14560.0, 21016.0]
[397.0, 2108.0, 293.0]
[723, 655, 708]
p03147
u350093546
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nx=list(map(int,input().split()))\nans=0\nfor i in range(n-1):\n ans+=max(0,x[i+1]-x[i])\nprint(ans)', 'n=int(input())\nx=list(map(int,input().split()))\nans=0\nfor i in range(n-1):\n ans+=max(0,x[i+1]-x[i])\nprint(ans+x[0])\n']
['Wrong Answer', 'Accepted']
['s945645184', 's746855316']
[3060.0, 2940.0]
[18.0, 17.0]
[111, 117]
p03147
u358051561
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
["N = int(input())\nh = list(map(int, input().split()))\n\ninitial_gr_list = [h]\n\nnum = 0\ndef func(gr_list):\n global num\n n_gr_list = [] \n n2_gr_list = [] \n \n num_ima = int(num) \n \n \n for gr in gr_list:\n if gr == []:\n pass\n else: \n n_gr = []\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s139878291', 's652240559', 's763209225']
[3064.0, 3064.0, 3188.0]
[17.0, 17.0, 19.0]
[1789, 1796, 1819]
p03147
u359856428
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['nums = []\nnums.append(int(input()))\n\nfor i in range(1,100000):\n if nums[i - 1] % 2 == 0:\n nums.append(nums[i - 1] // 2)\n else:\n nums.append(nums[i - 1] * 3 + 1)\n if i >= 3 and nums[i] == 4 and nums[i - 3] == 4:\n print(i + 1)\n break\n', 'nums = []\nnums.append(int(input()...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s009224406', 's840939282', 's296763734']
[3064.0, 4328.0, 3060.0]
[18.0, 100.0, 18.0]
[269, 251, 229]
p03147
u367130284
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['from itertools import*\nfrom numpy import*\nn,*a=map(int,open(0).read().split())\nprint(a)\nif set(a)=={0}:\n print(0)\n exit()\na=array(a)\ncount=0\nans=0\nwhile 1:\n count=min(a[a!=0])\n ans+=count*sum(k for k,v in groupby(a>0)if k==True)\n a=a-min(a[a!=0])\n a[a<0]=0\n if sum(a)==0:\n b...
['Wrong Answer', 'Accepted']
['s245644205', 's196203636']
[12512.0, 2940.0]
[169.0, 17.0]
[317, 114]
p03147
u371467115
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=list(map(int,input().split()))\ncnt=0\nwhile set(h)=={0}\n if h not in 0:\n for i in range(len(h)):\n h[i]=h[i]-min(h)\n cnt+=min(h)\n else:\n for i in range(len(h)):\n l=[]\n if h[i]==0:\n else:\n l.append(h[i])\n continue\n cnt+=min(l)\nprint(cnt...
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s551491257', 's913547653', 's952531513']
[2940.0, 3064.0, 2940.0]
[17.0, 2104.0, 17.0]
[303, 339, 127]
p03147
u372144784
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nlist1 = list(map(int,input().split()))\ncout = 0 \nnow_water = 0 \ni = 0\ndef func(flower):\n\tglobal cout\n\tglobal i\n\tif flower == n-1: \n\t\tif list1[flower] <= now_water:\n\t\t\tcout += 1\n\t\t\ti = flower + 1\n\t\t\treturn\n\t\telse:\n\t\t\tcout += 1\n\t\t\ti = flower + 1\n\t\t\treturn\n\n\te...
['Wrong Answer', 'Accepted']
['s206145920', 's537050623']
[3064.0, 3064.0]
[21.0, 21.0]
[760, 777]
p03147
u392319141
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['N = int(input())\nH = list(map(int, input().split()))\nans = 0\n\nwhile max(H) > 0:\n grp = [[]]\n for i, h in enumerate(H):\n if h == 0:\n if len(grp[-1]) > 0:\n grp.append([])\n else:\n grp[-1].append((i, h))\n for g in grp:\n mi = min([h for _, h i...
['Runtime Error', 'Accepted']
['s431171639', 's167199424']
[3064.0, 3064.0]
[21.0, 21.0]
[387, 432]
p03147
u395202850
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
["def main():\n n = int(input())\n h = [list(map(int, input().split()))]\n ans = h[0]\n for i in range(n-1):\n if h[i+1] > h[i]:\n ans += h[i + 1]-h[i]\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n n = int(input())\n h = list(map(int, input().split())...
['Runtime Error', 'Accepted']
['s221815371', 's619396210']
[9172.0, 9176.0]
[28.0, 30.0]
[229, 227]
p03147
u396391104
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh = list(map(int,input().split()))\n\n\ndef WaterTime(list):\n times=0\n if list[0]!=0:\n times+=1\n for i in range(1,len(list)):\n if list[i]!=0 and list[i-1]==0:\n times+=1\n return times\n\nans=0\ntmp=0\nj=0\nwhile max(h) != 0:\n print(h)\n tmp = max(h)\...
['Wrong Answer', 'Accepted']
['s292088737', 's399925535']
[3064.0, 3064.0]
[23.0, 21.0]
[535, 493]
p03147
u397953026
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh = list(map(int,input().split()))\nans = 0\ntmp = 0\nfor i in range(len(h)):\n print(h[i])\n if tmp < h[i]:\n ans += h[i] - tmp\n tmp = h[i]\nprint(ans)', 'n = int(input())\nh = list(map(int,input().split()))\nans = 0\ntmp = 0\nfor i in range(len(h)):\n if tmp < h[i]:\n an...
['Wrong Answer', 'Accepted']
['s093805830', 's648780584']
[9192.0, 9184.0]
[31.0, 28.0]
[178, 162]
p03147
u404057606
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n=int(input())\nh=list(map(int,input().split()))\nltani=h[0]\nyama=h[0]\nmizu=0\nif n==1:\n print(max(h))\nelif n==2:\n print(max(h))\nelse:\n for i in range(1,n-1):\n if h[i-1]>h[i] and h[i]<h[i+1]:\n rtani=h[i]\n mizu=mizu+yama-min(ltani,rtani)\n ltani=h[i]\n ...
['Wrong Answer', 'Accepted']
['s467024197', 's291455069']
[3064.0, 2940.0]
[17.0, 17.0]
[554, 145]
p03147
u404676457
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['s = int(input())\nl = {s}\nif s % 2 == 0:\n s //= 2\nelse:\n s = s * 3 + 1\ni = 1\nwhile s not in l:\n l.add(s)\n if s % 2 == 0:\n s //= 2\n else:\n s = s * 3 + 1\n i += 1\nelse:\n i += 1\nprint(i)', 'n = int(input())\ns = list(map(int, input().split()))\ncount = 0\nsidx = 0\n\nls =...
['Wrong Answer', 'Accepted']
['s613432429', 's191398357']
[2940.0, 3064.0]
[18.0, 19.0]
[216, 467]
p03147
u413165887
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n = int(input())\nh = list(map(int, input().split()))\nhantei = [0 for _ in range(n)]\nhantei.append(1)\nresult = 0\nh.append(10*3)\n\nwhile any(hantei[i] != 1 for i in range(n)):\n min_h = min(h)\n cost = 0\n for i in range(len(h)):\n if hantei[i]==1:\n result += cost\n cost = 0...
['Runtime Error', 'Accepted']
['s019527136', 's449471351']
[3064.0, 3064.0]
[17.0, 24.0]
[464, 465]
p03147
u417365712
2,000
1,048,576
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by repeating the following "watering" operation: * Specify intege...
['n, *H = map(int, open(0).read().split())\n\ninc = True\npeaks = [], []\nfor h0, h1 in zip(H, H[1:]):\n if inc:\n if h0 > h1:\n peaks.append(h0)\n inc = False\n else:\n if h0 < h1:\n peaks.append(-h0)\n inc = True\nif inc:\n peaks.append(H[-1])\nprint(...
['Runtime Error', 'Accepted']
['s997268051', 's461255603']
[3060.0, 2940.0]
[17.0, 17.0]
[314, 311]