message stringlengths 2 20.2k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 757 108k | cluster float64 4 4 | __index_level_0__ int64 1.51k 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of a subject continuously.
Let us say that his in... | instruction | 0 | 93,873 | 4 | 187,746 |
Tags: implementation, sortings
Correct Solution:
```
n, x = map(int,input().split())
c = list(map(int,input().split()))
c.sort()
h = 0
for i in range(n):
h += x*c[i]
if x <= 1:
x = 1
else:
x -= 1
print(h)
``` | output | 1 | 93,873 | 4 | 187,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of a subject continuously.
Let us say that his in... | instruction | 0 | 93,874 | 4 | 187,748 |
Tags: implementation, sortings
Correct Solution:
```
(n, x) = map(int, list(input().split()))
c = list(map(int, list(input().split())))
c = sorted(c)
s = 0
for i in range(n):
s += c[i] * x
if x != 1:
x -= 1
print(s)
``` | output | 1 | 93,874 | 4 | 187,749 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,875 | 4 | 187,750 |
Yes | output | 1 | 93,875 | 4 | 187,751 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,876 | 4 | 187,752 |
Yes | output | 1 | 93,876 | 4 | 187,753 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,877 | 4 | 187,754 |
Yes | output | 1 | 93,877 | 4 | 187,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,878 | 4 | 187,756 |
Yes | output | 1 | 93,878 | 4 | 187,757 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,879 | 4 | 187,758 |
No | output | 1 | 93,879 | 4 | 187,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,880 | 4 | 187,760 |
No | output | 1 | 93,880 | 4 | 187,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,881 | 4 | 187,762 |
No | output | 1 | 93,881 | 4 | 187,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the ith subject has ci chapters. When you teach him, you are supposed to teach all the chapters of ... | instruction | 0 | 93,882 | 4 | 187,764 |
No | output | 1 | 93,882 | 4 | 187,765 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,897 | 4 | 187,794 |
Tags: constructive algorithms, greedy
Correct Solution:
```
# wacky array overflowing
m, t, r = map(int, input().split())
ghosts = [int(i) for i in input().split()]
candles, flag = [0 for _ in range(ghosts[-1] + 1 + 300)], True
for i in range(m):
now = 0
for j in range(ghosts[i] - 1, ghosts[i] - t - 1, -1):
... | output | 1 | 93,897 | 4 | 187,795 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,898 | 4 | 187,796 |
Tags: constructive algorithms, greedy
Correct Solution:
```
def main():
m, t, r = map(int, input().split())
gh = sorted(map(int, input().split()), reverse=True)
if r > t:
print(-1)
return
l = [False] * 600
for g in gh:
g -= t
for i in range(g, g + r - sum(l[i] for i i... | output | 1 | 93,898 | 4 | 187,797 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,899 | 4 | 187,798 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import collections
m, t, r = map(int, input().split())
w = list(map(int, input().split()))
result = 0
current = collections.deque()
used = set()
def main():
global result, current
for ghost in w:
while current and current[0] < ghost:
... | output | 1 | 93,899 | 4 | 187,799 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,900 | 4 | 187,800 |
Tags: constructive algorithms, greedy
Correct Solution:
```
m,t,r=input().split(' ')
m=int(m)
t=int(t)
r=int(r)
if t<r:
input()
need=-1
else:
candles=[]
need=r
ghosts=input().split(' ')
for i in range(r):
candles.append(t-i)
for i in range(len(ghosts)-1):
dead=[]
diff... | output | 1 | 93,900 | 4 | 187,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,901 | 4 | 187,802 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import math
import sys
debug = False
if debug:
fin = open('input.txt', 'r')
fout = open('output.txt', 'w')
else:
fin = sys.stdin
fout = sys.stdout
s = fin.readline()
m, t, r = list(map(int, s.split()))
if r > t:
fout.write('-1')
exi... | output | 1 | 93,901 | 4 | 187,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,902 | 4 | 187,804 |
Tags: constructive algorithms, greedy
Correct Solution:
```
# import itertools
# import bisect
# import math
from collections import defaultdict, Counter, deque
import os
import sys
from io import BytesIO, IOBase
# sys.setrecursionlimit(10 ** 5)
ii = lambda: int(input())
lmii = lambda: list(map(int, input().split()))
... | output | 1 | 93,902 | 4 | 187,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,903 | 4 | 187,806 |
Tags: constructive algorithms, greedy
Correct Solution:
```
a,b,c = map(int,input().split())
t=sorted(map(int,input().split()),reverse=True)
if c>b:
print('-1')
else:
q=[False]*600
for k in t:
k=k-b
for j in range(k,k+c-sum(q[i] for i in range(k,k+b))):
q[j]=True
print(sum(q)... | output | 1 | 93,903 | 4 | 187,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second... | instruction | 0 | 93,904 | 4 | 187,808 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import sys
import math
m, t, r = map(int, input().split())
if r > t:
print(-1)
exit()
candles = []
gh = list(map(int, input().split()))
for i in range(m):
g = gh[i]
now_on = 0
for c in candles:
if g - c <= t:
... | output | 1 | 93,904 | 4 | 187,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,905 | 4 | 187,810 |
Yes | output | 1 | 93,905 | 4 | 187,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,906 | 4 | 187,812 |
Yes | output | 1 | 93,906 | 4 | 187,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,907 | 4 | 187,814 |
Yes | output | 1 | 93,907 | 4 | 187,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,908 | 4 | 187,816 |
Yes | output | 1 | 93,908 | 4 | 187,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,909 | 4 | 187,818 |
No | output | 1 | 93,909 | 4 | 187,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,910 | 4 | 187,820 |
No | output | 1 | 93,910 | 4 | 187,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,911 | 4 | 187,822 |
No | output | 1 | 93,911 | 4 | 187,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for ... | instruction | 0 | 93,912 | 4 | 187,824 |
No | output | 1 | 93,912 | 4 | 187,825 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,349 | 4 | 188,698 |
"Correct Solution:
```
n = int(input())
for _ in range(n):
y,m,d = map(int,input().split())
days = 0
if d!=1:
days += (20-d) if y%3!=0 and m%2==0 else (21-d)
d = 1
if m==10:
y += 1
m = 1
else:
m+=1
if y!=1000:
days += sum([19 if y%3!=0 and i%2==0 else 20 for i in range(11-m... | output | 1 | 94,349 | 4 | 188,699 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,350 | 4 | 188,700 |
"Correct Solution:
```
M = [19, 20]
Y = sum(M) * 5
for i in range(int(input())):
res = 0
y,m,d = list(map(int,input().split()))
for y_2 in range(1000-1, y, -1):
res += Y if y_2 % 3 != 0 else 200
for m_2 in range(10, m, -1):
res += M[m_2 % 2] if y % 3 != 0 else 20
res += (M[m%2] if... | output | 1 | 94,350 | 4 | 188,701 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,351 | 4 | 188,702 |
"Correct Solution:
```
LGE = 20
SML = 19
FUTU = 195
URUU = 200
YEAR3 = 590
def main():
howmany = int(input())
for i in range(howmany):
daycount = 0
dataset = input()
dataset = dataset.split(" ")
for j in range(len(dataset)):
dataset[j] = int(datase... | output | 1 | 94,351 | 4 | 188,703 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,352 | 4 | 188,704 |
"Correct Solution:
```
n = int(input())
anslist = []
Y = 1000
M = 1
D = 1
ans = 195 * (Y - 1)
ans += (Y - 1) // 3 * 5
ans += 20 * (M - 1)
ans += D
if Y % 3 != 0:
ans -= (M - 1) // 2
milenium = ans
for i in range(n):
Y, M, D = map(int, input().split())
ans = 195 * (Y - 1)
ans += (Y - 1) // 3 * 5
a... | output | 1 | 94,352 | 4 | 188,705 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,353 | 4 | 188,706 |
"Correct Solution:
```
def main():
y, m, d = map(int, input().split())
a = (y - 1) // 3
b = (y - 1) % 3
c = a * 590 + 195 * b
if y % 3:
a = (m - 1) // 2
b = (m - 1) % 2
c += a * 39 + b * 20
else:
c += (m - 1) * 20
c += d - 1
print(196470-c)
n = int(input(... | output | 1 | 94,353 | 4 | 188,707 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,354 | 4 | 188,708 |
"Correct Solution:
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def date2num(y,m,d):
t = (y-1)//3
days = t*10*20 + (y-1-t)*5*20+(y-1-t)*5*19
if y%3 == 0:
days += (m-1)*20+d
else:
days += (m-1)//2*19+(m-1-(m-1)//2)*20+d
return days
for i in range(int(input())):
y,m,d = ... | output | 1 | 94,354 | 4 | 188,709 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,355 | 4 | 188,710 |
"Correct Solution:
```
n = int(input())
def solve(Y,M,D):
ans = 0
ans += (Y - 1) * (19 + 20) * 5
ans += ((Y -1)// 3) * 5
ans += 19 * (M-1)
if Y % 3 ==0:
ans += (M-1)
else:
ans += (M // 2)
ans += (D-1)
print(196470 - ans)
for i in range(n):
l = input().split(' '... | output | 1 | 94,355 | 4 | 188,711 |
Provide a correct Python 3 solution for this coding contest problem.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall s... | instruction | 0 | 94,356 | 4 | 188,712 |
"Correct Solution:
```
n=int(input())
table=[0,20, 39, 59, 78, 98, 117, 137, 156, 176, 195]
u_table=[0,20, 40, 60, 80, 100, 120, 140, 160, 180, 200]
for i in range(n):
y,m,d=map(int,input().split())
ans=0
for j in range(y+1,1000):
if j%3==0:
ans+=u_table[-1]
else:
ans... | output | 1 | 94,356 | 4 | 188,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,357 | 4 | 188,714 |
Yes | output | 1 | 94,357 | 4 | 188,715 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,358 | 4 | 188,716 |
Yes | output | 1 | 94,358 | 4 | 188,717 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,359 | 4 | 188,718 |
Yes | output | 1 | 94,359 | 4 | 188,719 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,360 | 4 | 188,720 |
Yes | output | 1 | 94,360 | 4 | 188,721 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,361 | 4 | 188,722 |
No | output | 1 | 94,361 | 4 | 188,723 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,362 | 4 | 188,724 |
No | output | 1 | 94,362 | 4 | 188,725 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,363 | 4 | 188,726 |
No | output | 1 | 94,363 | 4 | 188,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through mont... | instruction | 0 | 94,364 | 4 | 188,728 |
No | output | 1 | 94,364 | 4 | 188,729 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,018 | 4 | 192,036 |
"Correct Solution:
```
# coding: utf-8
while 1:
n=int(input())
if n==0:
break
dic={}
ok=[[False for i in range(30)] for i in range(n)]
for i in range(n):
dic[i]=[i]
for m in list(map(int,input().split()))[1:]:
ok[i][m-1]=True
f=False
for i in range(30):
... | output | 1 | 96,018 | 4 | 192,037 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,019 | 4 | 192,038 |
"Correct Solution:
```
import itertools
while True:
N = int(input())
if not N:
break
D = [[] for _ in range(30)]
for i in range(N):
for x in map(int, input().split()[1:]):
D[x - 1].append(i)
C = [1 << i for i in range(N)]
for d in range(30):
for i, j in iterto... | output | 1 | 96,019 | 4 | 192,039 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,020 | 4 | 192,040 |
"Correct Solution:
```
import heapq
while True:
N = int(input())
if not N:
break
f = [0] * N
for i in range(N):
f[i] = list(map(int,input().split()[1:]))
dp = [ [0] * 51 for i in range(51) ]
for i in range(N):
for j in range(N):
dp[j][i] = 1<<i
for i in ... | output | 1 | 96,020 | 4 | 192,041 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,021 | 4 | 192,042 |
"Correct Solution:
```
import sys
from collections import deque,defaultdict
def bfs(s):
bfs_map = defaultdict(lambda : 1)
bfs_map[s] = 0
q = deque([s])
b = defaultdict(lambda : 0)
b[s[0]] = 1
while q:
x = q.popleft()
for y in v[x]:
if bfs_map[y]:
bfs_... | output | 1 | 96,021 | 4 | 192,043 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,022 | 4 | 192,044 |
"Correct Solution:
```
MAX_N = 50
MAX_DAY = 30
def solve(n, f):
dp = [[set() for j in range(n)] for i in range(MAX_DAY + 1)]
for i in range(n):
dp[0][i].add(i)
for d in range(1, MAX_DAY + 1):
# for line in dp[:5]:
# print(line)
for i in range(n):
dp[d][i] ... | output | 1 | 96,022 | 4 | 192,045 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,023 | 4 | 192,046 |
"Correct Solution:
```
def solve(n, meetables):
mets = [set() for _ in range(n)]
for d, meetable in enumerate(meetables[1:]):
today = meetable.copy()
for i in meetable:
today.update(mets[i])
mets[i] = today
if len(today) == n:
return d + 1
return ... | output | 1 | 96,023 | 4 | 192,047 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,024 | 4 | 192,048 |
"Correct Solution:
```
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().... | output | 1 | 96,024 | 4 | 192,049 |
Provide a correct Python 3 solution for this coding contest problem.
It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.
Now, the descendants ... | instruction | 0 | 96,025 | 4 | 192,050 |
"Correct Solution:
```
MAX_N = 50
MAX_DAY = 30
def solve(n, f):
dp = [{i} for i in range(n)]
for d in range(1, MAX_DAY + 1):
for i in range(n):
for j in range(n):
if f[d][i] and f[d][j]:
dp[i] |= dp[j]
if len(dp[i]) == n:
ret... | output | 1 | 96,025 | 4 | 192,051 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.