output_description stringlengths 15 956 | submission_id stringlengths 10 10 | status stringclasses 3 values | problem_id stringlengths 6 6 | input_description stringlengths 9 2.55k | attempt stringlengths 1 13.7k | problem_description stringlengths 7 5.24k | samples stringlengths 2 2.72k |
|---|---|---|---|---|---|---|---|
Print the maximum number of pairs that can be created.
* * * | s117539834 | Wrong Answer | p03912 | The input is given from Standard Input in the following format:
N M
X_1 X_2 ... X_N | if __name__ == "__main__":
n, m = map(int, input().split(" "))
x = list(map(int, input().split(" ")))
x_mod = list(map(lambda x: x % m, x))
s = [set() for _ in range(m)]
num = [0 for _ in range(m)]
pair = [0 for _ in range(m)]
dic = dict()
sum = 0
sum_h = 0
for i in range(n):
s[x_mod[i]].add(x[i])
num[x_mod[i]] += 1
if str(x[i]) in dic.keys():
dic[str(x[i])] += 1
else:
dic[str(x[i])] = 0
if x_mod[i] == 0:
sum += 0.5
if m % 2 == 0 and x_mod[i] == m / 2:
sum_h += 0.5
for i in range(1, m):
if i == m / 2:
continue
for j in range(len(s[i])):
pair[i] += dic[str(list(s[i])[j])] / 2
sum = int(sum)
sum_h = int(sum_h)
sum += sum_h
for i in range(1, int((m + 1) / 2)):
i_1 = i
i_2 = m - i
if num[i] > num[m - i]:
i_1 = m - i
i_2 = i
sum += num[i_1]
sum += min((num[i_2] - num[i_1]) / 2, pair[i_2])
print(int(sum))
| Statement
Takahashi is playing with N cards.
The i-th card has an integer X_i on it.
Takahashi is trying to create as many pairs of cards as possible satisfying
one of the following conditions:
* The integers on the two cards are the same.
* The sum of the integers on the two cards is a multiple of M.
Find the maximum number of pairs that can be created.
Note that a card cannot be used in more than one pair. | [{"input": "7 5\n 3 1 4 1 5 9 2", "output": "3\n \n\nThree pairs (3,2), (1,4) and (1,9) can be created.\n\nIt is possible to create pairs (3,2) and (1,1), but the number of pairs is not\nmaximized with this.\n\n* * *"}, {"input": "15 10\n 1 5 6 10 11 11 11 20 21 25 25 26 99 99 99", "output": "6"}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s056741872 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | print(abs(int(input()) - 2199) // 200)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s193443189 | Wrong Answer | p02600 | Input is given from Standard Input in the following format:
X | d = {
range(400, 600): 8,
range(600, 800): 7,
range(800, 800): 6,
range(1000, 1200): 5,
range(1200, 1400): 4,
range(1400, 1600): 3,
range(1600, 1800): 2,
range(1800, 2000): 1,
}
x = int(input())
for k, v in d.items():
if x in k:
print(v)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s461775873 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | N = int(input())
A = list(map(int, input().split()))
s = (1000, 0, 0)
mmax = 1000
q = []
q.append(s)
while len(q) > 0:
m, k, d = q.pop()
if d == N - 1:
m += k * A[d]
if mmax < m:
mmax = m
else:
q.append((m, k, d + 1))
if m > A[d]:
x = m // A[d]
nm = m - x * A[d]
nk = k + x
q.append((nm, nk, d + 1))
if k > 0:
nm = m + k * A[d]
q.append((nm, 0, d + 1))
x = nm // A[d]
if x > 0:
q.append((nm - x * A[d], x, d + 1))
print(mmax)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s501298289 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | n = int(input())
A = [list(input().split()) for i in range(n)]
l = 2 * 10**5 + 5
# l = 500
# B = [[int(A[i][0]), int(A[i][1]), int(A[i][0])+int(A[i][1]), int(A[i][0])-int(A[i][1])+l, A[i][2]] for i in range(n)]
D = [[[] for j in range(2 * l)] for i in range(4)]
# for i in range(4):
# for j in range(n):
# D[i][B[j][i]].append(B[j])
for i in range(n):
x = int(A[i][0])
y = int(A[i][1])
nn = [x, y, A[i][2]]
D[0][x].append(nn)
D[1][y].append(nn)
D[2][x + y].append(nn)
D[3][x - y + l].append(nn)
# print(D)
import bisect
ans = float("inf")
for i in range(l):
# print(D[1][i])
LR = [[], []]
for j in range(len(D[1][i])):
if D[1][i][j][2] == "L":
LR[0].append(D[1][i][j][0])
if D[1][i][j][2] == "R":
LR[1].append(D[1][i][j][0])
# print(j,LR)
for k in range(len(LR[1])):
ind = bisect.bisect(LR[0], LR[1][k])
if ind != len(LR[0]):
ans = min(ans, (LR[0][ind] - LR[1][k]) * 5)
for i in range(l):
# print(D[0][i])
LR = [[], []]
for j in range(len(D[0][i])):
if D[0][i][j][2] == "U":
LR[0].append(D[0][i][j][1])
if D[0][i][j][2] == "D":
LR[1].append(D[0][i][j][1])
# print(j,LR)
for k in range(len(LR[0])):
ind = bisect.bisect(LR[1], LR[0][k])
# print("ind",ind)
if ind != len(LR[1]):
ans = min(ans, (LR[1][ind] - LR[0][k]) * 5)
for i in range(2 * l):
# print(D[1][i])
LR = [[], []]
LR2 = [[], []]
for j in range(len(D[2][i])):
if D[2][i][j][2] == "L":
LR[0].append(D[2][i][j][0])
if D[2][i][j][2] == "D":
LR[1].append(D[2][i][j][0])
if D[2][i][j][2] == "U":
LR2[0].append(D[2][i][j][0])
if D[2][i][j][2] == "R":
LR2[1].append(D[2][i][j][0])
# print(j,LR)
for k in range(len(LR[1])):
ind = bisect.bisect(LR[0], LR[1][k])
if ind != len(LR[0]):
ans = min(ans, (LR[0][ind] - LR[1][k]) * 10)
for k in range(len(LR2[1])):
ind = bisect.bisect(LR2[0], LR2[1][k])
if ind != len(LR2[0]):
ans = min(ans, (LR2[0][ind] - LR2[1][k]) * 10)
for i in range(2 * l):
# print(D[1][i])
LR = [[], []]
LR2 = [[], []]
for j in range(len(D[3][i])):
if D[3][i][j][2] == "D":
LR[0].append(D[3][i][j][1])
if D[3][i][j][2] == "R":
LR[1].append(D[3][i][j][1])
if D[3][i][j][2] == "L":
LR2[0].append(D[3][i][j][1])
if D[3][i][j][2] == "U":
LR2[1].append(D[3][i][j][1])
# print(j,LR)
for k in range(len(LR[1])):
ind = bisect.bisect(LR[0], LR[1][k])
if ind != len(LR[0]):
ans = min(ans, (LR[0][ind] - LR[1][k]) * 10)
for k in range(len(LR2[1])):
ind = bisect.bisect(LR2[0], LR2[1][k])
if ind != len(LR2[0]):
ans = min(ans, (LR2[0][ind] - LR2[1][k]) * 10)
if ans == float("inf"):
ans = "SAFE"
print(ans)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s218538193 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | def population(n):
if n == 0:
return 0
if n % 2 == 0:
return population(n // 2)
return 1 + population(n // 2)
N = int(input())
X = [0] * N
Y = [0] * N
P = [0] * N
for i in range(N):
X[i], Y[i], P[i] = map(int, input().split())
ans = [10**10] * (N + 1)
for i in range(1 << (2 * N)):
K = population(i)
if K > N:
continue
cost = 0
for j in range(N):
if i & (1 << j) or i & (1 << (j + N)):
continue
cost2 = min(abs(X[j]), abs(Y[j]))
for l in range(2 * N):
if (i & (1 << l)) == 0:
# print('cont', i)
continue
if l < N:
# print('x')
cost2 = min(cost2, abs(X[l] - X[j]))
else:
# print('y')
cost2 = min(cost2, abs(Y[l - N] - Y[j]))
cost += cost2 * P[j]
ans[K] = min(ans[K], cost)
# print(K, cost)
for i in range(N + 1):
print(ans[i])
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s383180496 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | # for _ in range(int(input())):
def zeroPad(numberString, zeros, left=True):
"""Return the string with zeros added to the left or right."""
for i in range(zeros):
if left:
numberString = "0" + numberString
else:
numberString = numberString + "0"
return numberString
def karatsubaMultiplication(x, y):
"""Multiply two integers using Karatsuba's algorithm."""
# convert to strings for easy access to digits
x = str(x)
y = str(y)
# base case for recursion
if len(x) == 1 and len(y) == 1:
return int(x) * int(y)
if len(x) < len(y):
x = zeroPad(x, len(y) - len(x))
elif len(y) < len(x):
y = zeroPad(y, len(x) - len(y))
n = len(x)
j = n // 2
# for odd digit integers
if (n % 2) != 0:
j += 1
BZeroPadding = n - j
AZeroPadding = BZeroPadding * 2
a = int(x[:j])
b = int(x[j:])
c = int(y[:j])
d = int(y[j:])
# recursively calculate
ac = karatsubaMultiplication(a, c)
bd = karatsubaMultiplication(b, d)
k = karatsubaMultiplication(a + b, c + d)
A = int(zeroPad(str(ac), AZeroPadding, False))
B = int(zeroPad(str(k - ac - bd), BZeroPadding, False))
return A + B + bd
n, k = map(int, input().split())
x = [int(x) for x in input().split()]
ans = [1] * n
ans[0] = x[0]
for i in range(1, k):
ans[i] = ans[i - 1] * x[i]
c = 0
for i in range(k, n):
ans[i] = karatsubaMultiplication(ans[i - 1], x[i]) / x[c]
if ans[i] > ans[i - 1]:
print("Yes")
else:
print("No")
c += 1
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s848466376 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | print(10 - (int(input()) // 200))
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s977867169 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | print((2199 - int(input())) // 200)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s209123795 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | N = int(input())
X = [None] * N
Y = [None] * N
U = [None] * N
for i in range(N):
X[i], Y[i], U[i] = input().split()
def main():
for i in range(N):
for j in range(N):
if i > j:
continue
if U[i] == U[j]:
continue
"""
U vs R ... Ux > Rx and Ux - Rx == Ry - Uy
U vs D ... Ux == Dx and Uy < Dy and (Uy - Dy) % 2 == 0 # Note: if Uy = 3, Dy = 0, conflict does NOT happen
U vs L ... Uy > Ly and Uy - Ly == Lx - Ux
"""
if U[i] == "U" and U[j] == "R":
if int(X[i]) > int(X[j]) and int(X[i]) - int(X[j]) == int(Y[j]) - int(
Y[i]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(Y[j]) - int(Y[i])) * 10)
if U[i] == "U" and U[j] == "D":
if (
(int(X[i]) == int(X[j]))
and (int(Y[i]) < int(Y[j]))
and (int(Y[i]) - int(Y[j])) % 2 == 0
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(Y[i]) - int(Y[j])) * 5)
if U[i] == "U" and U[j] == "L":
if int(Y[i]) > int(Y[j]) and int(Y[i]) - int(Y[j]) == int(X[j]) - int(
X[i]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(Y[i]) - int(Y[j])) * 10)
"""
R vs U ... Ry > Uy and Ry - Uy == Ux - Rx
R vs D ... Dx > Rx and Dx - Rx == Dy - Ry
R vs L ... Ry == Ly and Rx < Lx and (Rx - Lx) % 2 == 0
"""
if U[i] == "R" and U[j] == "U":
if int(Y[i]) > int(Y[j]) and int(Y[i]) - int(Y[j]) == int(X[j]) - int(
X[i]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(X[j]) - int(X[i])) * 10)
if U[i] == "R" and U[j] == "D":
if int(X[j]) > int(X[i]) and int(X[j]) - int(X[i]) == int(Y[j]) - int(
Y[i]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(X[j]) - int(X[i])) * 10)
if U[i] == "R" and U[j] == "L":
if (
(int(Y[i]) == int(Y[j]))
and (int(X[i]) < int(X[j]))
and (int(X[i]) - int(X[j])) % 2 == 0
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(X[i]) - int(X[j])) * 5)
"""
D vs U ... Dx == Ux and Dy > Uy and (Dy - Uy) % 2 == 0
D vs R ... Dy > Ry and Dy - Ry == Dx - Rx
D vs L ... Dy > Ly and Dy - Ly == Lx - Dx
"""
if U[i] == "D" and U[j] == "U":
if (
(int(X[i]) == int(X[j]))
and (int(Y[i]) > int(Y[j]))
and (int(Y[i]) - int(Y[j])) % 2 == 0
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(Y[i]) - int(Y[j])) * 5)
if U[i] == "D" and U[j] == "R":
if int(Y[i]) > int(Y[j]) and int(Y[i]) - int(Y[j]) == int(X[i]) - int(
X[j]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(Y[i]) - int(Y[j])) * 10)
if U[i] == "D" and U[j] == "L":
if int(Y[i]) > int(Y[j]) and int(Y[i]) - int(Y[j]) == int(X[j]) - int(
X[i]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(Y[i]) - int(Y[j])) * 10)
"""
L vs U ... Lx > Ux and Lx - Ux == Ly - Uy
L vs D ... Lx > Dx and Lx - Dx == Dy - Ly
L vs R ... Ly == Ry and Lx > Rx and (Rx - Lx) % 2 == 0
"""
if U[i] == "L" and U[j] == "U":
if int(X[i]) > int(X[j]) and int(X[i]) - int(X[j]) == int(Y[i]) - int(
Y[j]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(X[i]) - int(X[j])) * 10)
if U[i] == "L" and U[j] == "D":
if int(X[i]) > int(X[j]) and int(X[i]) - int(X[j]) == int(Y[j]) - int(
Y[i]
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(X[i]) - int(X[j])) * 10)
if U[i] == "L" and U[j] == "R":
if (
(int(Y[i]) == int(Y[j]))
and (int(X[i]) > int(X[j]))
and (int(X[j]) - int(X[i])) % 2 == 0
):
# print('{} {}'.format(U[i], U[j]))
return abs((int(X[j]) - int(X[i])) * 5)
return "SAFE"
print(main())
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s824490865 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | #! /usr/bin/env python3
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
N = int(readline())
XYP = [list(map(int, readline().split())) for _ in range(N)]
x_cost = [0] * ((1 << N) * N)
y_cost = [0] * ((1 << N) * N)
for bit in range(1 << N):
for i, (xi, yi, _) in enumerate(XYP):
x_cost[bit * N + i] = abs(xi)
y_cost[bit * N + i] = abs(yi)
for k, (xk, yk, _) in enumerate(XYP):
if bit & (1 << k):
x_cost[bit * N + i] = min(x_cost[bit * N + i], abs(xi - xk))
y_cost[bit * N + i] = min(y_cost[bit * N + i], abs(yi - yk))
ans = [sys.maxsize for _ in range(N + 1)]
for bit in range(1 << N):
cnt = bin(bit).count("1")
bit_ = bit
while bit_ >= 0:
bit_ &= bit
cost = 0
for k in range(N):
cost += (
1 * XYP[k][2] * min(x_cost[bit_ * N + k], y_cost[(bit - bit_) * N + k])
)
ans[cnt] = min(ans[cnt], cost)
bit_ -= 1
for i in range(N + 1):
print(ans[i])
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s428158639 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | N = int(input())
souba = list(map(int, input().split()))
urikaiba = list()
money = 1000
num = 0
for i in range(1, N - 1):
if (
(souba[i] - souba[i - 1]) * (souba[i + 1] - souba[i]) <= 0
and ((souba[i] - souba[i - 1]) != 0 or (souba[i + 1] - souba[i]) != 0)
and (souba[i] - souba[i - 1]) != 0
):
urikaiba.append(souba[i])
urikaiba.insert(0, souba[0])
urikaiba.append(souba[N - 1])
for i in range(len(urikaiba) - 1):
if urikaiba[i + 1] - urikaiba[i] > 0:
num = money // urikaiba[i]
money = money - num * urikaiba[i]
elif urikaiba[i + 1] - urikaiba[i] < 0:
money = money + num * souba[i]
num = 0
if num == 0:
print(money)
else:
print(money + num * souba[N - 1])
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s748001984 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | # Fast IO (only use in integer input)
# import os,io
# input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from copy import copy
N = int(input())
Resident = []
for i in range(N):
x, y, p = map(int, input().split())
Resident.append((x, y, p))
minCost = [-1] * (N + 1)
preCalRange = 1 << N
horizontalLineDistance = []
verticalLineDistance = []
for i in range(preCalRange):
railRoad = []
tmp = i
for j in range(N):
railRoad.append(tmp % 2)
tmp //= 2
minDistance = [-1] * N
for j in range(N):
minDistance[j] = min(abs(Resident[j][0]), abs(Resident[j][1]))
for k in range(N):
if (
railRoad[k] == 1
and abs(Resident[j][0] - Resident[k][0]) < minDistance[j]
):
minDistance[j] = abs(Resident[j][0] - Resident[k][0])
horizontalLineDistance.append(copy(minDistance))
minDistance = [-1] * N
for j in range(N):
minDistance[j] = min(abs(Resident[j][0]), abs(Resident[j][1]))
for k in range(N):
if (
railRoad[k] == 1
and abs(Resident[j][1] - Resident[k][1]) < minDistance[j]
):
minDistance[j] = abs(Resident[j][1] - Resident[k][1])
verticalLineDistance.append(copy(minDistance))
totalCases = 3**N
for i in range(totalCases):
railRoad = []
tmp = i
for j in range(N):
railRoad.append(tmp % 3)
tmp //= 3
horizontalCount = 0
verticalCount = 0
numNewRailroad = 0
for j in range(N):
if railRoad[j] == 1:
numNewRailroad += 1
horizontalCount += 1 << j
if railRoad[j] == 2:
verticalCount += 1 << j
numNewRailroad += 1
minDistance = []
for j in range(N):
minDistance.append(
min(
horizontalLineDistance[horizontalCount][j],
verticalLineDistance[verticalCount][j],
)
)
cost = 0
for j in range(N):
cost += Resident[j][2] * minDistance[j]
if minCost[numNewRailroad] == -1 or minCost[numNewRailroad] > cost:
minCost[numNewRailroad] = cost
for elem in minCost:
print(elem)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s517446463 | Wrong Answer | p02600 | Input is given from Standard Input in the following format:
X | print(1 + (int(input()) - 1) // 200)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s325134616 | Wrong Answer | p02600 | Input is given from Standard Input in the following format:
X | A = int(input())
print(9 - (A // 200))
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s667545681 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | print([8, 7, 6, 5, 4, 3, 2, 1][(input() - 400) // 200])
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s860084136 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | print(8 - int((input() - 400) / 200))
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s176115168 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | print(10 - int(input) // 200)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s021925461 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | X = int(input())
rating = {4: 8, 6: 7, 8: 6, 10: 5, 12: 4, 14: 3, 16: 2, 18: 1}
X = X // 100
if X % 2 == 1:
X = X - 1
print(rating.get(X))
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s656069217 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | x = int(input()[:-2])
print(int(10 - x // 2))
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s698234012 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | def main():
mtx = [
400,
599,
8,
600,
799,
7,
800,
999,
6,
1000,
1199,
5,
1200,
1399,
4,
1400,
1599,
3,
1600,
1799,
2,
1800,
1999,
1,
]
X = int(input())
for i in range(0, len(mtx), 3):
lo = mtx[i]
hi = mtx[i + 1]
ans = mtx[i + 2]
if lo <= X <= hi:
print(ans)
if __name__ == "__main__":
import sys
sys.setrecursionlimit(10000)
main()
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s987342256 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | mylist = []
x = 0
while x <= 1:
val = input()
x = x + 1
if val:
mylist.append(val)
else:
break
a = mylist[0].split()
A = int(a[0])
B = int(a[1])
C = int(a[2])
K = int(mylist[1])
r = A
g = B
b = C
for k in range(K):
if r > b and r > g:
if r > b:
b = b * 2
elif r > g:
g = g * 2
elif g > b:
b = b * 2
elif g > r:
g = g * 2
elif b == g or b == r:
b = b * 2
elif b > g and g == r:
g = g * 2
if b > g and g > r:
print("yes")
else:
print("no")
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s721262747 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | num = int(input())
shutu = 0
if 400 <= num <= 599:
shutu = 8
elif 600 <= num <= 799:
shutu = 7
elif 800 <= num <= 999:
shutu = 6
elif 1000 <= num <= 1199:
shutu = 5
elif 1200 <= num <= 1399:
shutu = 4
elif 1400 <= num <= 1599:
shutu = 3
elif 1600 <= num <= 1799:
shutu = 2
elif 1800 <= num <= 1999:
shutu = 1
else:
shutu = 0
print(shutu)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s898387127 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | def laod_to_mill():
days = int(input())
prices = tuple(map(int, input().split()))
if max(prices) == prices[0]:
print(1000)
return
total = 1000
ks = 0
for d in range(days):
if d == days - 1:
total += ks * prices[d]
break
if prices[d] < prices[d + 1]:
buy = total // prices[d]
total -= buy * prices[d]
ks += buy
elif prices[d] > prices[d + 1]:
total += ks * prices[d]
ks = 0
print(total)
def main():
laod_to_mill()
if __name__ == "__main__":
main()
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s684885258 | Wrong Answer | p02600 | Input is given from Standard Input in the following format:
X | print(10 - int(input()))
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s123596143 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | n = input()
n = int(n)
m = (n - 400) / 200
m = int(m)
print(8 - m)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s186090049 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | n = int(input())
if n < 600:
exit(print(8))
if n < 800:
exit(print(7))
if n < 1000:
exit(print(6))
if n < 1200:
exit(print(5))
if n < 1400:
exit(print(4))
if n < 1600:
exit(print(3))
if n < 1800:
exit(print(2))
if n < 2000:
exit(print(1))
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s281336512 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | # m-solutions2020_a.py
# https://atcoder.jp/contests/m-solutions2020 : A
global FLAG_LOG
FLAG_LOG = False
def log(value):
# FLAG_LOG = True
# FLAG_LOG = False
if FLAG_LOG:
print(str(value))
def calculation(lines):
X = int(lines[0])
if X < 600:
ret = 8
elif X < 800:
ret = 7
elif X < 1000:
ret = 6
elif X < 1200:
ret = 5
elif X < 1400:
ret = 4
elif X < 1600:
ret = 3
elif X < 1800:
ret = 2
else:
ret = 1
return [ret]
# 引数を取得
def get_input_lines(lines_count):
lines = list()
for _ in range(lines_count):
lines.append(input())
return lines
# テストデータ
def get_testdata(pattern):
if pattern == 1:
lines_input = [725]
lines_export = [7]
if pattern == 2:
lines_input = [1600]
lines_export = [2]
return lines_input, lines_export
# 動作モード判別
def get_mode():
import sys
args = sys.argv
global FLAG_LOG
if len(args) == 1:
mode = 0
FLAG_LOG = False
else:
mode = int(args[1])
FLAG_LOG = True
return mode
# 主処理
def main():
# import time
# started = time.time()
mode = get_mode()
if mode == 0:
lines_input = get_input_lines(1)
else:
lines_input, lines_export = get_testdata(mode)
lines_result = calculation(lines_input)
for line_result in lines_result:
print(line_result)
if mode > 0:
print(f"lines_input=[{lines_input}]")
print(f"lines_export=[{lines_export}]")
print(f"lines_result=[{lines_result}]")
if lines_result == lines_export:
print("OK")
else:
print("NG")
# finished = time.time()
# duration = finished - started
# print(f'duration=[{duration}]')
# 起動処理
if __name__ == "__main__":
main()
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s668078702 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | x = int(input())
kyu = 8
border = 600
while kyu > 0:
if x < border:
break
kyu -= 1
border += 200
print(kyu)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s249842252 | Runtime Error | p02600 | Input is given from Standard Input in the following format:
X | x = int(input())
ran = list(range(400, 2000, 200))
pointer = 0
while x >= ran[pointer]:
pointer += 1
print(9 - pointer)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s598090931 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | X = (int(input()) - 400) // 200
print(8 - X)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the kyu M-kun has, as an integer. For example, if he has 8-kyu, print
`8`.
* * * | s597496426 | Accepted | p02600 | Input is given from Standard Input in the following format:
X | rate = int(input())
k = "1"
if 400 <= rate < 600:
k = "8"
elif 600 <= rate < 800:
k = "7"
elif 800 <= rate < 1000:
k = "6"
elif 1000 <= rate < 1200:
k = "5"
elif 1200 <= rate < 1400:
k = "4"
elif 1400 <= rate < 1600:
k = "3"
elif 1600 <= rate < 1800:
k = "2"
elif 1800 <= rate < 2000:
k = "1"
print(k)
| Statement
M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a _kyu_ (class) according to his/her
highest rating. For ratings from 400 through 1999, the following kyus are
given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 through 1199: 5-kyu
* From 1200 through 1399: 4-kyu
* From 1400 through 1599: 3-kyu
* From 1600 through 1799: 2-kyu
* From 1800 through 1999: 1-kyu
What kyu does M-kun have? | [{"input": "725", "output": "7\n \n\nM-kun's highest rating is 725, which corresponds to 7-kyu. \nThus, `7` is the correct output.\n\n* * *"}, {"input": "1600", "output": "2\n \n\nM-kun's highest rating is 1600, which corresponds to 2-kyu. \nThus, `2` is the correct output."}] |
Print the minumum value of K, the number of antennas, when the condition is
satisfied.
* * * | s911808996 | Wrong Answer | p03441 | Input is given from Standard Input in the following format:
N
a_0 b_0
a_1 b_1
:
a_{N - 2} b_{N - 2} | n = int(input())
print(n - 2)
| Statement
We have a tree with N vertices. The vertices are numbered 0 through N - 1, and
the i-th edge (0 ≤ i < N - 1) comnnects Vertex a_i and b_i. For each pair of
vertices u and v (0 ≤ u, v < N), we define the distance d(u, v) as the number
of edges in the path u-v.
It is expected that one of the vertices will be invaded by aliens from outer
space. Snuke wants to immediately identify that vertex when the invasion
happens. To do so, he has decided to install an antenna on some vertices.
First, he decides the number of antennas, K (1 ≤ K ≤ N). Then, he chooses K
different vertices, x_0, x_1, ..., x_{K - 1}, on which he installs Antenna 0,
1, ..., K - 1, respectively. If Vertex v is invaded by aliens, Antenna k (0 ≤
k < K) will output the distance d(x_k, v). Based on these K outputs, Snuke
will identify the vertex that is invaded. Thus, in order to identify the
invaded vertex no matter which one is invaded, the following condition must
hold:
* For each vertex u (0 ≤ u < N), consider the vector (d(x_0, u), ..., d(x_{K - 1}, u)). These N vectors are distinct.
Find the minumum value of K, the number of antennas, when the condition is
satisfied. | [{"input": "5\n 0 1\n 0 2\n 0 3\n 3 4", "output": "2\n \n\nFor example, install an antenna on Vertex 1 and 3. Then, the following five\nvectors are distinct:\n\n * (d(1, 0), d(3, 0)) = (1, 1)\n * (d(1, 1), d(3, 1)) = (0, 2)\n * (d(1, 2), d(3, 2)) = (2, 2)\n * (d(1, 3), d(3, 3)) = (2, 0)\n * (d(1, 4), d(3, 4)) = (3, 1)\n\n* * *"}, {"input": "2\n 0 1", "output": "1\n \n\nFor example, install an antenna on Vertex 0.\n\n* * *"}, {"input": "10\n 2 8\n 6 0\n 4 1\n 7 6\n 2 3\n 8 6\n 6 9\n 2 4\n 5 8", "output": "3\n \n\nFor example, install an antenna on Vertex 0, 4, 9."}] |
Print the minumum value of K, the number of antennas, when the condition is
satisfied.
* * * | s545146026 | Wrong Answer | p03441 | Input is given from Standard Input in the following format:
N
a_0 b_0
a_1 b_1
:
a_{N - 2} b_{N - 2} | def examA():
N = I()
ans = 0
print(ans)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
#############################################################
class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
self.n = n
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
# 要素xが属するグループの根を返す
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(self, x, y):
# 要素xが属するグループと要素yが属するグループとを併合する
x, y = self.find(x), self.find(y)
if x == y:
return False
else:
if self.size(x) < self.size(y):
x, y = y, x
self.parent[x] += self.parent[y]
self.parent[y] = x
def same(self, x, y):
# 要素x, yが同じグループに属するかどうかを返す
return self.find(x) == self.find(y)
def size(self, x):
# 要素xが属するグループのサイズ(要素数)を返す
x = self.find(x)
return -self.parent[x]
def is_root(self, x):
# 要素の根をリストで返す
return self.parent[x] < 0
def roots(self):
# すべての根の要素をリストで返す
return [i for i, x in enumerate(self.parent) if x < 0]
def members(self, x):
# 要素xが属するグループに属する要素をリストで返す
root = self.find(x)
return [i for i in range(self.n) if self.find(i) == root]
def group_count(self):
# グループの数を返す
return len(self.roots())
def all_group_members(self):
# {ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す
return {r: self.members(r) for r in self.roots()}
################################################################################
N, M = LI()
a = LI()
ans = 0
uf = UnionFind(N)
for _ in range(M):
x, y = LI()
if not uf.same(x, y):
uf.unite(x, y)
D = defaultdict(int)
rep = defaultdict(bool)
r = uf.roots()
keep = [-1] * N
for i in range(N):
parent = uf.find(i)
if (not D[parent]) or D[parent] > a[i]:
D[parent] = a[i]
keep[parent] = i
for i in range(N):
if keep[i] == -1:
continue
rep[keep[i]] = True
ans += D[i]
loop = uf.group_count() - 2
if loop == -1:
print(0)
return
A = []
for i, j in enumerate(a):
A.append([j, i])
A.sort()
cur = 0
for i in range(N):
if cur >= loop:
break
if not rep[A[i][1]]:
cur += 1
ans += A[i][0]
if cur < loop:
print("Impossible")
return
print(ans)
return
def examE():
def bfs(n, e, fordfs):
# 点の数、スタートの点、有向グラフ
W = [-1] * n
# 各点の状態量、最短距離とか,見たかどうかとか
W[e] = 0
que = deque()
que.append(e)
while que:
now = que.popleft()
nowW = W[now]
for ne in fordfs[now]:
if W[ne] == -1:
W[ne] = nowW + 1
que.append(ne)
return W
N = I()
V = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = LI()
V[a].append(b)
V[b].append(a)
L1 = bfs(N, 0, V)
L2 = bfs(N, L1.index(max(L1)), V)
if max(L2) == N - 1:
print(1)
return
ans = 2
for i in range(N):
cur = len(V[i])
if cur >= 4:
ans += cur - 3
print(ans)
return
def examF():
ans = 0
print(ans)
return
import sys, copy, bisect, itertools, heapq, math
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque
def I():
return int(sys.stdin.readline())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LFI():
return list(map(float, sys.stdin.readline().split()))
def LSI():
return list(map(str, sys.stdin.readline().split()))
def LS():
return sys.stdin.readline().split()
def SI():
return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord("a") + i) for i in range(26)]
if __name__ == "__main__":
examE()
"""
"""
| Statement
We have a tree with N vertices. The vertices are numbered 0 through N - 1, and
the i-th edge (0 ≤ i < N - 1) comnnects Vertex a_i and b_i. For each pair of
vertices u and v (0 ≤ u, v < N), we define the distance d(u, v) as the number
of edges in the path u-v.
It is expected that one of the vertices will be invaded by aliens from outer
space. Snuke wants to immediately identify that vertex when the invasion
happens. To do so, he has decided to install an antenna on some vertices.
First, he decides the number of antennas, K (1 ≤ K ≤ N). Then, he chooses K
different vertices, x_0, x_1, ..., x_{K - 1}, on which he installs Antenna 0,
1, ..., K - 1, respectively. If Vertex v is invaded by aliens, Antenna k (0 ≤
k < K) will output the distance d(x_k, v). Based on these K outputs, Snuke
will identify the vertex that is invaded. Thus, in order to identify the
invaded vertex no matter which one is invaded, the following condition must
hold:
* For each vertex u (0 ≤ u < N), consider the vector (d(x_0, u), ..., d(x_{K - 1}, u)). These N vectors are distinct.
Find the minumum value of K, the number of antennas, when the condition is
satisfied. | [{"input": "5\n 0 1\n 0 2\n 0 3\n 3 4", "output": "2\n \n\nFor example, install an antenna on Vertex 1 and 3. Then, the following five\nvectors are distinct:\n\n * (d(1, 0), d(3, 0)) = (1, 1)\n * (d(1, 1), d(3, 1)) = (0, 2)\n * (d(1, 2), d(3, 2)) = (2, 2)\n * (d(1, 3), d(3, 3)) = (2, 0)\n * (d(1, 4), d(3, 4)) = (3, 1)\n\n* * *"}, {"input": "2\n 0 1", "output": "1\n \n\nFor example, install an antenna on Vertex 0.\n\n* * *"}, {"input": "10\n 2 8\n 6 0\n 4 1\n 7 6\n 2 3\n 8 6\n 6 9\n 2 4\n 5 8", "output": "3\n \n\nFor example, install an antenna on Vertex 0, 4, 9."}] |
Print the minumum value of K, the number of antennas, when the condition is
satisfied.
* * * | s067966737 | Runtime Error | p03441 | Input is given from Standard Input in the following format:
N
a_0 b_0
a_1 b_1
:
a_{N - 2} b_{N - 2} | """
Writer: SPD_9X2
https://atcoder.jp/contests/apc001/tasks/apc001_e
厳密な照明は難しいが…
直径を取る
直径の端点からbfs
全ての頂点に関して、部分木に少なくとも一つのアンテナを持つかのフラグを管理
子の数をkとする。その内x個がtrueの場合、k-1-x個のアンテナを追加。自分のflagをtrueにする
子がfalseで、子が0 or 1つしかない場合のみfalse継続
簡単な木では最適になることを実験したがどうだろうか…?
"""
from collections import deque
def NC_Dij(lis, start):
ret = [float("inf")] * len(lis)
ret[start] = 0
q = deque([start])
plis = [i for i in range(len(lis))]
while len(q) > 0:
now = q.popleft()
for nex in lis[now]:
if ret[nex] > ret[now] + 1:
ret[nex] = ret[now] + 1
plis[nex] = now
q.append(nex)
return ret, plis, now
N = int(input())
lis = [[] for i in range(N)]
for i in range(N - 1):
a, b = map(int, input().split())
lis[a].append(b)
lis[b].append(a)
td, tp, stp = NC_Dij(lis, 0)
ans = 0
def dfs(v, p):
x = 0
c = 0
retflag = False
for nex in lis[v]:
if nex != p:
c += 1
have = dfs(nex, v)
retflag = have or retflag
if have:
x += 1
if c - 1 - x > 0:
retflag = True
global ans
ans += max(0, c - 1 - x)
return retflag
dfs(stp, stp)
print(ans + 1)
| Statement
We have a tree with N vertices. The vertices are numbered 0 through N - 1, and
the i-th edge (0 ≤ i < N - 1) comnnects Vertex a_i and b_i. For each pair of
vertices u and v (0 ≤ u, v < N), we define the distance d(u, v) as the number
of edges in the path u-v.
It is expected that one of the vertices will be invaded by aliens from outer
space. Snuke wants to immediately identify that vertex when the invasion
happens. To do so, he has decided to install an antenna on some vertices.
First, he decides the number of antennas, K (1 ≤ K ≤ N). Then, he chooses K
different vertices, x_0, x_1, ..., x_{K - 1}, on which he installs Antenna 0,
1, ..., K - 1, respectively. If Vertex v is invaded by aliens, Antenna k (0 ≤
k < K) will output the distance d(x_k, v). Based on these K outputs, Snuke
will identify the vertex that is invaded. Thus, in order to identify the
invaded vertex no matter which one is invaded, the following condition must
hold:
* For each vertex u (0 ≤ u < N), consider the vector (d(x_0, u), ..., d(x_{K - 1}, u)). These N vectors are distinct.
Find the minumum value of K, the number of antennas, when the condition is
satisfied. | [{"input": "5\n 0 1\n 0 2\n 0 3\n 3 4", "output": "2\n \n\nFor example, install an antenna on Vertex 1 and 3. Then, the following five\nvectors are distinct:\n\n * (d(1, 0), d(3, 0)) = (1, 1)\n * (d(1, 1), d(3, 1)) = (0, 2)\n * (d(1, 2), d(3, 2)) = (2, 2)\n * (d(1, 3), d(3, 3)) = (2, 0)\n * (d(1, 4), d(3, 4)) = (3, 1)\n\n* * *"}, {"input": "2\n 0 1", "output": "1\n \n\nFor example, install an antenna on Vertex 0.\n\n* * *"}, {"input": "10\n 2 8\n 6 0\n 4 1\n 7 6\n 2 3\n 8 6\n 6 9\n 2 4\n 5 8", "output": "3\n \n\nFor example, install an antenna on Vertex 0, 4, 9."}] |
Print the minimum possible sum of the flight times.
* * * | s627079295 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | fee = list(map(int, input().split()))
fee.sort()
print(fee[0] + fee[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s437271725 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | times = [map(int, input().split())].sort()
min = sum(times[:1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s706397350 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | print(sum(sorted(map(int, input().split()))[0:2]))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s551284911 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | t1, t2, t3 = sorted(map(int, input().split()))
print(t1 + t2)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s419723907 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | h = list(map(int, input().split()))
print(sum(sorted(h)[:2]))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s114309090 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | print(sum(sorted(list(map(int, input().split()))[:2])))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s573029875 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | L = map(int, input().split())
print(min(sum(L) - v for v in L))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s356791766 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | sum(sorted(list(map(int, input().split())))[:2])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s694637612 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | A, B, C = map(int, input().split())
P = A + B
R = A + C
Q = C + B
if Q > P:
X = P
else:
X = Q
if R > X:
print(X)
else:
print(R)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s161646149 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | T = input()
data = T.split()
data_int = list(map(int, data))
data_int.sort()
print(data_int[0] + data_int[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s732770793 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | l = input().split()
p, q, r = int(l[0]), int(l[1]), int(l[2])
k = max([p, q, r])
print(p + q + r - k)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s214692026 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | import copy
H, W = map(int, input().split())
state = []
for i in range(H):
row_list = list(input())
state.append(row_list)
def light(row, col, state):
lighted_count = 0
col1 = copy.copy(col)
next = "."
while next == ".":
lighted_count += 1
col1 += 1
if col1 >= W:
break
next = state[row][col1]
col2 = copy.copy(col)
next = "."
while next == ".":
lighted_count += 1
col2 -= 1
if col2 < 0:
break
next = state[row][col2]
row1 = copy.copy(row)
next = "."
while next == ".":
lighted_count += 1
row1 += 1
if row1 >= H:
break
next = state[row1][col]
row2 = copy.copy(row)
next = "."
while next == ".":
lighted_count += 1
row2 -= 1
if row2 < 0:
break
next = state[row2][col]
lighted_count -= 3
return lighted_count
def blank_fun(state):
blank_list = []
for h in range(H):
for w in range(W):
if state[h][w] == ".":
blank_list.append([h, w])
return blank_list
blank_list = blank_fun(state)
blank_count = 0
for blank in blank_list:
row = blank[0]
col = blank[1]
blank_count_now = light(row, col, state)
if blank_count_now > blank_count:
blank_count = blank_count_now
print(blank_count)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s429549662 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | h, w = map(int, input().split())
sl = [input() for i in range(h)]
ll = [[0] * w for i in range(h)]
for i in range(h):
for j in range(w):
if sl[i][j] == ".":
if j == 0:
ll[i][j] = 1
else:
ll[i][j] = ll[i][j - 1] + 1
else:
ll[i][j] = 0
rl = [[0] * w for i in range(h)]
for i in range(h):
for j in range(w - 1, -1, -1):
if sl[i][j] == ".":
if j == w - 1:
rl[i][j] = 1
else:
rl[i][j] = rl[i][j + 1] + 1
else:
rl[i][j] = 0
ul = [[0] * w for i in range(h)]
for j in range(w):
for i in range(h):
if sl[i][j] == ".":
if i == 0:
ul[i][j] = 1
else:
ul[i][j] = ul[i - 1][j] + 1
else:
ul[i][j] = 0
dl = [[0] * w for i in range(h)]
for j in range(w):
for i in range(h - 1, -1, -1):
if sl[i][j] == ".":
if i == h - 1:
dl[i][j] = 1
else:
dl[i][j] = dl[i + 1][j] + 1
else:
dl[i][j] = 0
ans = 0
for i in range(h):
for j in range(w):
ans = max(ans, ll[i][j] + rl[i][j] + ul[i][j] + dl[i][j] - 3)
print(ans)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s440112122 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | P, Q, R = map(int, input().split())
count = 300
for i in [P, Q, R]:
for j in [P, Q, R]:
if i == j:
count = count
else:
if i + j <= count:
count = i + j
print(count)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s531359317 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | def main():
h, w = map(int, input().split())
ss = [input() for _ in range(h)]
matl = [[0 for _ in range(w)] for _ in range(h)]
matr = [[0 for _ in range(w)] for _ in range(h)]
matu = [[0 for _ in range(w)] for _ in range(h)]
matd = [[0 for _ in range(w)] for _ in range(h)]
for j in range(h):
for i in range(w):
if ss[j][i] == "#":
matd[j][i] = 0
elif j == 0:
matd[j][i] = 1
else:
matd[j][i] = matd[j - 1][i] + 1
if ss[h - j - 1][i] == "#":
matu[h - j - 1][i] = 0
elif h - j == h:
matu[h - j - 1][i] = 1
else:
matu[h - j - 1][i] = matu[h - j][i] + 1
if ss[j][i] == "#":
matr[j][i] = 0
elif i == 0:
matr[j][i] = 1
else:
matr[j][i] = matr[j][i - 1] + 1
if ss[j][w - i - 1] == "#":
matl[j][w - i - 1] = 0
elif w - i == w:
matl[j][w - i - 1] = 1
else:
matl[j][w - i - 1] = matl[j][w - i] + 1
maxv = 0
for j in range(h):
for i in range(w):
tmp = matu[j][i] + matd[j][i] + matr[j][i] + matl[j][i]
if tmp > maxv:
maxv = tmp
print(maxv - 3)
if __name__ == "__main__":
main()
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s144744561 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | from operator import mul
from functools import reduce
n, m = [int(i) for i in input().split()]
arr = [int(input()) for i in range(m)]
arr.append(n + 1)
arr.insert(0, -1)
div_arr = [arr[i + 1] - arr[i] - 1 for i in range(len(arr) - 1)]
def Fib(n):
a, b = 0, 1
if n == 1:
return a
elif n == 2:
return b
else:
for i in range(n - 2):
a, b = b, a + b
return b
if 0 in div_arr:
print(0)
else:
print(reduce(mul, [Fib(i + 1) for i in div_arr]) % 1000000007)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s506400472 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | h, w = map(int, input().split())
s = []
a = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
ss = input()
s.append(ss)
b = 0
for j, k in enumerate(ss):
if k == "#":
b = 0
a[i][j] == 0
else:
b += 1
a[i][j] = b
mx = 0
for j in range(w - 1, -1, -1):
if a[i][j] == 0:
mx = 0
continue
else:
mx = max(a[i][j], mx)
a[i][j] = mx
c = [[0 for i in range(h)] for j in range(w)]
for i in range(w):
v = ""
b = 0
for j in range(h):
v += s[j][i]
for j, k in enumerate(v):
if k == "#":
b = 0
c[i][j] == 0
else:
b += 1
c[i][j] = b
mx = 0
for j in range(h - 1, -1, -1):
if c[i][j] == 0:
mx = 0
continue
else:
mx = max(c[i][j], mx)
c[i][j] = mx
wk = 0
ans = 0
for i in range(h):
for j in range(w):
wk = a[i][j] + c[j][i] - 1
ans = max(ans, wk)
print(ans)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s093833705 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def stairs(n):
if n <= 0:
return 1
comb = 0
for i in range(int(n / 2) + 1):
comb += combinations_count(n - i, i)
return comb
def main():
N, M = map(int, input().split(" "))
broken_l = []
for _ in range(M):
broken_l.append(int(input()))
broken_l.append(-1)
broken_l.append(N + 1)
broken_l.sort()
ans = 1
for i in range(len(broken_l) - 1):
step = broken_l[i + 1] - broken_l[i]
if step == 1 and broken_l[i + 1] != 1:
print(0)
exit(0)
else:
ans *= stairs(step - 2)
ans = ans % (10**9 + 7)
print(ans)
if __name__ == "__main__":
main()
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s578000506 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | H, W = map(int, input().split())
List = [input() for i in range(H)]
A = [[1] * (W) for i in range(H)]
B = [[1] * (H) for i in range(W)]
for i in range(H):
k = 0
a = 0
while k < W:
if List[i][k] == ".":
a += 1
k = k + 1
else:
for j in range(a):
A[i][k - j - 1] = a
A[i][k] = a
a = 0
k = k + 1
for j in range(a):
A[i][k - j - 1] = a
for i in range(W):
k = 0
a = 0
while k < H:
if List[k][i] == ".":
a += 1
k = k + 1
else:
for j in range(a):
B[i][k - j - 1] = a
B[i][k] = 0
a = 0
k = k + 1
for j in range(a):
B[i][k - j - 1] = a
max = 0
for i in range(H):
for j in range(W):
if max < A[i][j] + B[j][i]:
max = A[i][j] + B[j][i]
print(max - 1)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s278279329 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | d12 = int(input())
d13 = int(input())
d23 = int(input())
dt1 = d12 + d23
dt2 = d23 + d13
dt3 = d13 + d12
if dt1 < dt2 and dt1 < dt3:
print(dt1)
elif dt2 < dt1 and dt2 < dt3:
print(dt2)
else:
print(dt3)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s099961289 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | L = input()
intL = int(L)
L10 = int(L, 2)
sum_ = 0
for a in range(L10 + 1):
for b in range(L10 + 1):
if ((a + b) <= L10) and ((a + b) == (a ^ b)):
sum_ += 1
print(sum_ % (10**9 + 7))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s079306655 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | H, W = list(map(int, input().split()))
M = [["." for w in range(W)] for h in range(H)]
for h in range(0, H):
M[h] = list(input())
Yoko = [[0 for w in range(W)] for h in range(H)]
Tate = [[0 for w in range(W)] for h in range(H)]
for h in range(0, H):
for w in range(0, W):
if M[h][w] != "#":
if w >= 0 and M[h][w - 1] != "#":
Yoko[h][w] = Yoko[h][w - 1]
else:
c = 0
for d in range(w, W):
if M[h][d] == "#":
break
c += 1
Yoko[h][w] = c
for w in range(0, W):
for h in range(0, H):
if M[h][w] != "#":
if h >= 0 and Tate[h - 1][w] > 0:
Tate[h][w] = Tate[h - 1][w]
else:
c = 0
for d in range(h, H):
if M[d][w] == "#":
break
c += 1
Tate[h][w] = c
mx = 0
for w in range(0, W):
for h in range(0, H):
if M[h][w] != "#":
c = Yoko[h][w] + Tate[h][w] - 1
if c > mx:
mx = c
print(mx)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s669343693 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | mod = 10**9 + 7
def f(a, r):
s = [[0, 0], [0, 0]]
s[0][0] = (a[0][0] * r[0][0] + a[0][1] * r[1][0]) % mod
s[0][1] = (a[0][0] * r[0][1] + a[0][1] * r[1][1]) % mod
s[1][0] = (a[1][0] * r[0][0] + a[1][1] * r[1][0]) % mod
s[1][1] = (a[1][0] * r[0][1] + a[1][1] * r[1][1]) % mod
return s
b = [[1, 1], [1, 0]]
k = [b]
for i in range(20):
k.append(f(k[-1], k[-1]))
n, m = map(int, input().split())
t = 0
ans = 1
for i in range(m):
a = int(input())
if t == a:
print(0)
break
else:
s = bin(a - 1 - t)[2:]
s = "0" * (21 - len(s)) + s
s = s[::-1]
p = [[1, 0], [0, 1]]
for j in range(21):
if s[j] == "1":
p = f(p, k[j])
ans = (ans * p[0][0]) % mod
t = a + 1
if i == m - 1:
s = bin(n - t)[2:]
s = "0" * (21 - len(s)) + s
s = s[::-1]
p = [[1, 0], [0, 1]]
for j in range(21):
if s[j] == "1":
p = f(p, k[j])
ans = (ans * p[0][0]) % mod
else:
print(ans)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s948656426 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | H, W = map(int, input().split())
S = []
for i in range(H):
S.append(list(input()))
d = [[[0, 0, 0, 0] for x in range(W)] for y in range(H)]
answer = 0
for i in range(H):
for j in range(W):
tmp = [0, 0, 0, 0]
if S[i][j] == "#":
continue
# 上
org_i = i
while org_i - 1 >= 0:
org_i -= 1
if S[org_i][j] == "#":
break
else:
tmp[0] += 1
c = d[org_i][j][0]
if c > 0:
tmp[0] += c
break
d[i][j][0] = tmp[0]
# 下
org_i = i
while org_i + 1 < H:
org_i += 1
if S[org_i][j] == "#":
break
else:
tmp[1] += 1
c = d[org_i][j][1]
if c > 0:
tmp[1] += c
break
d[i][j][1] = tmp[1]
# 右
org_j = j
while org_j - 1 >= 0:
org_j -= 1
if S[i][org_j] == "#":
break
else:
tmp[2] += 1
c = d[i][org_j][2]
if c > 0:
tmp[2] += c
break
d[i][j][2] = tmp[2]
# 左
org_j = j
while org_j + 1 < W:
org_j += 1
if S[i][org_j] == "#":
break
else:
tmp[3] += 1
c = d[i][org_j][3]
if c > 0:
tmp[3] += c
break
d[i][j][3] = tmp[3]
m = sum(d[i][j]) + 1
if m > answer:
answer = m
print(answer)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s494549309 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | # コピーです
print(sum(sorted(map(int, input().split())))[:2])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s477789500 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | l = sorted([int(x) for x in input().split()])
print(sum(l[1:]))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s301474003 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | S = [int(x) for x in input().split()]
print(sum(S) - min(S))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s603964913 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | times = list(map(int, input().split()))
print(sum(times) - min(times))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s811869768 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | i = list(map(int, input().split()))
print(i)
i.sort()
print(i[0] + i[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s048371807 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | print(sum(sorted(list(map(int, input().split())))[:2]))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s740282101 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | r = sorted(list(map(int, input().split())))
print(r[0] + r[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s486198062 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | s, t, u = sorted(map(int, input().split()))
print(s + t)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s052150341 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | d = [int(i) for i in input().split()]
print(sum(d) - max(d))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s172497745 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | P, Q, R = sorted(map(int, input().split()))
print(P + Q)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s365199846 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | p, q, r = sorted(map(int, input().split()))
print(p + q)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s573699857 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | p = sorted(map(int, input().split()))
p.pop()
print(sum(p))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s150624722 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | A = list(map(int, input().split())).sort()
print(sum[:2])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s927563430 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | print("test")
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s846549106 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | list_ = sorted(list(map(int, input().split())))
print(list_[0] + list_[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s434021721 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | n = input().split()
a = int(n[0])
b = int(n[1])
c = int(n[2])
n = max(a, b, c)
print(a + b + c - n)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s944997297 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | P, Q, R = map(int, input().split(" "))
min_list = [P + Q, R + Q, P + R]
print(min(min_list))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s881759088 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | F, S, T = map(int, input().split())
FS = F + S
ST = S + T
TF = T + F
L = [FS, ST, TF]
print(min(L))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s744475835 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | n = list((map(int, input().split())))
n.sort()
print("{}".format(n[0] + n[1]))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s282127879 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | air = list(map(int, input().split()))
air = sorted(air)
print(air[0] + air[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s719113332 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | s = input().split()
ld = sorted(s, reverse=False)[:2]
print(ld)
sum(int(i) for i in ld)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s535192843 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | list = list(map(int, input().split()))
print(list)
list.sort()
print(list[0] + list[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s323793672 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | listA = list(map(int, input().split()))
listA.sort
print(listA[0] + listA[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s834285076 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | k = list(map(int, input().split().strip()))
kk = max(k)
k.remove(kk)
print(sum(k))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s578253826 | Wrong Answer | p03011 | Input is given from Standard Input in the following format:
P Q R | array = list(map(int, input().split()))
array.sort
print(sum(array[0:2]))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s158641899 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | a, b, c = input().split(",")
mylist = [int(a), int(b), int(c)]
mylist.sort()
print(sum(mylist[0:2]))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s467253363 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | valores = [int(input()), int(input()), int(input())]
valores.remove(max(valores))
print(valores[0] + valores[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s486900185 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | time = list(int(input()) for i in range(3))
time.remove(max(time))
print(sum(time))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s257552765 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | numerosSTR = input().split(" ")
for i in numerosSTR:
a = int(numerosSTR[0])
b = int(numerosSTR[1])
c = int(numerosSTR[2])
minimos = [a, b, c]
k = min(minimos)
minimos.pop(minimos.index(k))
print(k + min(minimos))
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s269025277 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | lst = list(map(int, input().split()))
min1 = min(lst)
lst.remove(min1)
min2 = min(lst)
lst.remove(min2)
print(min1 + min2)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s356837066 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | # A問題
time_list = input().split()
time_list = [int(i) for i in time_list]
time_list.sort()
print(time_list[0] + time_list[1])
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s854396604 | Accepted | p03011 | Input is given from Standard Input in the following format:
P Q R | l = list(map(int, input().split()))
w = l
res = 200
for i in range(len(l)):
for j in range(len(l)):
if l[i] + l[j] < res and i != j:
res = l[i] + l[j]
print(res)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the minimum possible sum of the flight times.
* * * | s979082681 | Runtime Error | p03011 | Input is given from Standard Input in the following format:
P Q R | def Fib(n):
s, t = 0, 1
if n == 1:
return s
elif n == 2:
return t
else:
for i in range(n - 2):
s, t = t, s + t
return t
def FIB(q):
return Fib(q + 1)
n, m = map(int, input().split())
A = []
add = 1
ex = 0
y = 0
for _ in range(m):
a = int(input())
A.append(a)
for i in range(1, n + 1):
if A.count(i) == 1 and A.count(i + 1) == 1:
ex += 1
else:
ex += 0
if ex >= 1:
print(0)
else:
if A[0] == 1:
if m == 1:
add *= FIB(n - 1)
else:
for j in range(0, m - 1):
y = A[j + 1] - A[j] - 1
add *= FIB(y)
add *= FIB(n - A[m - 1])
else:
if m == 1:
z = 0
for l in range(1, A[0]):
z += FIB(l)
add *= z * (FIB(n - A[0]))
else:
c = 0
for u in range(1, A[0]):
c += FIB(u)
add *= c
for k in range(0, m - 1):
y = A[k + 1] - A[k] - 1
add *= FIB(y)
add *= FIB(n - A[m - 1])
print(add % 1000000007)
| Statement
There are three airports A, B and C, and flights between each pair of airports
in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight
between airports B and C takes Q hours, and a one-way flight between airports
C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport
and then fly to the other airport.
What is the minimum possible sum of the flight times? | [{"input": "1 3 4", "output": "4\n \n\n * The sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n * The sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n * The sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n * The sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n * The sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n * The sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\n* * *"}, {"input": "3 2 3", "output": "5"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s330068647 | Accepted | p03338 | Input is given from Standard Input in the following format:
N
S | def examB():
N = I()
S = SI()
cur = 0
for i in range(N - 1):
d1 = set()
d2 = set()
for j in S[:i]:
d1.add(j)
for j in S[i:]:
d2.add(j)
curS = d1 & d2
cur = max(cur, len(curS))
print(cur)
import sys, copy, bisect, itertools, heapq, math
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque
def I():
return int(sys.stdin.readline())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LSI():
return list(map(str, sys.stdin.readline().split()))
def LS():
return sys.stdin.readline().split()
def SI():
return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float("inf")
examB()
| Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s824017751 | Accepted | p03338 | Input is given from Standard Input in the following format:
N
S | N, S = int(input()), input()
print(max(len(set(S[:i]) & set(S[i:])) for i in range(N)))
| Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s339941881 | Runtime Error | p03338 | Input is given from Standard Input in the following format:
N
S | # -*- coding: utf-8 -*-
n = int(input())
s = input()
async = 0
for i in range(1, n):
a = set(s[:i])
b = set(s[i:])
c = a & b
if len(c) > ans:
ans = len(c)
print(ans)
| Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s491204124 | Accepted | p03338 | Input is given from Standard Input in the following format:
N
S | a = int(input())
b = list(input())
c = []
h = []
for k in range(0, a - 1):
d = []
c.append(b[k])
for i in range(k + 1, a):
d.append(b[i])
# print(c)
# print(d)
e = []
for i in c:
if i not in e:
e.append(i)
# print(e)
f = []
for i in d:
if i not in f:
f.append(i)
# print(f)
g = 0
for l in range(len(e)):
for i in range(len(f)):
if e[l] == f[i]:
g = g + 1
h.append(g)
# print(h)
print(max(h))
| Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s048336507 | Runtime Error | p03338 | Input is given from Standard Input in the following format:
N
S | N=int(input())
S=input()
maxa=-10
for i in range(N-1):
a=set(L[:i+1])
b=set([i+1:])
maxa=max(maxa,len(a&b))
print(maxa) | Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s630081958 | Accepted | p03338 | Input is given from Standard Input in the following format:
N
S | N = input()
S = list(input())
max_ = 0
alphabets = [chr(i) for i in range(97, 97 + 26)]
for i in range(1, len(S) - 1):
x = S[:i]
y = S[i:]
match = 0
for a in alphabets:
if a in x and a in y:
match += 1
if match > max_:
max_ = match
print(max_)
| Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s663116272 | Wrong Answer | p03338 | Input is given from Standard Input in the following format:
N
S | N = int(input())
S = input()
for i in range(1, N + 1):
A = []
B = []
C = []
F = []
E = S[0:i]
for m in E:
if m not in A:
A.append(m)
elif m not in B:
B.append(m)
else:
C.append(m)
na = len(B)
F.append(na)
g = max(F)
print(g)
| Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Print the largest possible number of different letters contained in both X and
Y.
* * * | s999725133 | Runtime Error | p03338 | Input is given from Standard Input in the following format:
N
S | N = int(input())
S = input()
result = 0
for i in range(1,N):
tmp = len(set(S[:i] & set(S[i:]))
if result < tmp:
result = tmp
print(result)
| Statement
You are given a string S of length N consisting of lowercase English letters.
We will cut this string at one position into two strings X and Y. Here, we
would like to maximize the number of different letters contained in both X and
Y. Find the largest possible number of different letters contained in both X
and Y when we cut the string at the optimal position. | [{"input": "6\n aabbca", "output": "2\n \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n aaaaaaaaaa", "output": "1\n \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.