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 minimum total cost required to complete all the task.
* * * | s442050583 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def f(m, input):
r = 0
for i in input:
r += m % i
return r
N = map(int, input())
a_n = list(map(int, input().split(" ")))
a_n = sorted(a_n)
max = 0
for x in a_n:
max += x
# result = []
# for m in range(max):
# out = f(m, a_n)
# result.append(out)
# re = sorted(result)
# print(re[-1])
# print(max) #994 518 941 851 647 2 581 -> 4534
print(max - len(a_n))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s912047284 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | s = "11 5 5"
list = list(map(int, input().split()))
a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
l = a+b
m = b + c
n = a+c
if (l < m):
if (l < n)
print(l)
else :
print(n)
else :
if (m < n)
print(m)
else :
print(n)
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s271030294 | Wrong Answer | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | L = [int(i) for i in input().split()]
S = [
L[1] + abs(L[2] - L[1]),
L[2] + abs(L[2] - L[1]),
L[2] + abs(L[2] - L[0]),
L[0] + abs(L[2] - L[0]),
L[0] + abs(L[0] - L[1]),
L[1] + abs(L[0] - L[1]),
]
print(min(S))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s184949811 | Wrong Answer | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | A1, A2, A3 = map(int, input().split())
if A1 > A2 > A3:
print(A1 - A3)
elif A3 > A2 > A1:
print(A3 - A1)
elif A2 > A1 > A3:
print(A2 - A3)
elif A3 > A1 > A2:
print(A3 - A2)
elif A2 > A3 > A1:
print(A2 - A1)
else:
print(A1 - A2)
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s830419236 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | t = list(map(int, input().split()))
print(max(t) - min(t))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s187672575 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | List = list(map(int, input().split()))
print(max(List) - min(List))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s214937638 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | lis = map(int, input().split())
print(max(lis) - min(lis))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s933331279 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | s=list(map(int,input())
s.sort()
print(s[2]-s[0])
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s594794464 | Wrong Answer | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | a = sorted(input().split())
print(-int(a[-1]) + int(a[0]))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s615675290 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | 参りました
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s261864056 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | A1, A2, A3 = map(int, input().split(" "))
diff12 = abs(A2 - A1)
diff13 = abs(A3 - A1)
diff23 = abs(A2 - A3)
print(min(diff12 + diff13, min(diff12 + diff23, diff13 + diff23)))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s973603789 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | l = [int(i) for i in input().split()]
ans = 0
for i in range(len(l) - 1):
if l[i+1] < l[i]:
tmp = l[i+1]
l[i+1] = l[i]
l[i] = tmp
for i in range(len(l) - 1):
ans += l[i+1] - l[i]
print(ans) | Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s666734778 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | def LI():
return [int(s) for s in input().split()]
A = LI()
A12 = abs(A[0] - A[1])
A23 = abs(A[1] - A[2])
A31 = abs(A[3] - A[1])
print(min(A12 + A23, A23 + A31, A31 + A12))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s432818274 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | n = input().split(" ")
a = abs((int(n[1])-int(n[0]))+abs((int(n[2])-int(n[1]))
b = abs((int(n[2])-int(n[0]))+abs((int(n[1])-int(n[2]))
c = abs((int(n[2])-int(n[1]))+abs((int(n[0])-int(n[2]))
d = abs((int(n[0])-int(n[1]))+abs((int(n[2])-int(n[0]))
e = abs((int(n[1])-int(n[2]))+abs((int(n[0])-int(n[1]))
f = abs((int(n[0])-int(n[2]))+abs((int(n[1])-int(n[0]))
w = min(a,b,c,d,e,f)
print(w) | Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s109180701 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | a, b, c = map(int, input().split())
if abs(a - b) < abs(a - c) and abs(a - b) < abs(b - c):
print(abs(a - b) + abs(b - c))
elif abs(a - c) < abs(a - b) and abs(a - c) < abs(b - c)
print(abs(a - c) + abs(b - c)
else:
print(abs(a - c) + abs(a - b))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s564993057 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | tasks=sorted(list(map(int,input().split()))
cost=0
for i in range(1,len(tasks)):
cost+=tasks[i]-tasks[i-1]
print(cost) | Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s148750949 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | cost_list=list(map(int,input().split())
cost_list.sort(reverse=True)
sum=0
for i in range(len(cost_list)-1):
sum+=(cost_list[i]-cost_list[i+1])
print(sum) | Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s549949281 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | lista = [int(i) for i in input().split()]
lista.sort()
print(abs(lista[0] - lista[1]) + abs(lista[2] - lista[1]))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s324945115 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | A1, A2, A3 = map(int, input().split())
a = abs(A2 - A1)
b = abs(A3 - A2)
c = abs(A1 - A3)
print(min(a + b, b + c, c + a))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s113434554 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | A, B, C = list(map(int, input().split()))
tmp = abs(A - B) + abs(B - C) + abs(C - A)
print(tmp - max(abs(A - B), abs(B - C), abs(C - A)))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s267788944 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | a, b, c = map(int, input().split())
a = abs(a - b), b = abs(b - c), c = abs(c - a)
print(a + b + c - max(a, b, c))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s208575907 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | a, b, c = sorted(list(map(int, input().split())))
print(b - a + c - b)
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s449945050 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | ar = list(map(int, input().split(" ")))
ar.sort()
print((ar[1] - ar[0]) + (ar[2] - ar[1]))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s045515445 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | nums = list(map(int, input().split()))
print(max(nums) - min(nums))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s775409789 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | num = sorted(list(map(int, input().split())))
print(num[2] - num[0])
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s782985237 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | A1, A2, A3 = tuple(map(int, input().split()))
print(max(A1, A2, A3) - min(A1, A2, A3))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s084767573 | Accepted | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | hoge = list(map(int, input().split()))
print(max(hoge) - min(hoge))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s885230327 | Runtime Error | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | A = [int(x) for x in input()split()]
A.sort()
print(A[2] - A[0]) | Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s304540881 | Wrong Answer | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | task = input().split()
task.sort()
score = int(task[2]) - int(task[0])
print(score)
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the minimum total cost required to complete all the task.
* * * | s462044983 | Wrong Answer | p03292 | Input is given from Standard Input in the following format:
A_1 A_2 A_3 | A, B, C = (int(i) for i in input().split())
print(min((abs(B - A) + abs(C - B)), (abs(C - A) + abs(B - C))))
| Statement
You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at
cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task. | [{"input": "1 6 3", "output": "5\n \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n * Complete the first task at cost 0.\n * Complete the third task at cost 2.\n * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n \n\n* * *"}, {"input": "100 100 100", "output": "0"}] |
Print the answer in N lines. In the i-th line, print the color of vertex i
after the Q operations.
* * * | s935140979 | Runtime Error | p03768 | Input is given from Standard Input in the following format:
N M
a_1 b_1
:
a_{M} b_{M}
Q
v_1 d_1 c_1
:
v_{Q} d_{Q} c_{Q} | vertices, edges = (int(n) for n in input().split(" "))
edge = [[n, n] for n in range(vertices)]
for e in range(edges):
u, v = (int(n) - 1 for n in input().split(" "))
edge.append([u, v])
color = [0 for n in range(vertices + 1)]
query = int(input())
dp = [[0 for n in range(11)] for m in range(vertices)]
for q in range(query):
e, d, col = (int(n) for n in input().split(" "))
dp[e - 1][d] = q + 1
color[q + 1] = col
for dep in range(10, 0, -1):
for u, v in edge:
dp[u][dep - 1] = max(dp[u][dep - 1], dp[v][dep], dp[u][dep])
dp[v][dep - 1] = max(dp[v][dep - 1], dp[u][dep], dp[v][dep])
for v in range(vertices):
print(color[dp[v][0]])
| Statement
Squid loves painting vertices in graphs.
There is a simple undirected graph consisting of N vertices numbered 1 through
N, and M edges. Initially, all the vertices are painted in color 0. The i-th
edge bidirectionally connects two vertices a_i and b_i. The length of every
edge is 1.
Squid performed Q operations on this graph. In the i-th operation, he repaints
all the vertices within a distance of d_i from vertex v_i, in color c_i.
Find the color of each vertex after the Q operations. | [{"input": "7 7\n 1 2\n 1 3\n 1 4\n 4 5\n 5 6\n 5 7\n 2 3\n 2\n 6 1 1\n 1 2 2", "output": "2\n 2\n 2\n 2\n 2\n 1\n 0\n \n\nInitially, each vertex is painted in color 0. In the first operation, vertices\n5 and 6 are repainted in color 1. In the second operation, vertices 1, 2, 3, 4\nand 5 are repainted in color 2.\n\n\n\n* * *"}, {"input": "14 10\n 1 4\n 5 7\n 7 11\n 4 10\n 14 7\n 14 3\n 6 14\n 8 11\n 5 13\n 8 3\n 8\n 8 6 2\n 9 7 85\n 6 9 3\n 6 7 5\n 10 3 1\n 12 9 4\n 9 6 6\n 8 2 3", "output": "1\n 0\n 3\n 1\n 5\n 5\n 3\n 3\n 6\n 1\n 3\n 4\n 5\n 3\n \n\nThe given graph may not be connected."}] |
Print the answer in N lines. In the i-th line, print the color of vertex i
after the Q operations.
* * * | s789222202 | Runtime Error | p03768 | Input is given from Standard Input in the following format:
N M
a_1 b_1
:
a_{M} b_{M}
Q
v_1 d_1 c_1
:
v_{Q} d_{Q} c_{Q} | N = int(input())
moti_list = []
for i in range(N):
moti_list.append(int(input()))
moti_list.sort(reverse=True)
tower = 1
for j in range(N - 1):
if moti_list[j] > moti_list[j + 1]:
tower += 1
print(tower)
| Statement
Squid loves painting vertices in graphs.
There is a simple undirected graph consisting of N vertices numbered 1 through
N, and M edges. Initially, all the vertices are painted in color 0. The i-th
edge bidirectionally connects two vertices a_i and b_i. The length of every
edge is 1.
Squid performed Q operations on this graph. In the i-th operation, he repaints
all the vertices within a distance of d_i from vertex v_i, in color c_i.
Find the color of each vertex after the Q operations. | [{"input": "7 7\n 1 2\n 1 3\n 1 4\n 4 5\n 5 6\n 5 7\n 2 3\n 2\n 6 1 1\n 1 2 2", "output": "2\n 2\n 2\n 2\n 2\n 1\n 0\n \n\nInitially, each vertex is painted in color 0. In the first operation, vertices\n5 and 6 are repainted in color 1. In the second operation, vertices 1, 2, 3, 4\nand 5 are repainted in color 2.\n\n\n\n* * *"}, {"input": "14 10\n 1 4\n 5 7\n 7 11\n 4 10\n 14 7\n 14 3\n 6 14\n 8 11\n 5 13\n 8 3\n 8\n 8 6 2\n 9 7 85\n 6 9 3\n 6 7 5\n 10 3 1\n 12 9 4\n 9 6 6\n 8 2 3", "output": "1\n 0\n 3\n 1\n 5\n 5\n 3\n 3\n 6\n 1\n 3\n 4\n 5\n 3\n \n\nThe given graph may not be connected."}] |
Print the answer in N lines. In the i-th line, print the color of vertex i
after the Q operations.
* * * | s140751034 | Runtime Error | p03768 | Input is given from Standard Input in the following format:
N M
a_1 b_1
:
a_{M} b_{M}
Q
v_1 d_1 c_1
:
v_{Q} d_{Q} c_{Q} | n, m = map(int, input().split())
g = {}
used = {i:[False for _ in range(11)] for i in range(n)}
color = [0 for _ in range(n)]
for _ in range(m):
u, v = map(int, input().split())
u-=1
v-=1
if u not in g:
g[u] = []
if v not in g:
g[v] = []
g[u].append(v)
g[v].append(u)
q = int(input())
Q = []
for _ in range(q):
node, dis, col = map(int, input().split())
Q.append([node-1, dis, col])
Q = Q[::-1]
def bfs(now, dist, col):
if dist < 0:
return
if used[now][dist]:
return
used[now][dist] = True
if not color[now]:
color[now] = col
if now in g:
for x in g[now]:
bfs(x, dist - 1, col)
for node, dis, col in Q:
bfs(node, dis, col)
for x in color:
print(x) | Statement
Squid loves painting vertices in graphs.
There is a simple undirected graph consisting of N vertices numbered 1 through
N, and M edges. Initially, all the vertices are painted in color 0. The i-th
edge bidirectionally connects two vertices a_i and b_i. The length of every
edge is 1.
Squid performed Q operations on this graph. In the i-th operation, he repaints
all the vertices within a distance of d_i from vertex v_i, in color c_i.
Find the color of each vertex after the Q operations. | [{"input": "7 7\n 1 2\n 1 3\n 1 4\n 4 5\n 5 6\n 5 7\n 2 3\n 2\n 6 1 1\n 1 2 2", "output": "2\n 2\n 2\n 2\n 2\n 1\n 0\n \n\nInitially, each vertex is painted in color 0. In the first operation, vertices\n5 and 6 are repainted in color 1. In the second operation, vertices 1, 2, 3, 4\nand 5 are repainted in color 2.\n\n\n\n* * *"}, {"input": "14 10\n 1 4\n 5 7\n 7 11\n 4 10\n 14 7\n 14 3\n 6 14\n 8 11\n 5 13\n 8 3\n 8\n 8 6 2\n 9 7 85\n 6 9 3\n 6 7 5\n 10 3 1\n 12 9 4\n 9 6 6\n 8 2 3", "output": "1\n 0\n 3\n 1\n 5\n 5\n 3\n 3\n 6\n 1\n 3\n 4\n 5\n 3\n \n\nThe given graph may not be connected."}] |
Print the answer in N lines. In the i-th line, print the color of vertex i
after the Q operations.
* * * | s683429608 | Runtime Error | p03768 | Input is given from Standard Input in the following format:
N M
a_1 b_1
:
a_{M} b_{M}
Q
v_1 d_1 c_1
:
v_{Q} d_{Q} c_{Q} | for t in range(1):
graph = {}
colors = {}
n, m = list(map(int, input().split()))
for i in range(m):
a, b = list(map(int, input().split()))
if a not in graph:
graph[a] = [b]
else:
graph[a].append(b)
if b not in graph:
graph[b] = [a]
else:
graph[b].append(a) # Generating the graph as a dictionary.
colors[a] = 0
colors[b] = 0 # Generating a colors dictionary to record color of each vertex.
for q in range(int(input())):
v, d, c = list(map(int, input().split()))
first, sec = [v], []
colors[v] = c
for level in range(d):
for i in first:
for j in graph[i]:
sec.append(j)
colors[j] = c
first, sec = (
sec,
[],
) # Loop to color all vertices within d distance of given vertex v with color c.
for i in range(1, n + 1):
print(colors[i]) # your code goes here
| Statement
Squid loves painting vertices in graphs.
There is a simple undirected graph consisting of N vertices numbered 1 through
N, and M edges. Initially, all the vertices are painted in color 0. The i-th
edge bidirectionally connects two vertices a_i and b_i. The length of every
edge is 1.
Squid performed Q operations on this graph. In the i-th operation, he repaints
all the vertices within a distance of d_i from vertex v_i, in color c_i.
Find the color of each vertex after the Q operations. | [{"input": "7 7\n 1 2\n 1 3\n 1 4\n 4 5\n 5 6\n 5 7\n 2 3\n 2\n 6 1 1\n 1 2 2", "output": "2\n 2\n 2\n 2\n 2\n 1\n 0\n \n\nInitially, each vertex is painted in color 0. In the first operation, vertices\n5 and 6 are repainted in color 1. In the second operation, vertices 1, 2, 3, 4\nand 5 are repainted in color 2.\n\n\n\n* * *"}, {"input": "14 10\n 1 4\n 5 7\n 7 11\n 4 10\n 14 7\n 14 3\n 6 14\n 8 11\n 5 13\n 8 3\n 8\n 8 6 2\n 9 7 85\n 6 9 3\n 6 7 5\n 10 3 1\n 12 9 4\n 9 6 6\n 8 2 3", "output": "1\n 0\n 3\n 1\n 5\n 5\n 3\n 3\n 6\n 1\n 3\n 4\n 5\n 3\n \n\nThe given graph may not be connected."}] |
Print the lexicographically smallest string of length K that Iroha can
produce.
* * * | s482614775 | Wrong Answer | p04042 | The input is given from Standard Input in the following format:
N K
s_1
s_2
:
s_N | def main():
n, k = map(int, input().split())
s = []
lens = {}
for i in range(n):
s.append(input())
lens[i] = len(s[i])
dp = [""] + ["{"] * k
for i in range(1, k + 1):
for index, j in enumerate(s):
l = lens[index]
if l <= i:
dp[i] = sorted([dp[i], dp[i - l] + j])[0]
print(dp[-1])
if __name__ == "__main__":
main()
| Statement
Iroha has a sequence of N strings s_1, s_2, ..., s_N.
She will choose some (possibly all) strings from the sequence, then
concatenate those strings retaining the relative order, to produce a long
string.
Among all strings of length K that she can produce in this way, find the
lexicographically smallest one. | [{"input": "3 7\n at\n coder\n codar", "output": "atcodar\n \n\n`at` and `codar` should be chosen.\n\n* * *"}, {"input": "3 7\n coder\n codar\n at", "output": "codarat\n \n\n`codar` and `at` should be chosen.\n\n* * *"}, {"input": "4 13\n kyuri\n namida\n zzzzzzz\n aaaaaa", "output": "namidazzzzzzz\n \n\n`namida` and `zzzzzzz` should be chosen."}] |
Print the lexicographically smallest string of length K that Iroha can
produce.
* * * | s346551310 | Wrong Answer | p04042 | The input is given from Standard Input in the following format:
N K
s_1
s_2
:
s_N | N, K = map(int, input().strip().split())
s = []
kazu = []
for i in range(N):
s.append(input())
kazu.append(len(s[i]))
for z in range(N):
for x in range(N):
if z == x:
break
if kazu[x] + kazu[z] == K:
print(s[x] + s[z])
exit()
| Statement
Iroha has a sequence of N strings s_1, s_2, ..., s_N.
She will choose some (possibly all) strings from the sequence, then
concatenate those strings retaining the relative order, to produce a long
string.
Among all strings of length K that she can produce in this way, find the
lexicographically smallest one. | [{"input": "3 7\n at\n coder\n codar", "output": "atcodar\n \n\n`at` and `codar` should be chosen.\n\n* * *"}, {"input": "3 7\n coder\n codar\n at", "output": "codarat\n \n\n`codar` and `at` should be chosen.\n\n* * *"}, {"input": "4 13\n kyuri\n namida\n zzzzzzz\n aaaaaa", "output": "namidazzzzzzz\n \n\n`namida` and `zzzzzzz` should be chosen."}] |
Print the lexicographically smallest string of length K that Iroha can
produce.
* * * | s332229172 | Wrong Answer | p04042 | The input is given from Standard Input in the following format:
N K
s_1
s_2
:
s_N | N, K = [int(x) for x in input().split()]
Kp1 = K + 1
ss = [input() for _ in range(N)]
ds = ["~" * n for n in range(Kp1)]
for s in ss:
len_s = len(s)
for i in range(Kp1 - len_s):
t = ds[i] + s
if t < ds[i + len_s]:
ds[i + len_s] = t
print(ds[K])
| Statement
Iroha has a sequence of N strings s_1, s_2, ..., s_N.
She will choose some (possibly all) strings from the sequence, then
concatenate those strings retaining the relative order, to produce a long
string.
Among all strings of length K that she can produce in this way, find the
lexicographically smallest one. | [{"input": "3 7\n at\n coder\n codar", "output": "atcodar\n \n\n`at` and `codar` should be chosen.\n\n* * *"}, {"input": "3 7\n coder\n codar\n at", "output": "codarat\n \n\n`codar` and `at` should be chosen.\n\n* * *"}, {"input": "4 13\n kyuri\n namida\n zzzzzzz\n aaaaaa", "output": "namidazzzzzzz\n \n\n`namida` and `zzzzzzz` should be chosen."}] |
Print the number of the connected components in the graph constructed by
Takahashi.
* * * | s999668468 | Accepted | p03787 | The input is given from Standard Input in the following format:
N M
u_1 v_1
u_2 v_2
:
u_M v_M | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
edge = [[] for i in range(N)]
for i in range(M):
u, v = map(int, input().split())
edge[u - 1].append(v - 1)
edge[v - 1].append(u - 1)
def is_bipartgraph():
color = [0] * N
used = [False] * N
b = 0
nb = 0
for i in range(N):
if not used[i]:
flag = True
stack = [(i, 1)]
black = 0
white = 0
while stack:
v, c = stack.pop()
if not used[v]:
color[v] = c
black += c == 1
white += c == -1
used[v] = True
for nv in edge[v]:
if color[nv] == color[v]:
flag = False
elif color[nv] == 0:
stack.append((nv, -c))
b += flag
nb += not flag
return (b, nb)
a = 0
for i in range(N):
if not edge[i]:
a += 1
b, nb = is_bipartgraph()
rest = N - (b + nb)
b -= a
print(a * N + nb * (a + nb + b) + b * (a + nb + 2 * b) + rest * a)
| Statement
Takahashi has received an undirected graph with N vertices, numbered 1, 2,
..., N. The edges in this graph are represented by (u_i, v_i). There are no
self-loops and multiple edges in this graph.
Based on this graph, Takahashi is now constructing a new graph with N^2
vertices, where each vertex is labeled with a pair of integers (a, b) (1 \leq
a \leq N, 1 \leq b \leq N). The edges in this new graph are generated by the
following rule:
* Span an edge between vertices (a, b) and (a', b') if and only if both of the following two edges exist in the original graph: an edge between vertices a and a', and an edge between vertices b and b'.
How many connected components are there in this new graph? | [{"input": "3 1\n 1 2", "output": "7\n \n\nThe graph constructed by Takahashi is as follows.\n\n\n\n* * *"}, {"input": "7 5\n 1 2\n 3 4\n 3 5\n 4 5\n 2 6", "output": "18"}] |
Print the number of the connected components in the graph constructed by
Takahashi.
* * * | s480370953 | Runtime Error | p03787 | The input is given from Standard Input in the following format:
N M
u_1 v_1
u_2 v_2
:
u_M v_M | N, M = map(int, input().split())
class UF:
def __init__(self):
self.live = [True] * (N**2)
def _connect(self, i, j):
if self.live[i]:
self.live[i] = False
else:
self.live[j] = False
def connect(self, e1, e2):
a1, a2 = e1
b1, b2 = e2
self._connect(a1 * N + b1, a2 * N + b2)
self._connect(a1 * N + b2, a2 * N + b1)
def count(self):
return sum(self.live)
uf = UF()
edges = []
for i in range(M):
new_edge = list(map(int, input().split()))
new_edge[0] -= 1
new_edge[1] -= 1
edges.append(new_edge)
for edge in edges:
uf.connect(new_edge, edge)
print(uf.count())
print(uf.live)
| Statement
Takahashi has received an undirected graph with N vertices, numbered 1, 2,
..., N. The edges in this graph are represented by (u_i, v_i). There are no
self-loops and multiple edges in this graph.
Based on this graph, Takahashi is now constructing a new graph with N^2
vertices, where each vertex is labeled with a pair of integers (a, b) (1 \leq
a \leq N, 1 \leq b \leq N). The edges in this new graph are generated by the
following rule:
* Span an edge between vertices (a, b) and (a', b') if and only if both of the following two edges exist in the original graph: an edge between vertices a and a', and an edge between vertices b and b'.
How many connected components are there in this new graph? | [{"input": "3 1\n 1 2", "output": "7\n \n\nThe graph constructed by Takahashi is as follows.\n\n\n\n* * *"}, {"input": "7 5\n 1 2\n 3 4\n 3 5\n 4 5\n 2 6", "output": "18"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s013727943 | Wrong Answer | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | num = 10
top = 3
mountains = [input() for i in range(num)]
mountains = sorted(mountains, reverse=True)
for i in range(top):
print(mountains[i])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s747374692 | Runtime Error | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | a = []
b = a.sort()
c = b.reverse()
print(c[0:2])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s334380920 | Runtime Error | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | a = input(">>")
a = a.split()
x = str(int(a[0]) + int(a[1]))
print(len(x))
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s591626374 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | max_1 = 0
max_2 = 0
max_3 = 0
for i in range(10):
m = int(input())
if max_1 < m:
max_3 = max_2
max_2 = max_1
max_1 = m
elif max_2 < m:
max_3 = max_2
max_2 = m
elif max_3 < m:
max_3 = m
print(max_1)
print(max_2)
print(max_3)
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s102715109 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | mountains = [0 for i in range(10)]
for i in range(10):
mountains[i] = int(input())
highest1 = mountains[0]
if highest1 < mountains[1]:
highest2 = highest1
highest1 = mountains[1]
else:
highest2 = mountains[1]
if highest1 < mountains[2]:
highest2, highest3 = highest1, highest2
highest1 = mountains[2]
elif highest2 < mountains[2]:
highest3 = highest2
highest2 = mountains[2]
else:
highest3 = mountains[2]
for i in range(3, 10):
if highest1 < mountains[i]:
highest1, highest2, highest3 = mountains[i], highest1, highest2
elif highest2 < mountains[i]:
highest2, highest3 = mountains[i], highest2
elif highest3 < mountains[i]:
highest3 = mountains[i]
print(highest1)
print(highest2)
print(highest3)
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s436447587 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | a1 = int(input())
a2 = int(input())
a3 = int(input())
a4 = int(input())
a5 = int(input())
a6 = int(input())
a7 = int(input())
a8 = int(input())
a9 = int(input())
a10 = int(input())
s = []
s = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]
s.sort()
print(s[9])
print(s[8])
print(s[7])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s016107060 | Runtime Error | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | num = [int(input()) for i in range(10)]
num.sort(reverse=True)
for i in range[0:3]:
print(num[i])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s545818959 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | k = []
try:
while True:
k.append(int(input()))
except EOFError:
pass
k.sort()
print(k[-1])
print(k[-2])
print(k[-3])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s396705901 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | print(*sorted(int(input()) for _ in [0] * 10)[:6:-1], sep="\n")
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s371246087 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | list = [int(input()) for i in range(10)]
s = 0
t = 0
u = 0
for i in range(10):
if s < list[i]:
u = t
t = s
s = list[i]
elif t < list[i]:
u = t
t = list[i]
elif u < list[i]:
u = list[i]
print(s)
print(t)
print(u)
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s939426150 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | list1 = []
for i in range(1, 11):
list1.append(input())
for x in range(1, 11):
for y in range(0, 9):
if int(list1[y]) < int(list1[y + 1]):
temp = list1[y]
list1[y] = list1[y + 1]
list1[y + 1] = temp
print(list1[0])
print(list1[1])
print(list1[2])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s583194557 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | top_three = [0, 0, 0]
for i in range(10):
input_height = int(input())
if top_three[0] < input_height:
top_three[2] = top_three[1]
top_three[1] = top_three[0]
top_three[0] = input_height
elif top_three[1] < input_height:
top_three[2] = top_three[1]
top_three[1] = input_height
elif top_three[2] < input_height:
top_three[2] = input_height
print(top_three[0])
print(top_three[1])
print(top_three[2])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s575299306 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | L = []
for i in range(10):
a = int(input())
L.append(a)
i += 1
for k in range(9, 0, -1):
for l in range(k):
if L[l] > L[l + 1]:
L[l], L[l + 1] = L[l + 1], L[l]
l += 1
k += 1
for j in range(3):
print(L[-1])
L.remove(L[-1])
j += 1
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s939556560 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | li2 = sorted([int(input()) for i in range(10)], reverse=True)
print(li2[0])
print(li2[1])
print(li2[2])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s138148590 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | num = [0 for i in range(10)]
for i in range(10):
num[i] = int(input())
num.sort()
num.reverse()
print(num[0])
print(num[1])
print(num[2])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s300560716 | Wrong Answer | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | print("Hello,world!")
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s496336131 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | mountain = sorted([int(input()) for _ in range(10)], reverse=True)
ans = mountain[:3]
print("\n".join(map(str, ans)))
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s132547142 | Wrong Answer | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | ls = []
for i in range(0, 10):
ls.append(int(input()))
ls.sort()
print(ls[7])
print(ls[8])
print(ls[9])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s234931805 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | [print(e) for e in sorted([int(input()) for _ in range(10)], reverse=True)[0:3]]
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s303907758 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | [print(h) for h in sorted([int(input()) for i in range(10)], reverse=True)[:3]]
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s257016339 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | [print(i) for i in (sorted([int(input()) for _ in range(10)])[:6:-1])]
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s107544464 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | N = 10
i = 0
I = [int(input()) for _ in range(N)]
I.sort()
for i in range(3):
print(max(I))
I.pop()
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s214816276 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | mountain = [int(input()) for _ in range(10)]
mountain.sort()
for _ in -1, -2, -3:
print(mountain[_])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s420215856 | Wrong Answer | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | s = [int(input(x)) for x in range(10)]
print(sorted(s)[-1])
print(sorted(s)[-2])
print(sorted(s)[-3])
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s175895862 | Wrong Answer | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | x = int(input().rstrip())
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s104489502 | Wrong Answer | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | [
print(d)
for i, d in enumerate(sorted([i for i in input() for _ in range(10)], reverse=True))
if i < 3
]
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s535569308 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | [print(x) for x in sorted([int(input()) for i in range(10)])[-1:-4:-1]]
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s846843896 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | li = sorted([int(input()) for i in range(10)], reverse=True)
print("\n".join(map(str, li[:3])))
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
Height of the 1st mountain
Height of the 2nd mountain
Height of the 3rd mountain | s060497394 | Accepted | p00001 | Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
Height of mountain 10 | for a in sorted([int(input()) for _ in range(10)], reverse=True)[:3]:
print(a)
| List of Top 3 Hills
There is a data which provides heights (in meter) of mountains. The data is
only for ten mountains.
Write a program which prints heights of the top three mountains in descending
order. | [{"input": "1819\n 2003\n 876\n 2840\n 1723\n 1673\n 3776\n 2848\n 1592\n 922", "output": "3776\n 2848\n 2840"}, {"input": "100\n 200\n 300\n 400\n 500\n 600\n 700\n 800\n 900\n 900", "output": "900\n 900\n 800"}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s032440868 | Accepted | p02753 | Input is given from Standard Input in the following format:
S | print("No" if len(set(input())) == 1 else "Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s930668959 | Accepted | p02753 | Input is given from Standard Input in the following format:
S | print("Yes" if len(set(input())) == 2 else "No")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s944584228 | Accepted | p02753 | Input is given from Standard Input in the following format:
S | x = list(input())
print("Yes" if len(set(x)) == 2 else "No")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s227039236 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | print(("Yes", "No")[input() in "AAA" + "BBB"])
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s850132850 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | st = set([i for i in input()])
print("No") if len(st) == 0 else print("Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s679761201 | Runtime Error | p02753 | Input is given from Standard Input in the following format:
S | print(("Yes", "No")[input() in "AAA" or "BBB"])
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s714587460 | Runtime Error | p02753 | Input is given from Standard Input in the following format:
S | N, A, B = map(int, input().split())
C = N // (A + B)
D = N % (A + B)
print(C * A + min(D, A))
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s742767486 | Runtime Error | p02753 | Input is given from Standard Input in the following format:
S | n, a, b = [int(_) for _ in input().split()]
print((n // (a + b)) * a + min(n % (a + b), a))
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s608696097 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | A = list(input())
A.sort() # sortメソッドは破壊的
print("Yes" if A[1] != A[2] else "No")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s532616676 | Accepted | p02753 | Input is given from Standard Input in the following format:
S | M = input()
print("No" if M[0] == M[1] == M[2] else "Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s404698408 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | print("Yes" if input() in ("AAA", "BBB") else "No")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s756467332 | Runtime Error | p02753 | Input is given from Standard Input in the following format:
S | print(["Yes", "No"][input() == "BBB" or "AAA"])
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s688861324 | Runtime Error | p02753 | Input is given from Standard Input in the following format:
S | print("Yes" if all(input().count(c) > 0 for c in "AB") else "No")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s834865482 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | print("YNeos"[len(set(input())) > 1 :: 2])
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s169693666 | Runtime Error | p02753 | Input is given from Standard Input in the following format:
S | print("Yes" if "A" in input() and "B" in input() else "No")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s687156084 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | print(["Yes", "No"][input() == ("BBB" or "AAA")])
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s800352503 | Accepted | p02753 | Input is given from Standard Input in the following format:
S | str_ = input()
print("Yes") if "A" in str_ and "B" in str_ else print("No")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s849307776 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | user = str(input().upper())
for i in user:
if user.count(i) == 2:
pass
print("Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s771829988 | Accepted | p02753 | Input is given from Standard Input in the following format:
S | print("No" if len(set(list(input()))) == 1 else "Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s515748990 | Accepted | p02753 | Input is given from Standard Input in the following format:
S | print("YNeos"[input() in ["AAA", "BBB"] :: 2])
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s603497501 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | print("No" if input() == "BBB" else "Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s846797496 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | print("No" if len(set(input())) == 0 else "Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s603001205 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | print("YNeos"[len(set(input())) - 1 :: 2])
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s086227218 | Wrong Answer | p02753 | Input is given from Standard Input in the following format:
S | L = list(input())
print("No" if L.count("A") == 0 and L.count("B") == 0 else "Yes")
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there is a pair of stations that will be connected by a bus service, print
`Yes`; otherwise, print `No`.
* * * | s413968255 | Runtime Error | p02753 | Input is given from Standard Input in the following format:
S | n, A, B = map(int, input().split())
ans = n // (A + B) * A
# 余り
r = n % (A + B)
ans += min(ans, r)
print(ans)
| Statement
In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and
B. A string S of length 3 represents which company operates each station. If
S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates
Station i.
To improve the transportation condition, for each pair of a station operated
by Company A and one operated by Company B, there will be a bus service
connecting them.
Determine if there is a pair of stations that will be connected by a bus
service. | [{"input": "ABA", "output": "Yes\n \n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBA", "output": "Yes\n \n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and\n3, so print `Yes`.\n\n* * *"}, {"input": "BBB", "output": "No\n \n\nCompany B operates all the stations. Thus, there will be no bus service, so\nprint `No`."}] |
If there does not exist an integer sequence a that satisfies all the
conditions, print `No`. If there does exist such an sequence a, print `Yes` in
the first line, then print an instance of a in the second line, with spaces
inbetween.
* * * | s924245688 | Wrong Answer | p03841 | The input is given from Standard Input in the following format:
N
x_1 x_2 ... x_N | import sys
readline = sys.stdin.readline
def check(A, X):
N = len(A)
Ans = [None] * (N**2)
cnt = 0
po = 0
for i in range(N):
a, x = A[i], X[i]
a += 1
x -= 1
if Ans[x] is not None:
return False
cnt += a - 1
if cnt > x:
return False
Ans[x] = a
res = a - 1
while res:
if Ans[po] is None:
res -= 1
Ans[po] = a
po += 1
cnt = 0
po = N**2 - 1
for i in range(N - 1, -1, -1):
a, x = A[i], X[i]
a += 1
x -= 1
cnt += N - a
if N**2 - x < 1 + cnt:
return False
res = N - a
while res:
if Ans[po] is None:
res -= 1
Ans[po] = a
po -= 1
return Ans
N = int(readline())
X = list(map(int, readline().split()))
A = sorted(list(range(N)), key=lambda x: X[x])
X.sort()
Ans = check(A, X)
if Ans:
print("Yes")
print(*Ans)
else:
print("No")
| Statement
You are given an integer sequence x of length N. Determine if there exists an
integer sequence a that satisfies all of the following conditions, and if it
exists, construct an instance of a.
* a is N^2 in length, containing N copies of each of the integers 1, 2, ..., N.
* For each 1 ≤ i ≤ N, the i-th occurrence of the integer i from the left in a is the x_i-th element of a from the left. | [{"input": "3\n 1 5 9", "output": "Yes\n 1 1 1 2 2 2 3 3 3\n \n\nFor example, the second occurrence of the integer 2 from the left in a in the\noutput is the fifth element of a from the left. Similarly, the condition is\nsatisfied for the integers 1 and 3.\n\n* * *"}, {"input": "2\n 4 1", "output": "No"}] |
If there does not exist an integer sequence a that satisfies all the
conditions, print `No`. If there does exist such an sequence a, print `Yes` in
the first line, then print an instance of a in the second line, with spaces
inbetween.
* * * | s958301454 | Wrong Answer | p03841 | The input is given from Standard Input in the following format:
N
x_1 x_2 ... x_N | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import (
accumulate,
permutations,
combinations,
product,
combinations_with_replacement,
)
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a, b):
return (a + b - 1) // b
inf = float("inf")
mod = 10**9 + 7
def pprint(*A):
for a in A:
print(*a, sep="\n")
def INT_(n):
return int(n) - 1
def MI():
return map(int, input().split())
def MF():
return map(float, input().split())
def MI_():
return map(INT_, input().split())
def LI():
return list(MI())
def LI_():
return [int(x) - 1 for x in input().split()]
def LF():
return list(MF())
def LIN(n: int):
return [I() for _ in range(n)]
def LLIN(n: int):
return [LI() for _ in range(n)]
def LLIN_(n: int):
return [LI_() for _ in range(n)]
def LLI():
return [list(map(int, l.split())) for l in input()]
def I():
return int(input())
def F():
return float(input())
def ST():
return input().replace("\n", "")
def main():
N = I()
XI = [(x - 1, i) for i, x in enumerate(MI())]
XI.sort()
remain = [N - i - 1 for i in range(N)]
idx = 0
ans = [None] * (N * N)
ok = True
for x, i in XI:
for _ in range(i):
while idx < N * N and ans[idx] is not None:
idx += 1
if idx >= x:
ok = False
break
ans[idx] = i
idx += 1
ans[x] = i
# print(ans,ok)
for x, i in XI:
for _ in range(remain[i]):
while idx < N * N and ans[idx] is not None:
idx += 1
if idx < x:
ok = False
ans[idx] = i
idx += 1
# print(ans)
if not ok:
print("No")
return
print(*[a + 1 for a in ans])
if __name__ == "__main__":
main()
| Statement
You are given an integer sequence x of length N. Determine if there exists an
integer sequence a that satisfies all of the following conditions, and if it
exists, construct an instance of a.
* a is N^2 in length, containing N copies of each of the integers 1, 2, ..., N.
* For each 1 ≤ i ≤ N, the i-th occurrence of the integer i from the left in a is the x_i-th element of a from the left. | [{"input": "3\n 1 5 9", "output": "Yes\n 1 1 1 2 2 2 3 3 3\n \n\nFor example, the second occurrence of the integer 2 from the left in a in the\noutput is the fifth element of a from the left. Similarly, the condition is\nsatisfied for the integers 1 and 3.\n\n* * *"}, {"input": "2\n 4 1", "output": "No"}] |
If there does not exist an integer sequence a that satisfies all the
conditions, print `No`. If there does exist such an sequence a, print `Yes` in
the first line, then print an instance of a in the second line, with spaces
inbetween.
* * * | s927200009 | Runtime Error | p03841 | The input is given from Standard Input in the following format:
N
x_1 x_2 ... x_N | # AOJ DSL_2_A "Range Minimum Query"
# SegmantTreeの実装
# 初期化最大値
INF = (1 << 31) - 1
class SegmentTree:
def __init__(self, N):
self.N = 2 ** (N - 1).bit_length()
self.data = [[INF, -1] for _ in range(2 * self.N - 1)]
# k番目の値(0-indexed)をaに変更
def update(self, k, a):
self.data[k + self.N - 1] = [a, k]
k += self.N - 1
while k > 0:
k = (k - 1) // 2
if self.data[2 * k + 1][0] < self.data[2 * k + 2][0]:
self.data[k] = self.data[2 * k + 1][:]
else:
self.data[k] = self.data[2 * k + 2][:]
# [l, r)の最小値取得
# kがNodeの番号、対応する区間が[a, b)
def query_min(self, l, r):
L = l + self.N
R = r + self.N
s = [INF, -1]
while L < R:
if R & 1:
R -= 1
if s[0] > self.data[R - 1][0]:
s = self.data[R - 1]
if L & 1:
if s[0] > self.data[L - 1][0]:
s = self.data[L - 1]
L += 1
L >>= 1
R >>= 1
return s
import sys
input = sys.stdin.readline
from bisect import bisect_left
N = int(input())
X = list(map(int, input().split()))
sortedX = sorted(X)
decided = [-1] * (N**2 + 1)
for i, x in enumerate(X):
decided[x] = i + 1
marge = SegmentTree(N + 1)
remains = [0] * (N + 1)
alreadyUsed = [None] * (N + 1)
for i, x in enumerate(X):
i += 1
alreadyused = bisect_left(sortedX, x)
if i != 1:
marge.update(i, x - alreadyused - i)
alreadyUsed[i] = alreadyused
remains[i] = i - 1
def solve():
offset = 0
for n in range(1, N**2 + 1):
if decided[n] != -1:
decided_num = decided[n]
if remains[decided_num] > 0:
return False, None
remain = N - decided_num
if remain < 0:
return False, None
if remain == 0:
marge.update(decided_num, INF)
remains[decided_num] = 0
else:
marge_now = (
(N**2 - n) - (N - alreadyUsed[decided_num] - 1) - remain + offset
)
marge.update(decided_num, marge_now)
remains[decided_num] = remain
else:
marge_now, num = marge.query_min(0, N**2 + 1)
if marge_now - offset < 0 or marge_now == INF:
return False, None
remains[num] -= 1
if remains[num] == 0:
marge.update(num, INF)
else:
marge.update(num, marge_now + 1)
decided[n] = num
offset += 1
return True, decided[1:]
if __name__ == "__main__":
ok, ans = solve()
if ok:
print("Yes")
print(*ans)
else:
print("No")
| Statement
You are given an integer sequence x of length N. Determine if there exists an
integer sequence a that satisfies all of the following conditions, and if it
exists, construct an instance of a.
* a is N^2 in length, containing N copies of each of the integers 1, 2, ..., N.
* For each 1 ≤ i ≤ N, the i-th occurrence of the integer i from the left in a is the x_i-th element of a from the left. | [{"input": "3\n 1 5 9", "output": "Yes\n 1 1 1 2 2 2 3 3 3\n \n\nFor example, the second occurrence of the integer 2 from the left in a in the\noutput is the fifth element of a from the left. Similarly, the condition is\nsatisfied for the integers 1 and 3.\n\n* * *"}, {"input": "2\n 4 1", "output": "No"}] |
Print N lines. In the i-th line, print `0` if Vertex i is the root of the
original tree, and otherwise print the integer representing the parent of
Vertex i in the original tree.
Note that it can be shown that the original tree is uniquely determined.
* * * | s808411733 | Runtime Error | p03142 | Input is given from Standard Input in the following format:
N M
A_1 B_1
:
A_{N-1+M} B_{N-1+M} | 40 90 | Statement
There is a rooted tree (see Notes) with N vertices numbered 1 to N. Each of
the vertices, except the root, has a directed edge coming from its parent.
Note that the root may not be Vertex 1.
Takahashi has added M new directed edges to this graph. Each of these M edges,
u \rightarrow v, extends from some vertex u to its descendant v.
You are given the directed graph with N vertices and N-1+M edges after
Takahashi added edges. More specifically, you are given N-1+M pairs of
integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the
i-th edge extends from Vertex A_i to Vertex B_i.
Restore the original rooted tree. | [{"input": "3 1\n 1 2\n 1 3\n 2 3", "output": "0\n 1\n 2\n \n\nThe graph in this input is shown below:\n\n\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3\nto the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\n* * *"}, {"input": "6 3\n 2 1\n 2 3\n 4 1\n 4 2\n 6 1\n 2 6\n 4 6\n 6 5", "output": "6\n 4\n 2\n 0\n 6\n 2"}] |
Print N lines. In the i-th line, print `0` if Vertex i is the root of the
original tree, and otherwise print the integer representing the parent of
Vertex i in the original tree.
Note that it can be shown that the original tree is uniquely determined.
* * * | s003699481 | Wrong Answer | p03142 | Input is given from Standard Input in the following format:
N M
A_1 B_1
:
A_{N-1+M} B_{N-1+M} | import sys
| Statement
There is a rooted tree (see Notes) with N vertices numbered 1 to N. Each of
the vertices, except the root, has a directed edge coming from its parent.
Note that the root may not be Vertex 1.
Takahashi has added M new directed edges to this graph. Each of these M edges,
u \rightarrow v, extends from some vertex u to its descendant v.
You are given the directed graph with N vertices and N-1+M edges after
Takahashi added edges. More specifically, you are given N-1+M pairs of
integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the
i-th edge extends from Vertex A_i to Vertex B_i.
Restore the original rooted tree. | [{"input": "3 1\n 1 2\n 1 3\n 2 3", "output": "0\n 1\n 2\n \n\nThe graph in this input is shown below:\n\n\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3\nto the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\n* * *"}, {"input": "6 3\n 2 1\n 2 3\n 4 1\n 4 2\n 6 1\n 2 6\n 4 6\n 6 5", "output": "6\n 4\n 2\n 0\n 6\n 2"}] |
Print N lines. In the i-th line, print `0` if Vertex i is the root of the
original tree, and otherwise print the integer representing the parent of
Vertex i in the original tree.
Note that it can be shown that the original tree is uniquely determined.
* * * | s018739870 | Runtime Error | p03142 | Input is given from Standard Input in the following format:
N M
A_1 B_1
:
A_{N-1+M} B_{N-1+M} | giveup
| Statement
There is a rooted tree (see Notes) with N vertices numbered 1 to N. Each of
the vertices, except the root, has a directed edge coming from its parent.
Note that the root may not be Vertex 1.
Takahashi has added M new directed edges to this graph. Each of these M edges,
u \rightarrow v, extends from some vertex u to its descendant v.
You are given the directed graph with N vertices and N-1+M edges after
Takahashi added edges. More specifically, you are given N-1+M pairs of
integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the
i-th edge extends from Vertex A_i to Vertex B_i.
Restore the original rooted tree. | [{"input": "3 1\n 1 2\n 1 3\n 2 3", "output": "0\n 1\n 2\n \n\nThe graph in this input is shown below:\n\n\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3\nto the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\n* * *"}, {"input": "6 3\n 2 1\n 2 3\n 4 1\n 4 2\n 6 1\n 2 6\n 4 6\n 6 5", "output": "6\n 4\n 2\n 0\n 6\n 2"}] |
Print N lines. In the i-th line, print `0` if Vertex i is the root of the
original tree, and otherwise print the integer representing the parent of
Vertex i in the original tree.
Note that it can be shown that the original tree is uniquely determined.
* * * | s520375290 | Runtime Error | p03142 | Input is given from Standard Input in the following format:
N M
A_1 B_1
:
A_{N-1+M} B_{N-1+M} | def getN():
return int(input())
def getMN():
a = input().split()
b = [int(i) for i in a]
return b[0],b[1]
def getlist():
a = input().split()
b = [int(i) for i in a]
return b
from collections import deque
n, m = getMN()
parents = [[] for i in range(n+1)]
childs = [[] for i in range(n+1)]
k = m-1+n
for i in range(k):
p1,p2 = getMN()
parents[p2].append(p1)
childs[p1].append(p2)
dst = [0 for i in range(n+1)]
d = deque()
n_root = 0
for i, x in enumerate(parents[1:]):
if not x:
n_root = i+1
break
def bfs(n_cur):)
for c in childs[n_cur]:
d.append(c)
dst[c] = max(dst[c], dst[n_cur]+1)
while(d):
bfs(d.pop())
bfs(n_root)
for plist in parents[1:]:
if plist:
cur = -1
ans = plist[0]
for p in plist:
if dst[p] > cur:
cur = dst[p]
ans = p
print(ans)
else:
print(0)
| Statement
There is a rooted tree (see Notes) with N vertices numbered 1 to N. Each of
the vertices, except the root, has a directed edge coming from its parent.
Note that the root may not be Vertex 1.
Takahashi has added M new directed edges to this graph. Each of these M edges,
u \rightarrow v, extends from some vertex u to its descendant v.
You are given the directed graph with N vertices and N-1+M edges after
Takahashi added edges. More specifically, you are given N-1+M pairs of
integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the
i-th edge extends from Vertex A_i to Vertex B_i.
Restore the original rooted tree. | [{"input": "3 1\n 1 2\n 1 3\n 2 3", "output": "0\n 1\n 2\n \n\nThe graph in this input is shown below:\n\n\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3\nto the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\n* * *"}, {"input": "6 3\n 2 1\n 2 3\n 4 1\n 4 2\n 6 1\n 2 6\n 4 6\n 6 5", "output": "6\n 4\n 2\n 0\n 6\n 2"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.