message
stringlengths
2
48.6k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
318
108k
cluster
float64
8
8
__index_level_0__
int64
636
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). Dima decided to play with the stairc...
instruction
0
104,760
8
209,520
Yes
output
1
104,760
8
209,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). Dima decided to play with the stairc...
instruction
0
104,761
8
209,522
Yes
output
1
104,761
8
209,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). Dima decided to play with the stairc...
instruction
0
104,762
8
209,524
Yes
output
1
104,762
8
209,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). Dima decided to play with the stairc...
instruction
0
104,763
8
209,526
No
output
1
104,763
8
209,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). Dima decided to play with the stairc...
instruction
0
104,764
8
209,528
No
output
1
104,764
8
209,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). Dima decided to play with the stairc...
instruction
0
104,765
8
209,530
No
output
1
104,765
8
209,531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). Dima decided to play with the stairc...
instruction
0
104,766
8
209,532
No
output
1
104,766
8
209,533
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,767
8
209,534
Tags: dp, geometry Correct Solution: ``` N = 100100 def main(): n = int(input()) d=[0]*N a = list(map(int, input().split())) b = list(map(int, input().split())) m,c=[0]*N,[0]*N m[0] = b[0] c[0] = d[0] z = 1 p = 0 for i in range(1,n): p = min(p,z) while(...
output
1
104,767
8
209,535
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,768
8
209,536
Tags: dp, geometry Correct Solution: ``` read = lambda: map(int, input().split()) n = int(input()) a = list(read()) b = list(read()) dp = [0] * n ch = [0] def get(i, x): return b[i] * x + dp[i] def f1(): if len(ch) < 2: return 0 return get(ch[0], a[i]) >= get(ch[1], a[i]) def f2(): if len(...
output
1
104,768
8
209,537
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,769
8
209,538
Tags: dp, geometry Correct Solution: ``` n = int(input()) a = list(map(int, input().split(' '))) b = list(map(int, input().split(' '))) c = [0]*n st = [0]*n first=0 second=0 for i in range(1,n): #Delete from front until the value of lines is increasing w.r.to value a[i] while(second-first>0 and a[i] * b[st[...
output
1
104,769
8
209,539
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,770
8
209,540
Tags: dp, geometry Correct Solution: ``` n=int(input()) A=list(map(int,input().strip().split())) B=list(map(int,input().strip().split())) def tree_cutting(n,A,B): C=[0 for _ in range(n)] hullx=[0 for _ in range(n)] hully=[0 for _ in range(n)] sz=0 p=0 C[0]=0 hullx[0]=B[0] hull...
output
1
104,770
8
209,541
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,771
8
209,542
Tags: dp, geometry Correct Solution: ``` n = int(input()) a = [0 for i in range(0, n + 1)] b = [0 for i in range(0, n + 1)] a = list(map(int, input().split())) b = list(map(int, input().split())) dp = [0 for i in range(0, n + 1)] c = [[0 for i in range(0, 3)] for j in range(0, n + 1)] stack = [] stack.append(0) sta...
output
1
104,771
8
209,543
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,772
8
209,544
Tags: dp, geometry Correct Solution: ``` n = int(input()) a = [0] + [int(x) for x in input().split()] b = [0] + [int(x) for x in input().split()] q = [0 for i in range(n + 1)] f = [0 for _ in range(n + 1)] l, r, q[1] = 1, 1, 1 for i in range(2, n + 1): while l < r and f[q[l + 1]] - f[q[l]] < a[i] * (b[q[l]] - b[q[l...
output
1
104,772
8
209,545
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,773
8
209,546
Tags: dp, geometry Correct Solution: ``` def cross(i, j, k, b, cost): # k, i, j return (cost[i] - cost[j]) * (b[i] - b[k]) - (b[i] - b[j]) * (cost[i] - cost[k]) def dot(i, j, a, b, cost): return cost[j] + a[i] * b[j] def CF319C(): N = int(input()) a = tuple(map(int, input().split())) b = tup...
output
1
104,773
8
209,547
Provide tags and a correct Python 3 solution for this coding contest problem. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. Th...
instruction
0
104,774
8
209,548
Tags: dp, geometry Correct Solution: ``` N = 100100 def main(): n = int(input()) d=[0]*N a = list(map(int, input().split())) b = list(map(int, input().split())) m,c=[0]*N,[0]*N m[0] = b[0] c[0] = d[0] z = 1 p = 0 for i in range(1,n): p = min(p,z) while(...
output
1
104,774
8
209,549
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,775
8
209,550
Yes
output
1
104,775
8
209,551
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,776
8
209,552
Yes
output
1
104,776
8
209,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,777
8
209,554
Yes
output
1
104,777
8
209,555
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,778
8
209,556
Yes
output
1
104,778
8
209,557
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,779
8
209,558
No
output
1
104,779
8
209,559
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,780
8
209,560
No
output
1
104,780
8
209,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,781
8
209,562
No
output
1
104,781
8
209,563
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
instruction
0
104,782
8
209,564
No
output
1
104,782
8
209,565
Provide tags and a correct Python 3 solution for this coding contest problem. Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart. Let us consider the building process. Vasya takes a brick and puts it on top of th...
instruction
0
104,796
8
209,592
Tags: implementation Correct Solution: ``` n = int(input()) l = [] m = [] for i in range(n): X1, Y1, X2, Y2 = map(int, input().split()) m1 = (abs(X2 - X1)) ** 3 l.append([X1, Y1, X2, Y2]) m.append(m1) X1, Y1, X2, Y2 = l[0][0], l[0][1], l[0][2], l[0][3] if X1 > X2: X2, X1 = X1, X2 if Y1 > Y2: Y1, Y2 = Y2...
output
1
104,796
8
209,593
Provide tags and a correct Python 3 solution for this coding contest problem. Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart. Let us consider the building process. Vasya takes a brick and puts it on top of th...
instruction
0
104,797
8
209,594
Tags: implementation Correct Solution: ``` a=[list(map(int,input().split())) for i in range(int(input()))] n=len(a) z=n for i in range(n): if i!=0: c=[(a[i][0]+a[i][2])/2,(a[i][1]+a[i][3])/2] m=abs(a[i][0]-a[i][2])**3 for j in range(i-1,-1,-1): x1,y1,x2,y2=min(a[j][0],a[j][2]),mi...
output
1
104,797
8
209,595
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart. Let us consider the building proces...
instruction
0
104,798
8
209,596
No
output
1
104,798
8
209,597
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart. Let us consider the building proces...
instruction
0
104,799
8
209,598
No
output
1
104,799
8
209,599
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart. Let us consider the building proces...
instruction
0
104,800
8
209,600
No
output
1
104,800
8
209,601
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart. Let us consider the building proces...
instruction
0
104,801
8
209,602
No
output
1
104,801
8
209,603
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,874
8
209,748
Tags: binary search, greedy Correct Solution: ``` n, k = map(int, input().split()) arr = list(map(int, input().split())) arr.reverse() idx = 0 ans = 0 while idx < n and n - idx - 1 <= (k - 1) * 2: ans = max(ans, arr[idx]) idx += 1 k -= 1 left = idx right = n - 1 while left < right: ans = max(arr[lef...
output
1
104,874
8
209,749
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,875
8
209,750
Tags: binary search, greedy Correct Solution: ``` # https://codeforces.com/problemset/problem/604/B import math def needed_box(size): current_count_box = 0 i, j = 0, number_of_cowbells-1 while i < j: if list_cowbells[i] + list_cowbells[j] <= size: i+=1 j-=1 elif list...
output
1
104,875
8
209,751
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,876
8
209,752
Tags: binary search, greedy Correct Solution: ``` a = list(map(int,input().split())) n,k = a[0], a[1] l = k bells = list(map(int,input().split())) mymax = bells[-1] while l > n/2 and l > 1 and n > 1: del bells[-1] l-=1 n-=1 while n > 1: mymax = max(mymax,bells[0] + bells[-1]) del bells[0] del...
output
1
104,876
8
209,753
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,877
8
209,754
Tags: binary search, greedy Correct Solution: ``` n, k = map(int, input().split()) s = list(map(int, input().split())) total = 0 s.sort() s.reverse() if k >= n: print(s[0]) exit() x = n - k y = k - x for it in range(y): if s[it] > total: total = s[it] ij = -1 for it in range(y, k): total = max(...
output
1
104,877
8
209,755
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,878
8
209,756
Tags: binary search, greedy Correct Solution: ``` n, k = list(map(int, input().split())) ss = list(map(int, input().split())) if k >= n: print(ss[n-1]) else: top = 2 * (n - k ) - 1 bottom = 0 m = ss[n - 1] while top > bottom: v = ss[top] + ss[bottom] if v > m: m = v ...
output
1
104,878
8
209,757
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,879
8
209,758
Tags: binary search, greedy Correct Solution: ``` n, k = map(int, input().split()) A = list(map(int, input().split())) Max = A[-1] while 2 * k > len(A) and A != []: del A[-1] k -= 1 while A != []: Max = max(Max, A[0] + A[-1]) del A[0], A[-1] print(Max) ```
output
1
104,879
8
209,759
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,880
8
209,760
Tags: binary search, greedy Correct Solution: ``` n,k = map(int,input().split()) a = list(map(int,input().split())) x = 2*k-n b = a[:n-x] anss = a[n-x:] for i in range(len(b)//2): anss.append(b[i]+b[len(b)-i-1]) print(max(anss)) ```
output
1
104,880
8
209,761
Provide tags and a correct Python 3 solution for this coding contest problem. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection s...
instruction
0
104,881
8
209,762
Tags: binary search, greedy Correct Solution: ``` n,k = [int(i) for i in input().split()] sizes = [int(i) for i in input().split()] if k>=n: print(max(sizes)) else: x1 = sizes[-1] sizes = sizes[:2*(n-k)] x2 = max([a+b for a, b in zip(sizes,sizes[::-1])]) print(max(x1,x2)) ```
output
1
104,881
8
209,763
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,882
8
209,764
Yes
output
1
104,882
8
209,765
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,883
8
209,766
Yes
output
1
104,883
8
209,767
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,884
8
209,768
Yes
output
1
104,884
8
209,769
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,885
8
209,770
Yes
output
1
104,885
8
209,771
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,886
8
209,772
No
output
1
104,886
8
209,773
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,887
8
209,774
No
output
1
104,887
8
209,775
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,888
8
209,776
No
output
1
104,888
8
209,777
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of ...
instruction
0
104,889
8
209,778
No
output
1
104,889
8
209,779
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 Γ— n in size, when viewed from above. This rectangle is divided into n equal square sections. The ...
instruction
0
105,730
8
211,460
Tags: brute force, implementation Correct Solution: ``` n = int(input()) sections = list(map(int, input().split())) scores = [] for i in range(n): total = 1 curr = sections[i] for j in range(i+1,n): if sections[j]<=curr: total+=1 curr = sections[j] else: break curr = sections[i] for k in reversed(r...
output
1
105,730
8
211,461
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 Γ— n in size, when viewed from above. This rectangle is divided into n equal square sections. The ...
instruction
0
105,731
8
211,462
Tags: brute force, implementation Correct Solution: ``` n = int(input()) arr = list(map(int, input().split())) mx = 1 for i in range(n): count = 1 r = l = i while l - 1 >= 0: l -= 1 if arr[l] <= arr[l+1]: count += 1 else: break while r + 1 < n: ...
output
1
105,731
8
211,463
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 Γ— n in size, when viewed from above. This rectangle is divided into n equal square sections. The ...
instruction
0
105,732
8
211,464
Tags: brute force, implementation Correct Solution: ``` n = int(input()) maxi = 0 arr = [int(x) for x in input().split()] for i in range(n): count = 0 for j in range(i,-1,-1): if j-1>=0: if arr[j]<arr[j-1]: break else: count += 1 for j in range...
output
1
105,732
8
211,465
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 Γ— n in size, when viewed from above. This rectangle is divided into n equal square sections. The ...
instruction
0
105,733
8
211,466
Tags: brute force, implementation Correct Solution: ``` n = int(input()) l = list(map(int,input().split())) l2 = list(reversed(l)) ans = 0 for i in range(n): tmp = l[i] c = 1 for j in range(i - 1 , - 1, - 1): if l[j] > tmp: break tmp , c = l[j] , c + 1 tmp = l[i] for j ...
output
1
105,733
8
211,467
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 Γ— n in size, when viewed from above. This rectangle is divided into n equal square sections. The ...
instruction
0
105,734
8
211,468
Tags: brute force, implementation Correct Solution: ``` n = int(input()) heights = [int(x) for x in input().split()] leftCounter = [0] * n rightCounter = [0] * n for i in range(1,n): if heights[i-1] <= heights[i]: leftCounter[i] = leftCounter[i-1] + 1 if heights[n-i-1] >= heights[n-i]: rightCoun...
output
1
105,734
8
211,469