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 a correct Python 3 solution for this coding contest problem.
There are $ n $ acitivities with start times $ \\ {s_i \\} $ and finish times $ \\ {t_i \\} $. Assuming that a person can only work on a single activity at a time, find the maximum number of activities that can be performed by a single person.
Const... | instruction | 0 | 2,440 | 8 | 4,880 |
"Correct Solution:
```
import heapq
n = int(input())
hq = []
for _ in range(n):
start, end = map(int, input().split())
heapq.heappush(hq, (end, start))
ans = 0
time = 0
while len(hq) > 0:
end, start = heapq.heappop(hq)
if time < start:
time = end
ans += 1
print(ans)
``` | output | 1 | 2,440 | 8 | 4,881 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Seryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size n × m cells on a map (rows of grid are numbered from 1 to n from north to south, and columns are numbered from... | instruction | 0 | 2,539 | 8 | 5,078 |
Tags: data structures, two pointers
Correct Solution:
```
def slide_min(tl,ql,val):
res=[0]*(tl-ql+1)
q=[0]*tl
s=0
t=0
for i in range(0,tl):
while s<t and val[q[t-1]]>=val[i]:
t-=1
q[t]=i
t+=1
if (i-ql+1)>=0:
res[i-ql+1]=val[q[s]]
if q[s]==(i-ql+1):
s+=1
return res
... | output | 1 | 2,539 | 8 | 5,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,885 | 8 | 5,770 |
Tags: binary search, greedy
Correct Solution:
```
# -*- coding: utf-8 -*-
# @Time : 2021/1/15 5:25 下午
# @Author : qu
# @Email : quzhenqing@zju.edu.cn
# @File : C. GukiZ hates Boxes.py
from sys import stdin
#
n, m = map(int, stdin.buffer.readline().split())
a = list(map(int, stdin.buffer.readline().split()))
... | output | 1 | 2,885 | 8 | 5,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,886 | 8 | 5,772 |
Tags: binary search, greedy
Correct Solution:
```
n, m = map(int, input().split())
# a = [0] * n
# s = 0
a = list(map(int, input().split()))
s = sum(a)
l = 2
r = s + n
while (l < r):
z = l + r >> 1
b = a.copy()
p = n - 1
for i in range(m):
while (p >= 0 and b[p] == 0):
p -= 1
... | output | 1 | 2,886 | 8 | 5,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,887 | 8 | 5,774 |
Tags: binary search, greedy
Correct Solution:
```
from sys import stdin
import copy
def check(id,b,m,t):
ans = 0
i = 0
while i < len(b):
ans += b[i]
#可以用掉一个人了
while ans + id[i] >= t:
ans -= (t - id[i])
m -= 1
if m <= 0:
if m == 0 ... | output | 1 | 2,887 | 8 | 5,775 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,888 | 8 | 5,776 |
Tags: binary search, greedy
Correct Solution:
```
def read_data():
n, m = map(int, input().split())
A = list(map(int, input().split()))
while A and not A[-1]:
del A[-1]
return len(A), m, A
def solve(n, m, A):
total = sum(A)
upper = n + (total + m - 1) // m
lower = n
while lower ... | output | 1 | 2,888 | 8 | 5,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,889 | 8 | 5,778 |
Tags: binary search, greedy
Correct Solution:
```
N, M = map(int, input().split())
books_list = list(map(int, input().split()))
while books_list[-1] == 0:
books_list.pop()
books_list.insert(0, 0)
def check(Time):
piles = books_list[:]
last_pile_no = len(piles) - 1
for i in range(M): #student
i... | output | 1 | 2,889 | 8 | 5,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,890 | 8 | 5,780 |
Tags: binary search, greedy
Correct Solution:
```
f = lambda: map(int, input().split())
n, m = f()
h = list(f())[::-1]
def g(t, m):
t -= n
d = 0
for u in h:
t += 1
if u > d:
if t < 1: return 1
u -= d
d = -u % t
m -= (u + d) // t
... | output | 1 | 2,890 | 8 | 5,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,891 | 8 | 5,782 |
Tags: binary search, greedy
Correct Solution:
```
n,m=map(int,input().split())
a=list(map(int,input().split()))
def c(t):
s,r,p,b=m,0,n,0
while 1:
while b==0:
if p==0: return 1
p-=1
b=a[p]
if r==0:
if s==0: return 0
r=t-p-1
s-=1
d=min(b,r)
b-=d
r-=d
l,h=0,n+sum(a)+9
while h-l>1:
md=(l+h)/... | output | 1 | 2,891 | 8 | 5,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Lucki... | instruction | 0 | 2,892 | 8 | 5,784 |
Tags: binary search, greedy
Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Created on Tue May 28 20:03:18 2019
@author: fsshakkhor
"""
N,M = map(int,input().split())
ara = list(map(int,input().split()))
while ara[-1] == 0:
ara.pop()
ara.insert(0,0)
def check(Time):
piles = ara[:]
last_pile_no = len(p... | output | 1 | 2,892 | 8 | 5,785 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,893 | 8 | 5,786 |
Yes | output | 1 | 2,893 | 8 | 5,787 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,894 | 8 | 5,788 |
Yes | output | 1 | 2,894 | 8 | 5,789 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,895 | 8 | 5,790 |
Yes | output | 1 | 2,895 | 8 | 5,791 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,896 | 8 | 5,792 |
Yes | output | 1 | 2,896 | 8 | 5,793 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,897 | 8 | 5,794 |
No | output | 1 | 2,897 | 8 | 5,795 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,898 | 8 | 5,796 |
No | output | 1 | 2,898 | 8 | 5,797 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,899 | 8 | 5,798 |
No | output | 1 | 2,899 | 8 | 5,799 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are n piles of boxes, arranged in a line, from left to right, i... | instruction | 0 | 2,900 | 8 | 5,800 |
No | output | 1 | 2,900 | 8 | 5,801 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On her way to programming school tiger Dasha faced her first test — a huge staircase!
<image>
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped thin... | instruction | 0 | 2,980 | 8 | 5,960 |
Yes | output | 1 | 2,980 | 8 | 5,961 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On her way to programming school tiger Dasha faced her first test — a huge staircase!
<image>
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped thin... | instruction | 0 | 2,981 | 8 | 5,962 |
Yes | output | 1 | 2,981 | 8 | 5,963 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On her way to programming school tiger Dasha faced her first test — a huge staircase!
<image>
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped thin... | instruction | 0 | 2,982 | 8 | 5,964 |
Yes | output | 1 | 2,982 | 8 | 5,965 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On her way to programming school tiger Dasha faced her first test — a huge staircase!
<image>
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped thin... | instruction | 0 | 2,983 | 8 | 5,966 |
Yes | output | 1 | 2,983 | 8 | 5,967 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On her way to programming school tiger Dasha faced her first test — a huge staircase!
<image>
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped thin... | instruction | 0 | 2,985 | 8 | 5,970 |
No | output | 1 | 2,985 | 8 | 5,971 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On her way to programming school tiger Dasha faced her first test — a huge staircase!
<image>
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped thin... | instruction | 0 | 2,986 | 8 | 5,972 |
No | output | 1 | 2,986 | 8 | 5,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On her way to programming school tiger Dasha faced her first test — a huge staircase!
<image>
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped thin... | instruction | 0 | 2,987 | 8 | 5,974 |
No | output | 1 | 2,987 | 8 | 5,975 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Instructors of Some Informatics School make students go to bed.
The house contains n rooms, in each room exactly b students were supposed to sleep. However, at the time of curfew it happened that many students are not located in their assig... | instruction | 0 | 3,057 | 8 | 6,114 |
Tags: binary search, brute force, greedy, sortings
Correct Solution:
```
read = lambda: map(int, input().split())
n, d, b = read()
d += 1
t, a = 0, [0] * (n + 1)
for i, x in enumerate(read()):
t += x
a[i + 1] = t
print(max(i - min(a[min(n, i * d)], (a[n] - a[max(0, n - i * d)])) // b for i in range(n + 3 >> 1))... | output | 1 | 3,057 | 8 | 6,115 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Instructors of Some Informatics School make students go to bed.
The house contains n rooms, in each room exactly b students were supposed to sleep. However, at the time of curfew it happened that many students are not located in their assig... | instruction | 0 | 3,058 | 8 | 6,116 |
Tags: binary search, brute force, greedy, sortings
Correct Solution:
```
func = lambda: map(int, input().split())
n, d, b = func()
d += 1
t, a = 0, [0] * (n + 1)
for i, x in enumerate(func()):
t += x
a[i + 1] = t
print(max(i - min(a[min(n, i * d)], (a[n] - a[max(0, n - i * d)])) // b for i in range(n + 3 >> 1))... | output | 1 | 3,058 | 8 | 6,117 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Instructors of Some Informatics School make students go to bed.
The house contains n rooms, in each room exactly b students were supposed to sleep. However, at the time of curfew it happened th... | instruction | 0 | 3,059 | 8 | 6,118 |
No | output | 1 | 3,059 | 8 | 6,119 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,467 | 8 | 6,934 |
Tags: data structures, geometry, greedy
Correct Solution:
```
from collections import deque
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
q_num = deque()
q_len = deque()
for i in range(n):
num_0 = a[i]
len_0 = 1
while True:
if len(q_num) == 0:
... | output | 1 | 3,467 | 8 | 6,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,468 | 8 | 6,936 |
Tags: data structures, geometry, greedy
Correct Solution:
```
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#
"""
"""
from operator import itemgetter
from collections import Counter
from collections import deque
import sys
input = sys.stdin.readline
def solve(a):
b = [-1]
c = [1]
for aa... | output | 1 | 3,468 | 8 | 6,937 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,469 | 8 | 6,938 |
Tags: data structures, geometry, greedy
Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[... | output | 1 | 3,469 | 8 | 6,939 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,470 | 8 | 6,940 |
Tags: data structures, geometry, greedy
Correct Solution:
```
from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
from sys import stdin
def RL(): return map(int, stdin.readline().rstrip().split() )
def comb(n, m): return factorial(n)/(factorial(m)*factorial(n-m)) if n... | output | 1 | 3,470 | 8 | 6,941 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,471 | 8 | 6,942 |
Tags: data structures, geometry, greedy
Correct Solution:
```
import os,io
import sys
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def main():
n=int(input())
a=list(map(int,input().split()))
d=n+1
b=[a[0]*d+1]
for i in range(1,n):
if b[-1]//d==a[i]:
b[-1]+=1
else:
b.append(a[i... | output | 1 | 3,471 | 8 | 6,943 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,472 | 8 | 6,944 |
Tags: data structures, geometry, greedy
Correct Solution:
```
def main():
from sys import stdin,stdout
ans = []
stdin.readline()
for ai in map(int, map(int, stdin.readline().split())):
cnt=1
while ans and ai*ans[-1][0]<=ans[-1][1]*cnt:
c, r = ans.pop()
ai+=r
... | output | 1 | 3,472 | 8 | 6,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,473 | 8 | 6,946 |
Tags: data structures, geometry, greedy
Correct Solution:
```
def main():
import sys
from collections import deque
input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
st = deque()
st_append = st.append
st_append((A[0], 1))
for a in A[1:]:
... | output | 1 | 3,473 | 8 | 6,947 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute wate... | instruction | 0 | 3,474 | 8 | 6,948 |
Tags: data structures, geometry, greedy
Correct Solution:
```
def main():
n,*a=map(int,open(0).read().split())
d=n+1
b=[a[0]*d+1]
for i in range(1,n):
if b[-1]//d==a[i]:
b[-1]+=1
else:
b.append(a[i]*d+1)
bx,bi=divmod(b[0],d)
bx*=bi
s=[bx*d+bi]
for ii in range(1,len(b)):
cx,ci=div... | output | 1 | 3,474 | 8 | 6,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,475 | 8 | 6,950 |
Yes | output | 1 | 3,475 | 8 | 6,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,476 | 8 | 6,952 |
Yes | output | 1 | 3,476 | 8 | 6,953 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,477 | 8 | 6,954 |
Yes | output | 1 | 3,477 | 8 | 6,955 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,478 | 8 | 6,956 |
Yes | output | 1 | 3,478 | 8 | 6,957 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,479 | 8 | 6,958 |
No | output | 1 | 3,479 | 8 | 6,959 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,480 | 8 | 6,960 |
No | output | 1 | 3,480 | 8 | 6,961 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,481 | 8 | 6,962 |
No | output | 1 | 3,481 | 8 | 6,963 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegme... | instruction | 0 | 3,482 | 8 | 6,964 |
No | output | 1 | 3,482 | 8 | 6,965 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beautiful skyscrapers in New York, the height of the i-th one is h_i. Today some villains have set on fire first n - 1 of them, and now the only safety building is n-th skyscraper.
Let's call a jump from i-th skyscraper to j-th ... | instruction | 0 | 3,549 | 8 | 7,098 |
Tags: data structures, dp, graphs
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def main():
n = int(input())
h = list(map(int,input().split()))
max_st = [-1]*n
min_st = [-1]*n
for i in range(n-2,-1,-1):
if h[... | output | 1 | 3,549 | 8 | 7,099 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beautiful skyscrapers in New York, the height of the i-th one is h_i. Today some villains have set on fire first n - 1 of them, and now the only safety building is n-th skyscraper.
Let's call a jump from i-th skyscraper to j-th ... | instruction | 0 | 3,550 | 8 | 7,100 |
Tags: data structures, dp, graphs
Correct Solution:
```
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from... | output | 1 | 3,550 | 8 | 7,101 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beautiful skyscrapers in New York, the height of the i-th one is h_i. Today some villains have set on fire first n - 1 of them, and now the only safety building is n-th skyscraper.
Let's call a jump from i-th skyscraper to j-th ... | instruction | 0 | 3,551 | 8 | 7,102 |
Tags: data structures, dp, graphs
Correct Solution:
```
"""
Satwik_Tiwari ;) .
8th Sept , 2020 - Tuesday
"""
#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function
from fractions import... | output | 1 | 3,551 | 8 | 7,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beautiful skyscrapers in New York, the height of the i-th one is h_i. Today some villains have set on fire first n - 1 of them, and now the only safety building is n-th skyscraper.
Let's call a jump from i-th skyscraper to j-th ... | instruction | 0 | 3,552 | 8 | 7,104 |
Tags: data structures, dp, graphs
Correct Solution:
```
# from bisect import bisect_left
import collections
N = int(input())
A = list(map(int, input().split()))
# print(N, A)
G = [set() for i in range(N)]
for i in range(N - 1):
G[i].add(i + 1)
stack = collections.deque()
for i, a in enumerate(A):
while stack... | output | 1 | 3,552 | 8 | 7,105 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beautiful skyscrapers in New York, the height of the i-th one is h_i. Today some villains have set on fire first n - 1 of them, and now the only safety building is n-th skyscraper.
Let's call a jump from i-th skyscraper to j-th ... | instruction | 0 | 3,553 | 8 | 7,106 |
Tags: data structures, dp, graphs
Correct Solution:
```
# Question: I - 1
# Assignment 12
# Daniel Perez, bd2255
# the total number of jumps is calculated through the loop by comparing potential jumps to make and avoiding builds that
# could be jumped over by simply being on a higher building
def rainy(L, N):
# d... | output | 1 | 3,553 | 8 | 7,107 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beautiful skyscrapers in New York, the height of the i-th one is h_i. Today some villains have set on fire first n - 1 of them, and now the only safety building is n-th skyscraper.
Let's call a jump from i-th skyscraper to j-th ... | instruction | 0 | 3,554 | 8 | 7,108 |
Tags: data structures, dp, graphs
Correct Solution:
```
from sys import stdin, stdout
def discrete_centrifugal_jumps(n, h_a):
jump_a1 = [[] for _ in range(n)]
jump_a2 = [[] for _ in range(n)]
st1 = []
st2 = []
for i in range(n):
# h l l l h
if not st1 or h_a[i] <= st1[-1][1]:
... | output | 1 | 3,554 | 8 | 7,109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.