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.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Ber... | instruction | 0 | 48,954 | 8 | 97,908 |
Tags: data structures, dp, greedy
Correct Solution:
```
from collections import deque
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
q = deque([])
ans = [0] * n
tmp_ans = 0
for i in range(n):
ind = i
l_ind = i
while True:
if not q:
q.append... | output | 1 | 48,954 | 8 | 97,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Ber... | instruction | 0 | 48,955 | 8 | 97,910 |
Tags: data structures, dp, greedy
Correct Solution:
```
def main():
import sys
input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
inc = [0] * N
st = [(0, 1)]
S = 0
for i, a in enumerate(A):
if a > st[-1][0]:
S += a
inc... | output | 1 | 48,955 | 8 | 97,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Ber... | instruction | 0 | 48,956 | 8 | 97,912 |
Tags: data structures, dp, greedy
Correct Solution:
```
import collections
n = int(input())
m = [int(num) for num in input().split()]
rightlessque = collections.deque([])
indrightless = [n]*n
for i in range(n):
while rightlessque and m[i]<m[rightlessque[0]]:
indrightless[rightlessque.popleft()] = i
rightlessque.app... | output | 1 | 48,956 | 8 | 97,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Ber... | instruction | 0 | 48,957 | 8 | 97,914 |
Tags: data structures, dp, greedy
Correct Solution:
```
import heapq
n=int(input())
M=[int(i) for i in input().split()]
def f(X):
H=[]
Ret=[0]*n
tot=0
for i,x in enumerate(X):
haba=0
while H:
h=-heapq.heappop(H)
t,y=h//(10**6),h%(10**6)
if t<=x:
heapq.heappush(H,-(t*(10**6)+y)... | output | 1 | 48,957 | 8 | 97,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Ber... | instruction | 0 | 48,958 | 8 | 97,916 |
Tags: data structures, dp, greedy
Correct Solution:
```
import operator
from sys import stdin
n = int(input())
floors = [int(x) for x in stdin.readline().split()]
left = [0]*n
right = [0]*n
def left_index(lst):
# algorithm to find the nearest element to the left that is smaller
# empty stack
m = len(lst)
S... | output | 1 | 48,958 | 8 | 97,917 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Ber... | instruction | 0 | 48,959 | 8 | 97,918 |
Tags: data structures, dp, greedy
Correct Solution:
```
n = int(input())
sp = list(map(int, input().split()))
forw = [0 for i in range(n)]
backw = [0 for i in range(n)]
stack = [(0, -1, 0)]
for i in range(n):
while (sp[i] <= stack[-1][0]):
stack.pop()
stack.append((sp[i], i, (i - stack[-1][1]) * sp[i] + stack[-1][2... | output | 1 | 48,959 | 8 | 97,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Ber... | instruction | 0 | 48,960 | 8 | 97,920 |
Tags: data structures, dp, greedy
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import ... | output | 1 | 48,960 | 8 | 97,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,961 | 8 | 97,922 |
Yes | output | 1 | 48,961 | 8 | 97,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,962 | 8 | 97,924 |
Yes | output | 1 | 48,962 | 8 | 97,925 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,963 | 8 | 97,926 |
Yes | output | 1 | 48,963 | 8 | 97,927 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,964 | 8 | 97,928 |
Yes | output | 1 | 48,964 | 8 | 97,929 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,965 | 8 | 97,930 |
No | output | 1 | 48,965 | 8 | 97,931 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,966 | 8 | 97,932 |
No | output | 1 | 48,966 | 8 | 97,933 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,967 | 8 | 97,934 |
No | output | 1 | 48,967 | 8 | 97,935 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a harder version of the problem. In this version n β€ 500 000
The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of ... | instruction | 0 | 48,968 | 8 | 97,936 |
No | output | 1 | 48,968 | 8 | 97,937 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,074 | 8 | 98,148 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
import sys
import heapq
input = sys.stdin.readline
def main():
t = int(input())
for _ in range(t):
N, M, X = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
ans = [0] * N
value... | output | 1 | 49,074 | 8 | 98,149 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,075 | 8 | 98,150 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
T = int(input())
for _ in range(T):
n,m,x = map(int, input().split())
a1 = list(map(int, input().split()))
# print(a1)
a =[]
for i in range(n):
a.append([a1[i], i])
a.sort()
print('YES')
ans = []
wei... | output | 1 | 49,075 | 8 | 98,151 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,076 | 8 | 98,152 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
import sys
input = sys.stdin.readline
from heapq import heappop, heappush
for _ in range(int(input())):
# n = int(input())
n, m, x = map(int, input().split())
A = list(map(int, input().split()))
hp = [(0, i) for i in range(m)]... | output | 1 | 49,076 | 8 | 98,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,077 | 8 | 98,154 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
import sys
from os import path
if(path.exists('input.txt')):
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
# sys.stdin.readline().rstrip()
#n, m = map(int, input().split())
import math
t = int(input())
for _... | output | 1 | 49,077 | 8 | 98,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,078 | 8 | 98,156 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
t = int(input())
for case in range(1, t+1):
n, m, x = (int(i) for i in input().split())
h = [int(i) for i in input().split()]
blocks = [[h[i], i, 0] for i in range(n)]
blocks.sort(key=lambda x: x[0], reverse=True)
towerH... | output | 1 | 49,078 | 8 | 98,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,079 | 8 | 98,158 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
from heapq import heappush, heappop
def putin():
return map(int, input().split())
def sol():
n, m, x = putin()
A = list(putin())
H = []
if n < m:
print("NO")
return
print("YES")
for i in range(m... | output | 1 | 49,079 | 8 | 98,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,080 | 8 | 98,160 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
import io,os
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
def solve_tc():
n, m, x = map(int, input().split())
s = list(map(int, input().split()))
ans = [0 for i in range(n)]
l = []
for i in rang... | output | 1 | 49,080 | 8 | 98,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look bea... | instruction | 0 | 49,081 | 8 | 98,162 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
import os, sys, math
from io import BytesIO, IOBase
ma = lambda: map(int, input().split(" "))
def main():
for _ in range(int(input())):
n, m, x = ma()
h = list(ma())
hl = []
for i in range(n):
hl... | output | 1 | 49,081 | 8 | 98,163 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,082 | 8 | 98,164 |
Yes | output | 1 | 49,082 | 8 | 98,165 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,083 | 8 | 98,166 |
Yes | output | 1 | 49,083 | 8 | 98,167 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,084 | 8 | 98,168 |
Yes | output | 1 | 49,084 | 8 | 98,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,085 | 8 | 98,170 |
Yes | output | 1 | 49,085 | 8 | 98,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,086 | 8 | 98,172 |
No | output | 1 | 49,086 | 8 | 98,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,087 | 8 | 98,174 |
No | output | 1 | 49,087 | 8 | 98,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,088 | 8 | 98,176 |
No | output | 1 | 49,088 | 8 | 98,177 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the he... | instruction | 0 | 49,089 | 8 | 98,178 |
No | output | 1 | 49,089 | 8 | 98,179 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,114 | 8 | 98,228 |
Yes | output | 1 | 49,114 | 8 | 98,229 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,115 | 8 | 98,230 |
Yes | output | 1 | 49,115 | 8 | 98,231 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,116 | 8 | 98,232 |
Yes | output | 1 | 49,116 | 8 | 98,233 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,117 | 8 | 98,234 |
Yes | output | 1 | 49,117 | 8 | 98,235 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,118 | 8 | 98,236 |
No | output | 1 | 49,118 | 8 | 98,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,119 | 8 | 98,238 |
No | output | 1 | 49,119 | 8 | 98,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,120 | 8 | 98,240 |
No | output | 1 | 49,120 | 8 | 98,241 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox c... | instruction | 0 | 49,121 | 8 | 98,242 |
No | output | 1 | 49,121 | 8 | 98,243 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,334 | 8 | 98,668 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def main():
n = int(input())
a,b,h = [],[],[]
for _ in range(n):
u1,v1,w1 = map(int,input().split())
a.ap... | output | 1 | 49,334 | 8 | 98,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,335 | 8 | 98,670 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.m... | output | 1 | 49,335 | 8 | 98,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,336 | 8 | 98,672 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
import sys
n = int(sys.stdin.readline())
valores = [sys.stdin.readline().strip().split(' ') for _ in range(n)]
tmp = [0]*n
stack = []
#print(valores)
valores.sort(key=lambda x: (int(x[1]), int(x[0])), reverse=True)
for i in range(n):
... | output | 1 | 49,336 | 8 | 98,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,337 | 8 | 98,674 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
aux = [(9e9, 0, 0)]
n = int(input())
for i in range(n):
a, b, h = map(int, input().split())
aux.append((b, a, h)) #sort padrao eh pelo item 0 da tupla
aux.sort(reverse=True)
s, p = [0], [0] *(n + 1)
for i in range(1, n + 1):
... | output | 1 | 49,337 | 8 | 98,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,338 | 8 | 98,676 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
n = int(input())
d = []
for i in range(n):
a, b, h = map(int, input().split())
d.append((b, a, h))
d.sort()
ht = d[len(d) - 1][2]
ans = ht
s = []
s.append(d[len(d) - 1])
for i in range(n - 2, -1, -1):
while s and... | output | 1 | 49,338 | 8 | 98,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,339 | 8 | 98,678 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
from sys import stdin
n=int(input())
x,ans,sum=[[0]*3 for i in range(n)],0,0
d=[]
for i in range(n):
x[i][1],x[i][0],x[i][2]=map(int,stdin.readline().split())
x.sort()
for i in range(n-1,-1,-1):
while len(d)>0 and d[len(d)-1][1]>=x[i... | output | 1 | 49,339 | 8 | 98,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,340 | 8 | 98,680 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
import sys
n = int(sys.stdin.readline())
valores = [sys.stdin.readline().strip().split(' ') for _ in range(n)]
valores.sort(key=lambda x: (int(x[1]), int(x[0])), reverse=True)
tmp = [0]*n
stack = []
#print(valores)
for i in range(len(val... | output | 1 | 49,340 | 8 | 98,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory ... | instruction | 0 | 49,341 | 8 | 98,682 |
Tags: brute force, data structures, dp, greedy, sortings
Correct Solution:
```
n = int(input())
d = []
for i in range(n):
a, b, h = map(int, input().split())
d.append((b, a, h))
d.sort()
ht = d[len(d) - 1][2]
ans = ht
s = [d[len(d) - 1]]
for i in range(n - 2, -1, -1):
while s and d[i][0] <= s[len(s) - 1][1... | output | 1 | 49,341 | 8 | 98,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the anci... | instruction | 0 | 49,342 | 8 | 98,684 |
Yes | output | 1 | 49,342 | 8 | 98,685 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the anci... | instruction | 0 | 49,343 | 8 | 98,686 |
Yes | output | 1 | 49,343 | 8 | 98,687 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the anci... | instruction | 0 | 49,344 | 8 | 98,688 |
Yes | output | 1 | 49,344 | 8 | 98,689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.