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
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,534
8
169,068
Tags: implementation, sortings Correct Solution: ``` n, m = list(map(int, input().split())) fff = 1 if m == 0: print("YES") fff = 0 if fff : A = list(map(int, input().split())) A.sort() cur = 0 flag = 1 if A[-1] == n: print("NO") flag = 0 if 1 in A and flag: ...
output
1
84,534
8
169,069
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,535
8
169,070
Tags: implementation, sortings Correct Solution: ``` #!/usr/bin/env python import os import sys from io import BytesIO, IOBase #from bisect import bisect_left as bl #c++ lowerbound bl(array,element) #from bisect import bisect_right as br #c++ upperbound br(array,element) def main(): ...
output
1
84,535
8
169,071
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,536
8
169,072
Tags: implementation, sortings Correct Solution: ``` n, m = map(int,input().split()) if m >= 1: gr = list(map(int, input().split())) gr.sort() k = 1 if (m >= 1 and gr[0] == 1) or (m >= 1 and gr[m-1]) == n: print('NO') else: for i in range(m-2): if gr[i] == gr[i+1] - 1 == gr[i+2] - 2: ...
output
1
84,536
8
169,073
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,537
8
169,074
Tags: implementation, sortings Correct Solution: ``` a,b=map(int,input().split()) if b>0: l=list(map(int,input().split())) l.sort() if l[0]==1 or l[-1]==a: print("NO") exit(0) for i in range (b-2): if l[i]+1==l[i+1] and l[i+1]+1==l[i+2]: print("NO") exit(0...
output
1
84,537
8
169,075
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,538
8
169,076
Tags: implementation, sortings Correct Solution: ``` #!/usr/bin/python3 def readln(): return tuple(map(int, input().split())) n, m = readln() d = sorted(readln()) if m else [] if m and (d[0] == 1 or d[-1] == n) or m > 2 and [1 for i, j, k in zip(d[:-2], d[1:-1], d[2:]) if i + 2 == k]: print('NO') else: print(...
output
1
84,538
8
169,077
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,539
8
169,078
Tags: implementation, sortings Correct Solution: ``` def bin(arr, n): l = 0 r = len(arr) - 1 while l <= r: m = (l + r) // 2 if arr[m] == n: return True elif arr[m] < n: l = m + 1 else: r = m - 1 return False n, m = [int(i) for i in input().strip().split()] if m == 0: pri...
output
1
84,539
8
169,079
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,540
8
169,080
Tags: implementation, sortings Correct Solution: ``` import sys def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def rinput(): return map(int, sys.stdin.readline().strip().split()) def get_list(): return list(map(int, sys.stdin.readline().strip().split())) mod = int(1e9)+7 n...
output
1
84,540
8
169,081
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,541
8
169,082
Yes
output
1
84,541
8
169,083
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,542
8
169,084
Yes
output
1
84,542
8
169,085
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,543
8
169,086
Yes
output
1
84,543
8
169,087
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,544
8
169,088
Yes
output
1
84,544
8
169,089
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,545
8
169,090
No
output
1
84,545
8
169,091
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,546
8
169,092
No
output
1
84,546
8
169,093
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,547
8
169,094
No
output
1
84,547
8
169,095
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to th...
instruction
0
84,548
8
169,096
No
output
1
84,548
8
169,097
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night. In c...
instruction
0
84,611
8
169,222
Tags: data structures Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) top = max(a) stack = [[10 ** 9 + 1, 1]] ans = 0 for i in range(n): while a[i] > stack[-1][0]: stack.pop() if a[i] < stack[-1][0]: stack.append([a[i], 1]) else: stack[-1][1] += 1 for i in ...
output
1
84,611
8
169,223
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night. In c...
instruction
0
84,612
8
169,224
Tags: data structures Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) max_idx = a.index(max(a)) b = a[max_idx:] b.extend(a[:max_idx]) b.append(a[max_idx]) left = [0] * (n + 1) right = [n] * (n + 1) cnt = [0] * (n + 1) for i in range(1, n): idx = i - 1 while b[idx] <= b[i] and idx > 0:...
output
1
84,612
8
169,225
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night. In c...
instruction
0
84,613
8
169,226
Tags: data structures Correct Solution: ``` n = int(input()) arr = list(map(int, input().split())) max_idx = 0 for i in range(1, n): if arr[i] >= arr[max_idx]: max_idx = i arr2 = arr[max_idx:] arr2.extend(arr[0:max_idx]) dp_left = [-1 for i in range(0, n)] for i in range(1, n): prev = i - 1 while...
output
1
84,613
8
169,227
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night. In c...
instruction
0
84,615
8
169,230
Tags: data structures Correct Solution: ``` n = int(input()) a = tuple(map(int, input().split())) b = 0 c, at = max((h, k) for k, h in enumerate(a)) last = c count = 0 d = list() e = d.append f = d.pop for at in range(at - 1, at - n, -1): current = a[at] while current > last: b += count last, co...
output
1
84,615
8
169,231
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night. In c...
instruction
0
84,616
8
169,232
Tags: data structures Correct Solution: ``` n = int(input()) hill = tuple(map(int, input().split())) pairs = 0 highest, at = max((h, k) for k, h in enumerate(hill)) last = highest count = 0 p = list() push = p.append pop = p.pop for at in range(at - 1, at - n, -1): current = hill[at] while current > last: ...
output
1
84,616
8
169,233
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night. In c...
instruction
0
84,617
8
169,234
Tags: data structures Correct Solution: ``` n = int(input()) arr = list(map(int, input().split())) max_idx = 0 for i in range(1, n): if arr[i] >= arr[max_idx]: max_idx = i arr2 = arr[max_idx:] arr2.extend(arr[0:max_idx]) # print(arr2) # for i in range(max_idx, n): # arr2.append(arr[i]) # for i in rang...
output
1
84,617
8
169,235
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night. In c...
instruction
0
84,618
8
169,236
Tags: data structures Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) top = max(a) stack = [[10 ** 9 + 1, 0, -1]] ans = 0 for i in range(n): while a[i] > stack[-1][0]: stack.pop() if a[i] < stack[-1][0]: stack.append([a[i], 1, i, i]) else: stack[-1][1] += 1...
output
1
84,618
8
169,237
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n bears in the inn and p places to sleep. Bears will party together for some number of nights (and days). Bears love drinking juice. They don't like wine but they can't distinguish it...
instruction
0
84,643
8
169,286
No
output
1
84,643
8
169,287
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n bears in the inn and p places to sleep. Bears will party together for some number of nights (and days). Bears love drinking juice. They don't like wine but they can't distinguish it...
instruction
0
84,644
8
169,288
No
output
1
84,644
8
169,289
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n bears in the inn and p places to sleep. Bears will party together for some number of nights (and days). Bears love drinking juice. They don't like wine but they can't distinguish it...
instruction
0
84,645
8
169,290
No
output
1
84,645
8
169,291
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some country is populated by wizards. They want to organize a demonstration. There are n people living in the city, x of them are the wizards who will surely go to the demonstration. Other city...
instruction
0
85,982
8
171,964
Yes
output
1
85,982
8
171,965
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,102
8
172,204
Tags: dp, greedy Correct Solution: ``` n = int(input()) a = [list(map(int, input().split())) for i in range(n)] k = 2 for i in range(1, n - 1): x, h = a[i] if x - h > a[i-1][0]: k += 1 elif x + h < a[i+1][0]: k += 1 a[i][0] += h if n == 1: print(1) else:...
output
1
86,102
8
172,205
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,103
8
172,206
Tags: dp, greedy Correct Solution: ``` # author : prottoyfuad # 30.09.2020 04:17:01(+0600) import sys, math, time start_time = time.time() def read() : return( int(input()) ) def read_args() : return( map(int, input().split()) ) def read_array() : return( list( map(int, input().split()) ) ) def read_s...
output
1
86,103
8
172,207
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,104
8
172,208
Tags: dp, greedy Correct Solution: ``` a=2 n=int(input()) l=[] for _ in range(n): x,h=map(int,input().split()) l.append([x,h]) if n<3:print(n);exit() t=l[0][0] for i in range(1,n-1): x,h=l[i][0],l[i][1] if x-h>t: a+=1;t=x elif x+h<l[i+1][0]: a+=1;t=x+h else: t=x print(a) ```
output
1
86,104
8
172,209
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,105
8
172,210
Tags: dp, greedy Correct Solution: ``` n = int(input()) x = [0] * (n + 1) h = [0] * (n + 1) for i in range(n): x[i], h[i] = (int(c) for c in input().split()) h[n] = 1 x[n] = x[n-1] + h[n-1] + 1 if n == 1: print(1) exit(0) left = [0] * n right = [0] * n left[0] = 1 if x[0] + h[0] < x[1]: right[0] = ...
output
1
86,105
8
172,211
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,106
8
172,212
Tags: dp, greedy Correct Solution: ``` import sys input = sys.stdin.readline n = int(input()) arr = [list(map(int, input().split())) for _ in range(n)] if n <= 2: print(n) else: ans = 0 for i in range(1,n-1): if arr[i][0] - arr[i][1] > arr[i-1][0]: ans +=1 elif arr[i][0] + arr[i...
output
1
86,106
8
172,213
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,107
8
172,214
Tags: dp, greedy Correct Solution: ``` n = int(input()) h = [] x = [] for i in range(n): a, b = map(int, input().split()) x.append(a) h.append(b) last = x[0] t = 1 for i in range(1, n - 1): if last < x[i] - h[i]: t += 1 last = x[i] elif x[i] + h[i] < x[i + 1]: t += 1 ...
output
1
86,107
8
172,215
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,108
8
172,216
Tags: dp, greedy Correct Solution: ``` n = int(input()) p = n x = [] h = [] while(p>0): p = p-1 a,b = map(int,input().split()) x.append(a) h.append(b) c = 0 table = [0]*(n) table[0] = -1 table[n-1] = 1 for i in range(1,n-1): if table[i-1] == -1: if x[i]-x[i-1]>h[i]: table[i] = -1...
output
1
86,108
8
172,217
Provide tags and a correct Python 3 solution for this coding contest problem. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are n...
instruction
0
86,109
8
172,218
Tags: dp, greedy Correct Solution: ``` n=int(input()) a=[] for i in range(n): x,h=map(int,input().split()) a.append([x,h]) num=1 i=1 while i<n-1: if a[i][1]<a[i][0]-a[i-1][0]: num+=1 else: if a[i][1]<a[i+1][0]-a[i][0]: num+=1 a[i][0]+=a[i][1] i+=1 if n>=2: ...
output
1
86,109
8
172,219
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,110
8
172,220
Yes
output
1
86,110
8
172,221
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,111
8
172,222
Yes
output
1
86,111
8
172,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,112
8
172,224
Yes
output
1
86,112
8
172,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,113
8
172,226
Yes
output
1
86,113
8
172,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,114
8
172,228
No
output
1
86,114
8
172,229
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,115
8
172,230
No
output
1
86,115
8
172,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,116
8
172,232
No
output
1
86,116
8
172,233
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the ...
instruction
0
86,117
8
172,234
No
output
1
86,117
8
172,235
Provide tags and a correct Python 3 solution for this coding contest problem. Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly ai each hour. Luba can't water ...
instruction
0
86,248
8
172,496
Tags: implementation Correct Solution: ``` n, k = list(map(int, input().split())) arr = list(map(int, input().split())) max_el = 0 for i in range(n): if k % arr[i] == 0: if max_el < arr[i]: max_el = arr[i] print(k // max_el) ```
output
1
86,248
8
172,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of...
instruction
0
86,260
8
172,520
No
output
1
86,260
8
172,521
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer...
instruction
0
86,284
8
172,568
Tags: brute force, greedy Correct Solution: ``` n, m, k = map(int, input().split()) free = [True] * n for i in list(map(int, input().split())): free[i] = False a = list(map(int, input().split())) last_lamp = [-1] * n for i in range(n): if free[i]: last_lamp[i] = i if i > 0 and not free[i]: l...
output
1
86,284
8
172,569
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer...
instruction
0
86,285
8
172,570
Tags: brute force, greedy Correct Solution: ``` import sys from sys import stdin,stdout n,m,k=map(int,stdin.readline().split(' ')) t22=stdin.readline()#;print(t22,"t2222") bl=[] if len(t22.strip())==0: bl=[] else: bl=list(map(int,t22.split(' '))) bd={} for i in bl: bd[i]=1 cost=list(map(int,stdin.readline().split...
output
1
86,285
8
172,571
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer...
instruction
0
86,286
8
172,572
Tags: brute force, greedy Correct Solution: ``` import sys from math import ceil n, l, k = map(int, sys.stdin.readline().split()) places = [True for _ in range(n)] for x in map(int, sys.stdin.readline().split()): places[x] = False costs = list(map(int, sys.stdin.readline().split())) if not places[0]: print(-1...
output
1
86,286
8
172,573
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer...
instruction
0
86,287
8
172,574
Tags: brute force, greedy Correct Solution: ``` import sys from math import ceil n, m, k = map(int, sys.stdin.readline().split()) places = [True for _ in range(n)] for x in map(int, sys.stdin.readline().split()): places[x] = False costs = list(map(int, sys.stdin.readline().split())) if not places[0]: print(-1)...
output
1
86,287
8
172,575
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer...
instruction
0
86,288
8
172,576
Tags: brute force, greedy Correct Solution: ``` def i_ints(): return list(map(int, input().split())) def next_free_from_blocks(n, blocks): """ n : pos ranges from 0 to n-1 blocks: sorted list of blocked positions return a list that maps each position to the next higher non-blocked pos...
output
1
86,288
8
172,577
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer...
instruction
0
86,289
8
172,578
Tags: brute force, greedy Correct Solution: ``` import sys from math import ceil n, m, k = map(int, sys.stdin.readline().split()) places = [True for _ in range(n)] for x in map(int, sys.stdin.readline().split()): places[x] = False costs = list(map(int, sys.stdin.readline().split())) if not places[0]: print(-1)...
output
1
86,289
8
172,579