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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03147 | u430726059 | 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\nnum=0\nfor i in range(n):\n if num<h[i]:\n ans+=h[i]-num\n cnt=h[i]\nprint(ans)', 'n=int(input())\nh=list(map(int, input().split()))\nans=0\nnum=0\nfor i in range(n):\n if num<h[i]:\n ans+=h[i]-num\n num=h[i]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s887738948', 's338939510'] | [9072.0, 9088.0] | [27.0, 28.0] | [134, 134] |
p03147 | u440129511 | 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()))\nl=[0]\nc='plus'\nfor i in range(n-1):\n if c=='minus' and h[i]<=h[i+1]:\n l.append(i)\n if h[i]<=h[i+1]:c='plus'\n else:c='minus'\n\nw=0\nm=0\nfor i in range(len(l)-1):\n w+=max(h[l[i]:l[i+1]+1])-m\n m=h[l[i+1]]\nw+=max(h[l[-1]:n])-m\nprint(w)", "n=int(input())\... | ['Runtime Error', 'Accepted'] | ['s324589086', 's394052874'] | [3064.0, 3064.0] | [18.0, 17.0] | [284, 299] |
p03147 | u440975163 | 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())\ns = list(int(input()))\ncost = s[0]\nfor i in range(1, n):\n if s[i - 1] < s[i]:\n cost += s[i] - s[i - 1]\nprint(cost)', 'n = int(input())\ns = list(map(int, input().split()))\ncost = s[0]\nfor i in range(1, n):\n if s[i - 1] < s[i]:\n cost += s[i] - s[i - 1]\nprint(cost)'] | ['Runtime Error', 'Accepted'] | ['s123412897', 's514977968'] | [2940.0, 2940.0] | [17.0, 17.0] | [141, 154] |
p03147 | u442030035 | 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_h = [0 for i in range(N)]\njudge = [False if f_h[i] != h[i] else True for i in range(N)]\n\nct = 0\nwhile False in judge:\n flg = 0\n for i in range(N):\n if judge[i] is False:\n flg = 1\n f_h[i] += 1\n if f_h[i] ==... | ['Wrong Answer', 'Accepted'] | ['s795532309', 's771315582'] | [3064.0, 3064.0] | [20.0, 21.0] | [481, 663] |
p03147 | u454043187 | 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# N = int(input())\nh = list(map(int, input().split()))\nhmin = min(h)\ncount =+ min(h)\nh = list(map(lambda x: x-hmin ,h))\nhmax = max(h)\nif hmax == 0:\n print(count)\nh.append(0)\nhamx = max(h)\nwhile hmax != 0:\n for i in range(len(h)):\n if h[i] <= 0:\n continue\n elif ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s032611470', 's745254388', 's794828476'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 23.0] | [596, 528, 544] |
p03147 | u463655976 | 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()\nH = map(int, input().split())\n\nHk = set()\nfor h in H:\n Hk.add(h)\n\ndef po(h, s, e):\n if h >= Hk[-1]:\n return 1\n posS = s\n hit = False\n cnt = 0\n for posE in range(s, e+1):\n if posE >= e or H[posE] <= Hk[h]:\n hit or= (posE < e)\n\tif posS < posE:\n cnt += po(h+1, posS, po... | ['Runtime Error', 'Accepted'] | ['s430411486', 's200530638'] | [2940.0, 3064.0] | [17.0, 19.0] | [341, 365] |
p03147 | u474423089 | 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 i in range(N-1):\n ans += max(0,H[i+1]-H[i])\nprint(ans)", "N=int(input())\nH=list(map(int,input().split(' ')))\nans = H[0]\nfor i in range(N-1):\n ans += max(0,H[i+1]-H[i])\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s133592944', 's921642590'] | [2940.0, 2940.0] | [17.0, 17.0] | [120, 123] |
p03147 | u474925961 | 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()))\nh.insert(0,0)\nh.append(0)\np=max(h)\narr=np.array(h)\ncnt=0\nfor i in range(p,1,-1):\n x=np.copy(arr)\n x[x!=i]=0\n x[x==i]=1\n temp=np.arange(len(x))\n temp[x>0]=0\n np.maximum.accumulate(temp,out=temp)\n left=temp\n x_rev... | ['Wrong Answer', 'Accepted'] | ['s758520447', 's328851177'] | [14440.0, 12524.0] | [159.0, 157.0] | [577, 577] |
p03147 | u476124554 | 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()))\ndef f(arr):\n print(arr)\n if(sum(arr) == 0):\n return 0\n while(arr[0] == 0):\n arr.pop(0)\n while(arr[-1] == 0):\n arr.pop()\n if (min(arr) == 0):\n index = arr.index(0)\n return f(arr[0:index]) + f(arr[index: le... | ['Wrong Answer', 'Accepted'] | ['s894045717', 's712139336'] | [3064.0, 3064.0] | [19.0, 19.0] | [601, 586] |
p03147 | u494379309 | 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 all_water(h_list):\n if len(h_list) == 0:\n return 0\n min_h = min(h_list)\n new_list = [x - min_h for x in h_list]\n i = new_list.index(0)\n return min_h + all_water(new_list[:i]) + all_water(new_list[i+1:])\n\nn = input()\n\nheight = list(map(int,input().split(" ")))\n\nprint(allwater(height))', 'def al... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s151728389', 's331689781', 's367390276', 's244819957'] | [3060.0, 3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0, 18.0] | [296, 295, 303, 297] |
p03147 | u496744988 | 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 mizuyari(partial_list):\n count = 0\n print(partial_list)\n if len(partial_list) == 0:\n print('end return------------ 0 ')\n return 0\n if len(partial_list) == 1:\n print('end return------' + str(partial_list[0]))\n ... | ['Wrong Answer', 'Accepted'] | ['s234724453', 's644307093'] | [3316.0, 3188.0] | [27.0, 26.0] | [1182, 1194] |
p03147 | u497046426 | 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\n\n\nans = 0\nwhile sum(H) > 0:\n left = right = 0\n prev = -1\n segment = []\n for i, h in enumerate(H):\n if h == 0 and prev != 0:\n right = i\n if left != right:\n segment.append((left, right))\n ... | ['Wrong Answer', 'Accepted'] | ['s589342433', 's346529151'] | [3064.0, 3064.0] | [23.0, 20.0] | [723, 699] |
p03147 | u499966353 | 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())\nheights = list(map(int, input().split()))\n\ndef nextgen(comb):\n lis = comb[0]\n j = comb[1]\n for i in range(len(lis)-1):\n if (i != len(lis) and (lis[i] == 0 and lis[i+1] != 0)) or (i == 0 and lis[i] != 0):\n j += 1\n if lis[i] != 0:\n lis[i] -= 1\n ... | ['Runtime Error', 'Accepted'] | ['s422546790', 's543848712'] | [3064.0, 3064.0] | [18.0, 20.0] | [482, 540] |
p03147 | u506858457 | 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 range(N)]\nL.append(0)\nans=0\nfor i in range(N):\n ans+=max(0,L[i]-L[i+1])\nprint(ans)', 'N=int(input())\nL=[int(i) for i in input().split()]\n#L.append(0)\nL.insert(0,0)\nans=0\nfor i in range(N):\n ans+=max(0,L[i+1]-L[i])\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s084300224', 's570230901'] | [3316.0, 2940.0] | [20.0, 17.0] | [117, 140] |
p03147 | u509911932 | 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 bisect\n\n\ndef mizuyari(flowers):\n if flowers == []:\n return 0\n # print(flowers)\n minheight = min(flowers)\n if minheight == 0:\n if max(flowers) == 0:\n return 0\n leftindex = flowers.index(0)\n \n count = mizuyari(flowers[0:leftindex])+mizuyari(f... | ['Runtime Error', 'Accepted'] | ['s946960932', 's728264302'] | [4988.0, 3188.0] | [85.0, 18.0] | [585, 698] |
p03147 | u518042385 | 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())\nl=np.array(list(map(int,input().split())))\nc=0\nfor i in range(n):\n for j in range(i,n):\n if 0 in l[i:j+1]:\n pass\n else:\n l[i:j+1]=l[i:j+1]-np.array([min(l[i:j+1])]*(j-i+1))\n c+=min(l[i:j+1])\nprint(c)\n', 'n=int(input())\nl=list(map(int,input().split()... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s307810094', 's309359307', 's441131015', 's651079172'] | [12396.0, 2940.0, 12396.0, 12396.0] | [174.0, 20.0, 180.0, 176.0] | [256, 174, 231, 255] |
p03147 | u518064858 | 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 any(h)==True:\n flag=0\n for i in range(n):\n if h[i]>0:\n h[i]-=1\n flag=1\n else:\n if flag==1:\n ans+=1\n flag=0\n if i==n-2:\n if h[n-1]>0:\n ... | ['Wrong Answer', 'Accepted'] | ['s598782996', 's964825177'] | [3188.0, 3064.0] | [21.0, 20.0] | [470, 465] |
p03147 | u518987899 | 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().strip())\nH = list(map(int, input().strip().split(' ')))+[0]\ncount = 0\nfor _ in range(max(H)-1):\n l = 0\n for r in range(1,len(H)):\n if H[r] < H[l]:\n \n H[l:r] = [h-1 for h in H[l:r]]\n count += 1\n l = r\n elif H[r] > H[l]:\n しない\n l = r\n else:\n co... | ['Wrong Answer', 'Accepted'] | ['s189013237', 's093626185'] | [3064.0, 3064.0] | [23.0, 23.0] | [352, 343] |
p03147 | u525595811 | 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())\nhn = list(map(int, input().split()[:n]))\n\ni = 0\nres = []\nwhile True:\n for h in hn:\n if h > 0:\n res.append(h-1)\n else:\n res.append(h)\n hn = res\n res = []\n if sum(hn) == 0:\n print(i)\n break\n i += 1\n', 'n = int(input())\nh... | ['Wrong Answer', 'Accepted'] | ['s137444576', 's510238030'] | [2940.0, 2940.0] | [19.0, 17.0] | [278, 147] |
p03147 | u527261492 | 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\nn=int(input())\nh=list(map(int,input().split()))\nif len(set(h))==1:\n print(h[0])\n sys.exit()\nh.append(1-2)\ntotl=0\nfor i in range(1,max(h)+1):\n cnt=1\t\n for j in range(n):\n if h[j]<i:\n if i<=h[j+1]:\n cnt+=1\n totl+=cnt\nprint(totl)\n \n \n \n', 'import sys\nn=... | ['Wrong Answer', 'Accepted'] | ['s789419333', 's169730512'] | [3064.0, 3064.0] | [19.0, 19.0] | [280, 292] |
p03147 | u529012223 | 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()))\nh = np.array(h)\nh_diff = h[1:] - h[:N-1]\ncount = 0\nprint(h_diff)\nfor i in range(N-1):\n count -= min(h_diff[i], 0)\n \nprint(count + h[N-1])', 'import numpy as np\nN = int(input())\nh = list(map(int, input().split()))\nh = np.array(h... | ['Wrong Answer', 'Accepted'] | ['s938841667', 's878609293'] | [12488.0, 17824.0] | [151.0, 255.0] | [215, 201] |
p03147 | u536034761 | 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 down(H, n):\n x = min(H)\n n += x\n for i in range(len(H)):\n H[i] -= x\n return H, n\n\nN = int(input())\nH = list(map(int, input().split()))\nn = 0\nH, n = down(H, n)\nprint(H)\n\nwhile not all(h == 0 for h in H):\n L = []\n H0 =[]\n for h in H:\n if h != 0:\n L.append(h)\n else:\n if ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s313512992', 's480503818', 's726488842', 's727560315'] | [9172.0, 9068.0, 9136.0, 9180.0] | [30.0, 30.0, 29.0, 29.0] | [444, 435, 433, 424] |
p03147 | u540761833 | 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())\narray = input().split(' ')\nharray = []\nfor z in array:\n z = int(z)\n harray.append(z)\ncounter = 0\nwhile harray != [0]*N:\n if 0 not in harray:\n a = min(harray)\n for i in range(len(harray)):\n harray[i] -= a\n counter += a\n else:\n zeroarray ... | ['Time Limit Exceeded', 'Accepted'] | ['s944839547', 's749804536'] | [3192.0, 3064.0] | [2104.0, 19.0] | [1899, 487] |
p03147 | u545411641 | 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\nprint(h)\n\nans = 0\n\nwhile True:\n given_water = False\n is_continuous = False\n for i in range(N):\n if h[i] > 0:\n if is_continuous is False:\n ans += 1\n is_continuous = True\n h[i] -= 1\n given_water = True\n else: # ... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s626410758', 's931243385', 's867792818'] | [3064.0, 3060.0, 3060.0] | [20.0, 2104.0, 19.0] | [417, 380, 383] |
p03147 | u547167033 | 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()))\ndef dfs(l,r):\n if l==r:\n return h[l]\n if r<l:\n return 0\n res=10**18\n for i in range(l,r+1):\n res=min(res,h[i])\n for i in range(l,r+1):\n h[i]-=res\n for i in range(l,r):\n if h[i]==0:\n return dfs(l,i-1)+dfs(i+1,r)+res\n return 0\npr... | ['Wrong Answer', 'Accepted'] | ['s394341635', 's102353839'] | [3064.0, 3064.0] | [20.0, 18.0] | [317, 319] |
p03147 | u548303713 | 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 block():\n block=0\n count=0\n while count<=(n-1):\n if h[count]>=1:\n block+=1\n count+=1\n while count<=(n-1):\n if h[count]>=1:\n count+=1\n else:\n count+=1\n break\n retu... | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s792470462', 's928717578', 's650204067'] | [3064.0, 3064.0, 3060.0] | [2104.0, 2104.0, 36.0] | [506, 640, 282] |
p03147 | u551351897 | 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... | ['#include <bits/stdc++.h>\nusing namespace std;\ntemplate<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }\ntemplate<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }\ntypedef long long unsigned int ll;\n\n#define EPS (1e-7)\n#define INF (1e9)\n#defi... | ['Runtime Error', 'Accepted'] | ['s909230674', 's619369589'] | [2940.0, 3188.0] | [18.0, 38.0] | [851, 466] |
p03147 | u552357043 | 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()))\ngap = [0]\nmt = []\nva = []\ni = 0\nwhile i+1 <= len(h)-1:\n if h[i+1]-h[i] != 0:\n gap.append(h[i+1]-h[i])\n i += 1\n else:\n h.pop(i+1)\nfor i in range(h): \n if gap[i] >= 0: \n if gap[i+1] < 0:\n mt.append(h[i... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s130318131', 's329152074', 's709866956', 's373241383'] | [3064.0, 3064.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0, 18.0] | [510, 406, 509, 517] |
p03147 | u556225812 | 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 = list(map(int, input().split()))\ncnt = 0\nfor i in range(N-1):\n if lst[i] < lst[i+1]:\n cnt += \nprint(cnt)\n\n\n\n\n#139 c\nN = int(input())\nH = list(map(int, input().split()))\nmax_lst = []\nmin_lst = []\nmax_h = H[0]\nmin_h = H[0]\ns = 0\nfor i in range(1, N):\n if H[i-1] <= ... | ['Runtime Error', 'Accepted'] | ['s500796932', 's553553278'] | [2940.0, 3064.0] | [17.0, 20.0] | [1121, 264] |
p03147 | u557494880 | 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().split())\nH = list(map(int,input().split()))\ny = 0\nz = H[i]\nans = 0\nfor i in range(N):\n x = H[i]\n if x >= y:\n y = x\n else:\n ans += y\n z = min(z,x)\n for j in range(i,N):\n p = H[j]\n z = min(z,p)\n H[j] -= z\nprint(ans)\n ... | ['Runtime Error', 'Accepted'] | ['s073894911', 's689176328'] | [3064.0, 3064.0] | [17.0, 20.0] | [308, 545] |
p03147 | u560867850 | 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 fractions import gcd\nfrom functools import reduce\n\nN = int(input())\n\nH = list(map(lambda x: int(x) + 1, input().split()))\n\ndef it(items, count):\n if not items:\n return 0\n if len(items) == 1:\n return items[0] + count\n\n ids = [-1]\n for i in range(len(items)):\n items[... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s533303189', 's801565770', 's929053274'] | [5176.0, 3064.0, 2940.0] | [40.0, 22.0, 17.0] | [600, 584, 129] |
p03147 | u572343785 | 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_state=[0]*n\n\ndef water(n,h,h_state):\n for i in range(n):\n if h_state[i]<h[i]:\n l=i\n break\n elif i==n-1 and h_state[i]<h[i]:\n l=i\n else:\n l=i+1\n \n for j in range(l,n):\n if h_state[j]==h[j]:\n r=j-1\n b... | ['Runtime Error', 'Accepted'] | ['s175922160', 's620751184'] | [9104.0, 9220.0] | [25.0, 79.0] | [557, 609] |
p03147 | u583507988 | 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]\nma=0\nmi=float('inf')\nans=0\nfor i in range(n+1):\n if h[i]<=h[i+1]:\n ma=max(ma,h[i+1],h[i])\n mi=min(mi,h[i])\n else:\n ans+=ma-mi\n ma=0\n mi=float('inf')\nprint(ans)", "n=int(input())\nh=[0]+list(map(int,input().split()))+[0]\nma=0\nmi=fl... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s168255243', 's609208843', 's092365097'] | [9152.0, 9204.0, 9108.0] | [29.0, 30.0, 31.0] | [232, 227, 226] |
p03147 | u604341914 | 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 = [h - min(H) for h in H]\n\nans = 0\nfor i in range(N-1):\n diff = H[i+1] - H[i]\n if i != N-2:\n if diff < 0:\n ans += abs(diff)\n else:\n if diff < 0:\n ans += abs(diff)\n else:\n ans += H[-1]\n\... | ['Wrong Answer', 'Accepted'] | ['s027865266', 's674699632'] | [3064.0, 2940.0] | [17.0, 18.0] | [322, 156] |
p03147 | u606033239 | 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()))\na=0\nfor i in range(1,max(h)+1):\n s=0\n while s<n:\n if h[s]>=i:\n a+=1\n while s<n and h[s]>=i:\n s+=1\n s+=1\nprint(a)', 'n=int(input())\nh=list(map(int,input().split()))\na=0\nfor i in range(1,max(h)+1):\n s=... | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s024790793', 's028902732', 's858666344'] | [3060.0, 2940.0, 3060.0] | [2104.0, 20.0, 21.0] | [213, 161, 218] |
p03147 | u608053762 | 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 = [int(i) for i in input().split()]\n\nk = 0\nwhile sum(h_list)>0:\n bool_list = [True if i==max(h_list) else False for i in h_list]\n indexes = []\n true_index = bool_list.index(True)\n indexes.append(true_index)\n while bool_list(true_index):\n true_index += 1\n indexes.append(tr... | ['Runtime Error', 'Accepted'] | ['s412974261', 's356500248'] | [3060.0, 3064.0] | [18.0, 960.0] | [384, 484] |
p03147 | u609061751 | 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\ninput = sys.stdin.readline\nimport numpy as np\nN = int(input())\nh = [int(x) for x in input().split()] + [0]\nh = np.array(h,np.int64)\nans = 0\nfor i in range(N):\n if h[i] > 0:\n j = i + 1\n while h[j] > h[i]:\n h[j] -= h[i]\n j += 1\n nexth = h[j]\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s087036997', 's376401189', 's426727176'] | [12444.0, 12448.0, 12404.0] | [155.0, 152.0, 153.0] | [420, 365, 461] |
p03147 | u610473220 | 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())\nhList = list(map(int, input().split()))\n\nans = 0\ncou = 0\n\nhList = [0] + hList\n\nfor i in range(N):\n if hList[i] < hList[i+1]:\n cou = hList[i+1] - hList[i]\n else:\n ans += cou\n cou = 0\nans += cou\nprint(ans)', 'N = int(input())\nhList = list(map(int, input().spli... | ['Wrong Answer', 'Accepted'] | ['s355513854', 's887585712'] | [3064.0, 3064.0] | [18.0, 17.0] | [247, 250] |
p03147 | u621509924 | 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()))\np=h[0]\nfor i in range(N-1):\n if h[i]<h[i+1]:\n p=h[i+1]\n else:\n p=p\n\nq=1\nr=0\nif p==0:\n print(0)\nelse:\n while q<=p:\n if h[0]>=q:\n r=r+1\n else:\n r=r\n for i in range(N-1):\n if h[i]<q an... | ['Runtime Error', 'Accepted'] | ['s794731968', 's549672234'] | [3064.0, 3064.0] | [17.0, 19.0] | [392, 398] |
p03147 | u623687794 | 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=[0]+list(map(int,input().split()))\nans=0\nfor i in range(1,n+1):\n ans+=max(flowers[i+1]-flowers[i],0)\nprint(ans)', 'n=int(input())\nflowers=[0]+list(map(int,input().split()))\nans=0\nfor i in range(n):\n ans+=max(flowers[i+1]-flowers[i],0)\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s386744538', 's921053864'] | [2940.0, 2940.0] | [17.0, 18.0] | [135, 132] |
p03147 | u623819879 | 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()))\nhm=max(h)\ns=['']*hm\nfor k in range(hm+1):\n for i in range(n):\n if h[i]>=k:\n s[k]+='#'\n else:\n s[k]+=' '\n\nans=0\nfor k in range(hm+1):\n ans+=len(list(s[k].split()))\nprint(ans)", "n=int(input())\nh=list(map(int,input().split()))\nhm=max(h)\ns=['']*h... | ['Runtime Error', 'Accepted'] | ['s309589537', 's384371239'] | [3064.0, 3060.0] | [18.0, 20.0] | [231, 254] |
p03147 | u627886394 | 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(' ')))\n\n\ndef mizuyari(h_list, l, r):\n import pdb;pdb.set_trace()\n num_mizuyari = min(h_list[l:r+1])\n h_list = [h - num_mizuyari if l <= x and x <= r else h for x, h in enumerate(h_list)]\n zero_posi = h_list[l:].index(0) + l\n if l == zero_po... | ['Runtime Error', 'Accepted'] | ['s519321773', 's401581373'] | [6116.0, 3188.0] | [68.0, 19.0] | [898, 651] |
p03147 | u628707847 | 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 min(h) != 0:\n h = list(map(lambda x: x-1,h))\n ans += 1\n\nwhile sum(h) != 0:\n flag = False\n for i in range(n):\n if i == n-1:\n h[i] -= 1\n ans += 1\n break\n if h[i] == 0 and flag:\n ... | ['Wrong Answer', 'Accepted'] | ['s364009376', 's702558545'] | [3064.0, 3064.0] | [2103.0, 120.0] | [430, 603] |
p03147 | u634159866 | 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(input().split(), dtype=np.int32)\n\ndef myfunc(left, right):\n if right<left:\n return 0\n idx = left+H[left:right+1].argmin()\n m = H[idx]\n H[left:right+1]-=m\n return m+myfunc(left, idx-1)+myfunc(right, idx+1)\n\nprint(myfunc(0, N-1))', 'N ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s697441705', 's868515942', 's876100895'] | [12484.0, 3060.0, 14248.0] | [172.0, 17.0, 152.0] | [299, 279, 299] |
p03147 | u635182517 | 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 water(list_a):\n if list_a == [0] * len(list_a):\n return 0\n \n elif 0 in list_a:\n n = list_a.index(0)\n return water(list_a[:n]) + water(list_a[n+1:])\n\n else:\n mini = min(list_a)\n for i in range(len(list_a)):\n list_a[i] += mini\n return wate... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s675555375', 's922906020', 's902747472'] | [3060.0, 3060.0, 3192.0] | [17.0, 18.0, 18.0] | [396, 396, 402] |
p03147 | u644907318 | 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 countA(A):\n global cnt\n if len(A)==1:\n cnt += A[0]\n else:\n amin = min(A)\n A = [A[i]-amin for i in range(len(A))]\n cnt += amin\n while A:\n if A[0]==0:\n A.pop(0)\n elif A[-1]==0:\n A.pop()\n else:brea... | ['Runtime Error', 'Accepted'] | ['s914546743', 's875759998'] | [3188.0, 3188.0] | [19.0, 19.0] | [925, 956] |
p03147 | u647796955 | 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\nL = int(sys.stdin.readline().rstrip())\n\nif L == 1:\n h = int(sys.stdin.readline().rstrip())\nelse:\n h = list(map(int, sys.stdin.readline().rstrip().split()))\n\nL = N\nif L == 0:\n ans = 0\nelif L == 1:\n ans = N - h\nelif L == 2:\n ans = N - max(h)\n \nelse:\n grad1 = h[0] > h[1]\n p= 0\n v= ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s336871029', 's588431216', 's193528503'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [567, 539, 501] |
p03147 | u655975843 | 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()) + 1\nl = list(map(int, input().split()))\nl.append(0)\n\ncount = 0\n\nfor i in range(n):\n\twhile(l[i] > 0):\n\t\tfor j in range(i + 1, n):\n\t\t\tif l[j] == 0:\n\t\t\t\tbreak\n\t\tfor k in range(i, j):\n\t\t\tl[k] -= 1\n\t\tcount += 1\n\t\tprint(l)\nprint(count)\n\n\n\n', 'n = int(input()) + 1\nl = ... | ['Wrong Answer', 'Accepted'] | ['s531496278', 's462101214'] | [4724.0, 3060.0] | [64.0, 21.0] | [250, 235] |
p03147 | u664796535 | 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(input()) for _ in range(N)]\ncost = 0\nfor i in range(N-1):\n if H[i] > H[i+1]:\n cost += (H[i] - H[i+1])\ncost += H[N-1]\nprint(cost)\n ', "N = int(input())\nH = list(map(int, input().split(' ')))\ncost = 0\nfor i in range(N-1):\n if H[i] > H[i+1]:\n cost += (H[i] - H[i+1])\ncos... | ['Runtime Error', 'Accepted'] | ['s143162770', 's358254504'] | [3056.0, 2940.0] | [17.0, 17.0] | [163, 165] |
p03147 | u668503853 | 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()))\nc=0\nfor i in range(N):\n c+=max(h[i+1]-l[i],0)\nprint(c)', 'N=int(input())\nh=[0]+list(map(int,input().split()))\nc=0\nfor i in range(N):\n c+=max(h[i+1]-h[i],0)\nprint(c)'] | ['Runtime Error', 'Accepted'] | ['s635847295', 's176544832'] | [2940.0, 2940.0] | [18.0, 22.0] | [107, 107] |
p03147 | u677121387 | 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\n\nfor i in range(max(h)):\n st = 1 if h[0] != 0 else 0\n for j in range(n):\n if st == 1:\n if h[j] == 0:\n cnt += 1\n st = 0\n else:\n h[j] -= 1\n else:\n i... | ['Wrong Answer', 'Accepted'] | ['s404550277', 's844593199'] | [3064.0, 9088.0] | [19.0, 28.0] | [436, 123] |
p03147 | u682467216 | 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 math import floor, ceil, sqrt, factorial, log, gcd\nfrom itertools import accumulate, permutations, combinations, product, combinations_with_replacement\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict\nfrom heapq import heappop, heappush, heappushpop\nfrom copy import ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s027105237', 's047115147', 's894179012', 's321442774'] | [27216.0, 27068.0, 27160.0, 27112.0] | [113.0, 112.0, 115.0, 117.0] | [1413, 1424, 1399, 1378] |
p03147 | u691018832 | 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\nprint(len(h))\nfor i in h:\n if check < i:\n ans += i-check\n check = i\n\nprint(ans)\n', 'n = int(input())\nh = list(map(int, input().split()))\nans = 0\ncheak = 0\nif n == 1:\n ans += h[0] \nelif n != 0:\n for i in ran... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s112950002', 's299535562', 's146632941'] | [2940.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0] | [164, 354, 271] |
p03147 | u698416089 | 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 = input().split()\n\nmizuyari = 0\nfor i in range(int(sorted(h)[n-1])):\n maenohana = False\n mizuyari += thismizuyari\n thismizuyari = 0\n for j in range(n):\n if not maenohana and i+1<=int(h[j]):\n thismizuyari += 1\n maenohana = i+1<=int(h[j])\nprint(mizuyar... | ['Runtime Error', 'Accepted'] | ['s677611370', 's415833241'] | [3060.0, 3060.0] | [17.0, 20.0] | [308, 255] |
p03147 | u705621008 | 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())\na = list(map(int, input().split()))\n\nincFlg = True \nbefore_height = 0\nsum = 0\n\nfor i in range(len(a)-1):\n \n if a[i] > a[i+1]:\n \n if incFlg:\n sum += a[i] - before_height\n incFlg = False\n \n else:\n # before_height = a[i... | ['Runtime Error', 'Accepted'] | ['s523635921', 's312669482'] | [3064.0, 3060.0] | [17.0, 18.0] | [568, 572] |
p03147 | u708615801 | 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... | ['num = int(input())\ntargets = map(int, input().split())\ntargets = list(targets)\n\n\nwater_cnt = 0\ndef exe_water(init_state):\n # break condition\n if sum(init_state) == 0:\n return\n temp_water_cnt = min(init_state)\n water_cnt += temp_water_cnt\n\n lowest = temp_water_cnt\n # init sub_sta... | ['Runtime Error', 'Accepted'] | ['s274807852', 's196225981'] | [3060.0, 3064.0] | [17.0, 18.0] | [611, 709] |
p03147 | u711238850 | 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(1000000)\ndef watering(l,a,b):\n if b-a <= 1:\n return l[a]\n \n c = 0\n t = a\n \n mi = min(l[a:b])\n for i in range(a,b):\n l[i] -= mi\n \n for i in range(a,b):\n if l[i]==0:\n c += watering(l,t,i)\n t=i+1\n c += watering(l,t,b)\n \n return c+mi... | ['Runtime Error', 'Accepted'] | ['s986848077', 's309147375'] | [3064.0, 3064.0] | [18.0, 18.0] | [376, 400] |
p03147 | u714378447 | 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\nimport copy\nN=int(input())\nH = [int(x) for x in input().split()]\n\nif N==1:\n print(H[0])\n sys.exit()\n\ncnt=0\nwhile True:\n f=True\n for h in H:\n if h!=0:\n f=False\n break\n if f:\n break\n\n H_new = copy.copy(H)\n if H[0]!=0 and H[1]==0:\n ... | ['Wrong Answer', 'Accepted'] | ['s863526293', 's297277969'] | [3444.0, 3444.0] | [27.0, 25.0] | [500, 512] |
p03147 | u724742135 | 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 math import factorial\nfrom sys import exit, stdin\nN = int(stdin.readline().rstrip())\nH = [int(_) for _ in stdin.readline().rstrip().split()]\nans = 0\nfor i in range(1,n):\n if H[i-1] > H[i]:\n ans += H[i-1]-H[i]\nans += H[-1]\nprint(ans)', 'from math import factorial\nfrom sys import exit, stdin\nN... | ['Runtime Error', 'Accepted'] | ['s032643065', 's494305390'] | [3060.0, 3188.0] | [17.0, 19.0] | [247, 247] |
p03147 | u729938879 | 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())\nheight = list(map(int, input().split())) \nwater_count = 0 \nwhile True:\n index = [i for i, v in enumerate(height) if v >0] \n \n \n min_index = index[0] \n max_index = index[0] \n \n while True:\n if max_index+1 in index:\n max_index += 1\n else:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s253218401', 's334192988', 's610188073'] | [3064.0, 3064.0, 3064.0] | [18.0, 55.0, 53.0] | [995, 977, 1102] |
p03147 | u732061897 | 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\nactive = 0\nfor i in range(N):\n h = H[i]\n ans += min(0, h - active)\n active = h\nprint(ans)\n', 'N = int(input())\nH = list(map(int, input().split()))\nans = 0\nactive = 0\nfor i in range(N):\n h = H[i]\n ans += min(0, h - active)\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s012824037', 's835408298', 's112929968'] | [9084.0, 9084.0, 9160.0] | [26.0, 29.0, 29.0] | [160, 160, 168] |
p03147 | u732468087 | 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 = map(int, input().split())\nh = list(map(int, input().split()))\n\nloc_max = h[0]\ncount = 0\n\nfor i in range(1, N):\n if h[i] >= loc_max:\n loc_max = h[i]\n if h[i] < h[i-1]:\n count = count + loc_max - h[i]\n loc_max = 0\n if i == N-1:\n count = count + h[i]\n\nprint(count)'... | ['Runtime Error', 'Accepted'] | ['s328329965', 's541748881'] | [3064.0, 3060.0] | [18.0, 17.0] | [302, 183] |
p03147 | u748311048 | 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 = int()\nfor i in reversed(range(1, max(h)+1)):\n tmp = list()\n for j in h:\n if i <= j:\n tmp.append(1)\n else:\n tmp.append(0)\n # print(tmp)\n for j in range(1, n):\n if tmp[j]-tmp[j-1] == 1:\n ... | ['Wrong Answer', 'Accepted'] | ['s362713039', 's966630156'] | [3060.0, 3060.0] | [20.0, 21.0] | [331, 365] |
p03147 | u762420987 | 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())\nhlist = np.array([_ for _ in map(int,input().split())])\n\nmax = np.max(hlist)\nmin = np.min(hlist)\nL = len(hlist)\n\nnewlist = np.zeros_like(hlist)\nnum = 0\n\nlist = []\n\n\n\nfor i in range(max+1):\n over = np.sum(hlist >= i)\n print(over)\n if over == L:\n co... | ['Wrong Answer', 'Accepted'] | ['s392515497', 's028359153'] | [12496.0, 3060.0] | [150.0, 18.0] | [340, 356] |
p03147 | u763968347 | 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 dfs(L):\n for i,l in enumerate(L):\n if l != 0:\n break\n L = L[i:N]\n s = 0\n res = 0\n for i,l in enumerate(L):\n print(i,s)\n if l == 0:\n L_ = [l_-1 for l_ in L[s:i]]\n s = i+1\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s446655849', 's827832069', 's032434420'] | [3852.0, 3652.0, 3188.0] | [33.0, 37.0, 24.0] | [628, 653, 609] |
p03147 | u764956288 | 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()\nstr_h = input()\n\nfls = flowers(str_h)\nls_fls = fls.str_split0()\nwater = 0\n\nwhile(len(ls_fls)>0):\n #print(f'ls_fls = {ls_fls}')\n temp_ls_fls = []\n for fls in ls_fls:\n if len(fls)<=2:\n water += max([int(s) for s in fls])\n continue\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s510652290', 's346120565'] | [3064.0, 3064.0] | [19.0, 21.0] | [525, 1597] |
p03147 | u773686010 | 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... | ['# https://atcoder.jp/contests/abc116/tasks/abc116_c C - Grand Garden\nn=int(input())\nTree_List=list(map(int,input().split()))\n\nct =0\nfor i in range(n):\n while Tree_List[i] != 0:\n \n if i == n-1:\n Tree_List[i] -= 1\n \n else:\n \n k=i+1\n ... | ['Wrong Answer', 'Accepted'] | ['s286800246', 's949218125'] | [3064.0, 3064.0] | [22.0, 23.0] | [669, 711] |
p03147 | u780475861 | 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())\nc, *lst = [int(i) for i in input().split()]\nfor i in range(1, n):\n if lst[i] > lst[i - 1]:\n c += lst[i] - lst[i - 1]\nprint(c)', 'n = int(input())\nlst = [int(i) for i in input().split()]\nc = lst[0]\nfor i in range(1, n):\n if lst[i] > lst[i - 1]:\n c += lst[i] - lst[i - 1]\nprint(c)... | ['Runtime Error', 'Accepted'] | ['s511214039', 's353941121'] | [2940.0, 2940.0] | [17.0, 17.0] | [148, 155] |
p03147 | u781021311 | 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())) + [0]\nans = 0\nmin_v = 101\ncurr = 0\nlast = -1\ncount = 0\n\nfor _ in range(n+1):\n for i in range(n+1):\n curr = l[i]\n if curr == 0:\n for j in range(last+1, i):\n l[j] -= min_v\n\n if i > last + 1:\n ... | ['Wrong Answer', 'Accepted'] | ['s290506244', 's030005924'] | [6516.0, 3064.0] | [103.0, 23.0] | [494, 479] |
p03147 | u795021383 | 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())\nlisth = list(map(int, input().split()))\nlistans = [listh[0]]\nfor n in range(1,N-1):\n if (listh[n+1]-listh[n])*(listh[n]-listh[n-1])<=0:\n listans.append(listh[n])\nlistans.append(listh[N-1]) \n#print(listans)\nl =len(listans)\nlistans2 = []\nfor n in range(l-1):\n if listans[n... | ['Runtime Error', 'Accepted'] | ['s483456039', 's928851052'] | [3064.0, 3188.0] | [17.0, 18.0] | [1097, 1381] |
p03147 | u802977614 | 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\ndef f(li):\n global ans\n \n \n if li==[]:\n del li\n return\n \n \n min_num=min(li)\n if min(li)>0:\n count+=min(li)\n li=list(map(lambda x: x-min(li), li))\n li=[li[:li.index(0)],li[li.index(0)+1:]]\n f(li[0])\n f(li[1])\n\nf(h)\nprin... | ['Runtime Error', 'Accepted'] | ['s106531567', 's276132676'] | [3064.0, 3064.0] | [18.0, 27.0] | [324, 320] |
p03147 | u821284362 | 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_ls = list(map(int,input().split(" ")))\n\nh_ls = np.array(h_ls)\nn = 0\nh_len = len(h_ls)\nwhile max(h_ls)!=0:\n max_ind = h_ls.argmax()\n d = 0\n while max_ind+d < h_len -1 and h_ls[max_ind+d+1]==h_ls[max_ind]:\n d+=1\n h_ls[max_ind:max_ind+d+1] =h_ls[max_ind:max_ind+d+1]-1\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s110411645', 's910788870', 's882617979'] | [3060.0, 3060.0, 12508.0] | [17.0, 17.0, 293.0] | [339, 323, 343] |
p03147 | u821712904 | 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=ini(input())\nh=[int(i) for i input().split()]\nj=0\nans=0\nwhile True:\n if h[0]>j:\n ans+=1\n for i in range(1,n):\n if h[i-1]<=j and h [i]>j:\n ans+=1\n j+=1\n if j==max(h):\n break\nprint(ans) ', 'n=int(input())\nh=[int(i) for i input().split()]\nj=0\nans=0\nwhile True:\n if h[0]>j:\n ans+... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s416262194', 's814769945', 's331858146'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 19.0] | [204, 204, 185] |
p03147 | u841222846 | 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 = list(map(int, input().split(" ")))\n\nh = np.array(h)\n\ncount = 0\nwhile(sum(h) != 0):\n s = 200\n e = n\n for i in range(n):\n if(s == 200):\n if(h[i] != 0): s = i\n elif(h[i] == 0):\n e = i\n break\n\n count += m... | ['Wrong Answer', 'Accepted'] | ['s717056651', 's547175565'] | [21784.0, 18856.0] | [312.0, 429.0] | [364, 350] |
p03147 | u875855656 | 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()]\nv=sum(l)\ne=0\nfor i in range(max(l)):\n ef=0\n for j in l:\n print(i,j)\n if j>i:\n ef+=1\n else:\n if ef>0:\n e+=ef-1\n ef=0\n if ef>1:\n e+=ef-1\nprint(v-e)\n', 'n=int(input())\nl=[int(i) for i in input().split()]\nv=sum(l)\n... | ['Wrong Answer', 'Accepted'] | ['s570952174', 's719542675'] | [3628.0, 3060.0] | [32.0, 19.0] | [234, 219] |
p03147 | u879674287 | 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 = input()\nh = list(map(int, input().split()))\n\na = np.zeros(N)\nh_min = min(h)\ntmp = (h >= h_min+1)*1\n\ncnt = 0\nfor idx, i in enumerate(tmp):\n if idx==0:\n a0 = i\n if i==1:\n cnt+=1\n continue\n \n if idx==a0:\n continue\n else:\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s003657714', 's724535125', 's929114546', 's618391641'] | [12472.0, 18084.0, 12380.0, 12508.0] | [152.0, 275.0, 151.0, 161.0] | [370, 385, 380, 633] |
p03147 | u879870653 | 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.append(0)\nans = 0\n\nmi = min(H)\nfor i in range(N) :\n H[i] -= mi\nans += mi\nprint(H,ans)\nfor i in range(N) :\n a = H[i]\n H[i] = 0\n for j in range(i+1,N+1) :\n if a <= H[j] :\n H[j] -= a\n else :\n \n ... | ['Wrong Answer', 'Accepted'] | ['s695048111', 's857641534'] | [3064.0, 2940.0] | [27.0, 22.0] | [457, 279] |
p03147 | u891422384 | 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... | ["le = int(input())\nll=list(map(int, input().split(' ')))\n\n\nres=0\n\nwhile max(ll)>0:\n i=0\n while i<le:\n if ll[i]==0: \n i+=1\n else:\n res+=1\n while i<le and ll[i]>0:\n ll[i]-=1\n i+=1", 'le = int(input())\nll = list(map(int, input().split()))\n \nres = h[0]\nfor i in range... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s676527781', 's821550519', 's551076972'] | [3060.0, 3060.0, 3060.0] | [21.0, 18.0, 18.0] | [213, 147, 148] |
p03147 | u901598613 | 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()))\nfor t in range(len(l)):\n l[t]-=1\nans=1\nf=1\nm=max(l)\nfor j in range(m):\n for i in range(len(l)):\n if l[i]==0:\n f=1\n elif f==0:\n l[i]-=1\n else:\n ans+=1\n l[i]-=1\n f=0\n ... | ['Wrong Answer', 'Accepted'] | ['s800635582', 's878234261'] | [7284.0, 3064.0] | [109.0, 19.0] | [326, 271] |
p03147 | u905510147 | 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\nwhile max(h):\n current_hight = 0\n for i in range(len(h)):\n if not h[i]:\n if not current_hight:\n continue\n else:\n break\n elif h[i] < current_hight:\n break\n ... | ['Runtime Error', 'Accepted'] | ['s512256221', 's379335751'] | [3064.0, 3188.0] | [17.0, 54.0] | [410, 392] |
p03147 | u905582793 | 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 i in range(N-1):\n if h[i+1] > h[i]:\n ans += h[i+1]-h[i]\nprint(ans)', 'N = int(input())\nh = list(map(int, input().split()))\nans = h[0]\nfor i in range(N-1):\n if h[i+1] > h[i]:\n ans += h[i+1]-h[i]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s380194072', 's616847139'] | [2940.0, 2940.0] | [18.0, 17.0] | [135, 138] |
p03147 | u910540337 | 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... | ['"main.py" 5L, 116C written\ndef calc_watering_num(h, offset, left, right):\n if left > right:\n return 0\n min_h = None\n min_h_indices = []\n for i in range(left, right + 1):\n if min_h is None or min_h > h[i] - offset:\n min_h = h[i] -... | ['Runtime Error', 'Accepted'] | ['s333787588', 's922258775'] | [2940.0, 3064.0] | [17.0, 18.0] | [886, 859] |
p03147 | u917733926 | 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(int(i) for i in input().split())\n\n\ndef count(h):\n print(h)\n if len(h) != 0:\n output = 0\n min_elem = min(h)\n output += min_elem\n for index in range(0, len(h)):\n h[index] -= min_elem\n tmp_h = []\n for index in range(0, len(... | ['Wrong Answer', 'Accepted'] | ['s730776077', 's956220481'] | [3064.0, 3064.0] | [19.0, 20.0] | [626, 591] |
p03147 | u918117985 | 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#include <algorithm>\nusing namespace std;\n\nint f(vector<int> v, int i, int a) {\n vector<int>::iterator maxIt = max_element(v.begin(), v.end());\n vector<int>::iterator minIt = min_element(v.begin(), v.end());\n if (v.size() == 0){\n return a;\n }\n if(*maxIt == *minIt) {\n return ... | ['Runtime Error', 'Accepted'] | ['s451727942', 's261947630'] | [2940.0, 3064.0] | [17.0, 21.0] | [1145, 550] |
p03147 | u919235786 | 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()))\nhm=max(h)\nt=1\nfor i in range(hm,-1,-1):\n for j in range(n)\n if h[j]=i:\n ans+=t\n t=0\n else:\n t=1\n\nprint(ans)\n', 'n=int(input())\nh=list(map(int,input().split()))\nhm=max(h)\nt=1\nans=0\nfor i in range(hm,-1,-1)... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s140441314', 's181307180', 's455838442', 's577152052', 's638009179', 's817878933', 's327259124'] | [9028.0, 8824.0, 9180.0, 8964.0, 9032.0, 8992.0, 9036.0] | [29.0, 27.0, 29.0, 27.0, 27.0, 24.0, 26.0] | [204, 213, 214, 205, 218, 211, 218] |
p03147 | u919689206 | 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\n\n\n\ndef mizuyari(ary):\n n = 0\n ary2 = distinctAry(ary)\n \n \n if min(ary) > 0:\n n += 1 + mizuyari([s - 1 for s in ary2])\n \n \n else:\n print(ary2)\n \n return n\n\n\ndef distinctAry(ary):\n \n for i, j in enumerate(ary):\n ... | ['Wrong Answer', 'Accepted'] | ['s895893313', 's081629989'] | [3572.0, 3064.0] | [28.0, 25.0] | [674, 744] |
p03147 | u921027074 | 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 sum(h)>0:\n for i in range(n):\n if i<n-1 and h[i]>0 and h[i+1]==0:\n ans+=1\n else:\n if i==N-1 and h[i]>0:\n ans+=1\n if h[i]>0:\n h[i]-=1\nprint(ans) ', 'n=int(input())\nh=list(map(int,input().spliy()))\nans=0\nwhil... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s038821843', 's075508751', 's772317257', 's743832002'] | [3060.0, 3060.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0, 21.0] | [241, 241, 242, 242] |
p03147 | u923712635 | 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 mizuyari2(l):\n count = 0\n stopper = 0\n\n for i in l:\n stopper+=i \n if(stopper == 0):\n return 0 \n\n if(l[0]!=0):\n count+=1\n for i in range(len(l)-1):\n if(l[i]==0 and l[i+1]!=0):\n count+=1\n\n for index,i in enumerate(l): \n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s076904225', 's378039690', 's700333118', 's526687461'] | [3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 22.0] | [488, 548, 488, 699] |
p03147 | u927534107 | 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())\ns = list(map(int,input().split()))\ns = [i-1 for i in s]\nans = 0\nwhile(sum(s)!=-n):\n s_new=[i.replace("-1","a") for i in map(str,s)]\n print(s_new)\n s_join = \'\'.join(s_new)\n non = s_join.split("a")\n num = len([x for x in non if x])\n ans += num\n s = [max(i-1,-1) for i i... | ['Wrong Answer', 'Accepted'] | ['s136156767', 's090586892'] | [3064.0, 3064.0] | [24.0, 23.0] | [320, 303] |
p03147 | u929313378 | 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\nimport numpy as np\nimport collections\n\ndef parse(inp):\n N=int(next(inp))\n H=np.array(next(inp).split(),dtype=int)\n return H\n \ndef split(H):\n Splited=np.array([],dtype=int)\n SplitPoint=[]\n for i in range(len(H)):\n if(H[i]==0):\n SplitPoint.append(i)\n \n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s946785445', 's954870614', 's266332526'] | [13420.0, 17888.0, 13328.0] | [219.0, 261.0, 212.0] | [1274, 1360, 1256] |
p03147 | u930862022 | 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\ncount = 0\n\nfor i in range(n): \n while h[i] >= 1:\n wid = 0\n for l in range(i,n):\n if h[l] >= 1:\n wid = wid + 1\n else:\n break\n print(wid)\n \n for k in rang... | ['Wrong Answer', 'Accepted'] | ['s326234725', 's572198523'] | [4724.0, 3060.0] | [68.0, 23.0] | [429, 411] |
p03147 | u932868243 | 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()))\nh=np.array(h)\nans=0\nwhile True:\n for i in range(n):\n k=n-i\n cnt=0\n for j in range(1,k):\n if all(hh!=0 for hh in h[i:i+j+1]):\n cnt+=1\n h[i:i+cnt+1]=-1\n ans+=1\nprint(ans)', 'n=int(input())\nh=list(map(int,input(... | ['Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s285180927', 's732644402', 's652663093'] | [14440.0, 3060.0, 3060.0] | [2108.0, 17.0, 17.0] | [263, 281, 127] |
p03147 | u934740772 | 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 i in range(max(h)):\n cnt=0\n for j in range(n):\n if h[j]>=i+1:\n cnt+=1\n elif j==n-1:\n ans+=cnt\n else:\n ans+=cnt\n cnt=0\nprint(ans)', 'n=int... | ['Runtime Error', 'Accepted'] | ['s221370029', 's901447759'] | [2940.0, 3060.0] | [17.0, 19.0] | [300, 254] |
p03147 | u934788990 | 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 = h[0]\nfor i in range(n-1):\n if h[i+1]>h[i]:\n count += h[i+1]-h[i]\nprint(cnt)\n', 'n = int(input())\nh = list(map(int,input().split()))\ncount = h[0]\nfor i in range(N-1):\n if h[i+1]>h[i]:\n count += h[i+1]-h[i]\nprint(cnt)', 'N = in... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s030418421', 's697399370', 's409902493'] | [2940.0, 3060.0, 3064.0] | [18.0, 17.0, 17.0] | [146, 145, 136] |
p03147 | u934868410 | 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 True:\n water = False\n for i in range(n):\n if h[i] > 0:\n h[i] -= 1\n water = True\n elif water:\n ans += 1\n water = False\n if water:\n ans += 1\nprint(ans)', 'n = int(input())\nh = list(map(int,input().split()))\... | ['Time Limit Exceeded', 'Accepted'] | ['s091053636', 's657296096'] | [3060.0, 3064.0] | [2104.0, 19.0] | [247, 307] |
p03147 | u936985471 | 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\n\n\n\n\n\n\n\ndef water(currentnum, currentlist): \n global count\n\n \n \n partlist = [] \n \n for i in range(currentnum):\n if currentlist[i] != 0:\n partlist.append(currentlist[i]) \n else: \n \n if len(partlist)==0:\n partlist... | ['Wrong Answer', 'Accepted'] | ['s595544285', 's331572532'] | [3500.0, 2940.0] | [46.0, 17.0] | [1327, 115] |
p03147 | u937529125 | 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... | ['a = [int(i) for i in input().split()] \nn = 0\nnum = a[0]\nfor i in a:\n max = a[0]\n \n \n if i > a[n-1] and n > 0:\n num += (i-a[n-1])\n n += 1\nprint(num) \n \n \n ', 'l = input()\na = [int(i) for i in input().split()] \nn = 0\nnum = a[0]\nfor i in a:\n max = a[0]\n \n \n if i > a[n-1] and n > 0:\n... | ['Wrong Answer', 'Accepted'] | ['s573587187', 's980502349'] | [2940.0, 3064.0] | [18.0, 18.0] | [166, 178] |
p03147 | u939702463 | 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 = map(int, input().split())\n\nans = 0\nfor i in range(1, n):\n d = h[i] - h[i-1]\n if d > 0:\n ans += d\nprint(ans)', 'n = int(input())\nh = list(map(int, input().split()))\n \nans = h[0]\nfor i in range(1, n):\n d = h[i] - h[i-1]\n if d > 0:\n ans += d\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s444686336', 's883019966'] | [2940.0, 3060.0] | [18.0, 17.0] | [133, 143] |
p03147 | u941434715 | 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\nimport math\nimport heapq\nimport bisect\nimport numpy as np\n#from scipy.misc import comb\n\nN = int(input())\nh = list(map(int, input().split()))\n\nans += h[0]\nbase = h[0]\nfor i in range(1,N):\n ans += max(h[i]-base,0)\n base = h[i]\n\nprint(ans)', '#coding: utf-8\nimport math\nimport heapq... | ['Runtime Error', 'Accepted'] | ['s186389689', 's278499107'] | [12212.0, 20300.0] | [150.0, 323.0] | [257, 256] |
p03147 | u941438707 | 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())\nh=list(map(int, input().split()))\nsum=0\nfor i in range(max(h)):\n if 0 not in h:\n h=[i-1 if i>0 else 0 for i in h]\n sum+=1\n # print(h,1)\n else:\n count0=[i for i, j in enumerate(h) if j==0]\n a=count0.copy() \n b=count0.copy()\n a.pop(0)\n... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s261196658', 's458165833', 's628950411'] | [3064.0, 3188.0, 2940.0] | [20.0, 22.0, 17.0] | [874, 686, 91] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.