message
stringlengths
2
44.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
276
109k
cluster
float64
23
23
__index_level_0__
int64
552
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentr...
instruction
0
104,711
23
209,422
Yes
output
1
104,711
23
209,423
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentr...
instruction
0
104,715
23
209,430
No
output
1
104,715
23
209,431
Provide tags and a correct Python 3 solution for this coding contest problem. Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square two sets of concentric circles were painted. Le...
instruction
0
104,802
23
209,604
Tags: implementation, math Correct Solution: ``` def readGen(trans): while 1: for x in input().split(): yield(trans(x)) readint=readGen(int) [N,x,M,y]=(next(readint) for i in range(4)) d=abs(y-x) def interval(a,b): return range(a,b+1) def case1(N,M,d): # d>=N ans=0 for r in interval(1, min(M,d-N)): ans+...
output
1
104,802
23
209,605
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square ...
instruction
0
104,803
23
209,606
No
output
1
104,803
23
209,607
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square ...
instruction
0
104,804
23
209,608
No
output
1
104,804
23
209,609
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square ...
instruction
0
104,805
23
209,610
No
output
1
104,805
23
209,611
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square ...
instruction
0
104,806
23
209,612
No
output
1
104,806
23
209,613
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,955
23
209,910
Tags: brute force, implementation, math Correct Solution: ``` b, q, l, m = map(int, input().split()) A = set(map(int, input().split())) ans = 0 for _ in range(100): if abs(b) > l: break if b not in A: ans += 1 b *= q if ans > 40: print("inf") else: print(ans) ```
output
1
104,955
23
209,911
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,956
23
209,912
Tags: brute force, implementation, math Correct Solution: ``` import math,sys,bisect,heapq from collections import defaultdict,Counter,deque from itertools import groupby,accumulate #sys.setrecursionlimit(200000000) input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: map(int,input().spl...
output
1
104,956
23
209,913
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,957
23
209,914
Tags: brute force, implementation, math Correct Solution: ``` b, q, l, m = map(int, input().split()) s = set(map(int, input().split())) if abs(b) > l: print(0) exit() if q == 1: if b not in s: print("inf") exit() else: print(0) exit() if q == -1: if b not i...
output
1
104,957
23
209,915
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,958
23
209,916
Tags: brute force, implementation, math Correct Solution: ``` class CodeforcesTask789BSolution: def __init__(self): self.result = '' self.b_q_l_m = [] self.bad_numbers = [] def read_input(self): self.b_q_l_m = [int(x) for x in input().split(" ")] self.bad_numbers = [int(...
output
1
104,958
23
209,917
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,959
23
209,918
Tags: brute force, implementation, math Correct Solution: ``` a=input().split() b=int(a[0]) q=int(a[1]) l=int(a[2]) m=int(a[3]) a=input().split() t=0 if(b==0): if('0' in a):print(0) else:print("inf") elif(abs(b)>l):print(0) elif(abs(q)<=1 and q!=-1 and q!=0): if(str(b) in a):print(0) else:print("in...
output
1
104,959
23
209,919
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,960
23
209,920
Tags: brute force, implementation, math Correct Solution: ``` b1, q, l, m = [int(i) for i in input().split()] a = [int(i) for i in input().split()] ans = 0 if abs(b1) > l: ans = 0 elif b1 == 0: ans = "inf" if 0 not in a else 0 else: ans = int(b1 not in a) if q == 0: if 0 not in a : ans = "inf...
output
1
104,960
23
209,921
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,961
23
209,922
Tags: brute force, implementation, math Correct Solution: ``` b1 , q , l , m = map(int, input().split()) s = set(map(int , input().split())) ans = 0 cnt = 0 while abs(b1) <= l: if b1 not in s: ans += 1 cnt += 1 if cnt == 100000: break b1 *= q if ans >= 50000: print('inf') else: ...
output
1
104,961
23
209,923
Provide tags and a correct Python 3 solution for this coding contest problem. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, ...
instruction
0
104,962
23
209,924
Tags: brute force, implementation, math Correct Solution: ``` from sys import stdin, stdout b, q, l, n = map(int, stdin.readline().split()) a = set(list(map(int, stdin.readline().split()))) ans = 0 ind = 0 while abs(b) <= l and ind < 100: if not b in a: ans += 1 b *= q ind += 1 i...
output
1
104,962
23
209,925
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,963
23
209,926
Yes
output
1
104,963
23
209,927
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,964
23
209,928
Yes
output
1
104,964
23
209,929
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,965
23
209,930
Yes
output
1
104,965
23
209,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,966
23
209,932
Yes
output
1
104,966
23
209,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,967
23
209,934
No
output
1
104,967
23
209,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,968
23
209,936
No
output
1
104,968
23
209,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,969
23
209,938
No
output
1
104,969
23
209,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression b defined by two integers b1 and q. Remind that a geometric...
instruction
0
104,970
23
209,940
No
output
1
104,970
23
209,941
Provide a correct Python 3 solution for this coding contest problem. You are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural design competition to find the best design for...
instruction
0
105,199
23
210,398
"Correct Solution: ``` #2006_D """ import sys from collections import defaultdict def dfs(d,y,x,f): global ans if d >= 10: return f_ = defaultdict(int) for i in f.keys(): f_[i] = f[i] for t,s in vr[(y,x)]: if a[t][s] == 3: ans = min(ans,d+1) break ...
output
1
105,199
23
210,399
Provide a correct Python 3 solution for this coding contest problem. You are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural design competition to find the best design for...
instruction
0
105,200
23
210,400
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**13 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int...
output
1
105,200
23
210,401
Provide a correct Python 3 solution for this coding contest problem. You are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural design competition to find the best design for...
instruction
0
105,201
23
210,402
"Correct Solution: ``` while True: w, h = map(int, input().split()) if w == 0: break mp = [[0] + list(input()) + [0] for _ in range(h)] mp.insert(0, [0] * (w + 2)) mp.append([0] * (w + 2)) for y in range(1, h + 1): for x in range(1, w + 1): if mp[y][x] == ".": mp[y][x] = 0 else:...
output
1
105,201
23
210,403
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,223
23
210,446
"Correct Solution: ``` """ Writer:SPD_9X2 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_3_C&lang=ja ヒストグラム上の最大長方形 またdpかな…? 参考: http://algorithms.blog55.fc2.com/blog-entry-132.html """ #最後に要素0を追加してくこと def Largest_rectangle_in_histgram(lis): stk = [] ans = 0 N = len(lis) for i in range...
output
1
105,223
23
210,447
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,224
23
210,448
"Correct Solution: ``` from collections import deque import sys input = sys.stdin.readline n = int(input()) a = list(map(int, input().split())) + [-1] ans = 0 q = deque([]) for i in range(n + 1): ind = i while True: if not q: q.append((a[i], ind)) break if q[-1][0] <= a...
output
1
105,224
23
210,449
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,225
23
210,450
"Correct Solution: ``` import sys from collections import deque readline = sys.stdin.readline n = int(readline()) li = list(map(int, readline().split())) def square(P): G = [] L = deque() for i, v in enumerate(P): if not L: L.append((i, v)) continue if v > L[-1][1]: ...
output
1
105,225
23
210,451
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,226
23
210,452
"Correct Solution: ``` N = int(input()) *H, = map(int, input().split()) st = [(0, -1)] ans = 0 for i in range(N): h = H[i] base = i while st and h <= st[-1][0]: h0, j = st.pop() ans = max(ans, (i-j)*h0) base = j st.append((h, base)) while st: h0, j = st.pop() ans = max(an...
output
1
105,226
23
210,453
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,227
23
210,454
"Correct Solution: ``` n = int(input()) rects = list(map(int, input().split())) rects.append(-1) stack = [] ans = 0 for ind, rect in enumerate(rects): # print(stack) if not stack: stack.append((rect, ind)) elif stack[-1][0] < rect: stack.append((rect, ind)) elif stack[-1][0] == rect: continue else...
output
1
105,227
23
210,455
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,228
23
210,456
"Correct Solution: ``` import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy # import heapq import decimal # import statistics import queue # import numpy as np sys.setrecursionlimit(10000001) INF = 10 ** 16 MOD = 10 ** 9 ...
output
1
105,228
23
210,457
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,229
23
210,458
"Correct Solution: ``` if __name__ == "__main__": N = int(input()) hist = list(map(lambda x: int(x), input().split())) stack = [(0, -1)] # (height, x_position) ans = 0 for i in range(N): height = hist[i] pos = i while stack and height <= stack[-1][0]: h, j = sta...
output
1
105,229
23
210,459
Provide a correct Python 3 solution for this coding contest problem. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area. Constr...
instruction
0
105,230
23
210,460
"Correct Solution: ``` n = int(input()) h = list(map(int, input().split( ))) Stk = [] Stk.append([h[0],1]) ans = [] for i in range(1,n): if Stk[-1][0] <= h[i]: Stk.append([h[i],1]) else: tmp = 0 while len(Stk) > 0 and Stk[-1][0]>h[i]: [hei,w] = Stk.pop()#Stk.pop()[...
output
1
105,230
23
210,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,231
23
210,462
Yes
output
1
105,231
23
210,463
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,232
23
210,464
Yes
output
1
105,232
23
210,465
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,233
23
210,466
Yes
output
1
105,233
23
210,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,234
23
210,468
Yes
output
1
105,234
23
210,469
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,235
23
210,470
No
output
1
105,235
23
210,471
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,236
23
210,472
No
output
1
105,236
23
210,473
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,237
23
210,474
No
output
1
105,237
23
210,475
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A histogram is made of a number of contiguous bars, which have same width. For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively...
instruction
0
105,238
23
210,476
No
output
1
105,238
23
210,477
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,542
23
211,084
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` if __name__ == '__main__': n,k = map(int,input().split()) l = list(map(int,input().split())) for i in range(1,len(l),2): if l[i]-1 > l[i-1] and l[i]-1 > l[i+1]: l[i] -= 1 k -= 1 if k ==...
output
1
105,542
23
211,085
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,543
23
211,086
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` """609C""" # import math def main(): n,k = map(int,input().split()) a = list( map(int,input().split()) ) for i in range(len(a)-2): # print(i) # print(a) if a[i+1]-1>a[i] and a[i+1]-1>a[i+2]: a[i+1]-=1 k-=1 if k==0: #...
output
1
105,543
23
211,087
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,544
23
211,088
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` a, b = map(int,input().split()) ans = 0 l = list(map(int,input().split())) for i in range(b): for i in range(1 ,len(l ) - 1): if ans == b: print(*l) exit() if l[i] > l[i + 1] and l[i] > l[i - 1] : if l[i] - 1 <= l[i -1 ] or l...
output
1
105,544
23
211,089
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,545
23
211,090
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` n, k = map(int, input().split()) points = list(map(int, input().split())) c = 0 i = 1 while c < k: if points[i-1]<(points[i]-1) and (points[i]-1)>points[i+1]: points[i]-=1 c+=1 #print(c) i+=2 print(" ".join(l...
output
1
105,545
23
211,091
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,546
23
211,092
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` # -*- coding: utf-8 -*- """ Created on Fri Jul 24 12:40:45 2020 @author: lalo """ n,x=[int(x) for x in input().split()] l=[int(x) for x in input().split()] a=0 print(l[0],end=' ') for i in range(1,len(l)-1): k=l[i]-1 if (k...
output
1
105,546
23
211,093
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,547
23
211,094
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` n, k = map(int, input().split()) l = list(map(int, input().split())) j = 0 for i in range(1, 2 * n + 1, 2): if l[i] > (l[i-1] + 1) and l[i] > (l[i+1] + 1): l[i] -= 1 j += 1 if j == k: break print(" ".join(...
output
1
105,547
23
211,095
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,548
23
211,096
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` #!/usr/bin/env python3 n, k = map(int,input().split()) y_points = list(map(int,input().split())) k_tot=0 last_odd = len(y_points)-2 if (len(y_points)-1)%2==0 else len(y_points)-1 for i in range(last_odd,0,-2): if k_tot<k: if (y_points...
output
1
105,548
23
211,097
Provide tags and a correct Python 3 solution for this coding contest problem. Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n ...
instruction
0
105,549
23
211,098
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` def arr_inp(): return [int(x) for x in input().split()] def print_arr(arr): print(*arr, sep=' ') n, k = map(int, input().split()) y = arr_inp() for i in range(1, n * 2, 2): if (k == 0): break if (y[i] - y[i - 1] ...
output
1
105,549
23
211,099