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 largest value among A+B, A-B and A \times B.
* * * | s939094268 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split())
print(max([A+B, A-B, A*B]) | Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s814153612 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split())
print(max(A+B, A-B, A*B) | Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s642052534 | Accepted | p03337 | Input is given from Standard Input in the following format:
A B | a = input()
b = a.split()
c = [int(i) for i in b]
t = c[0] + c[1]
h = c[0] - c[1]
k = c[0] * c[1]
ans = max([t, h, k])
print(ans)
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s338879864 | Accepted | p03337 | Input is given from Standard Input in the following format:
A B | # 入力
A, B = map(int, input().split())
# rに+,-,*を代入
r = [0, 0, 0]
r[0] = A + B
r[1] = A - B
r[2] = A * B
# rをソートして最大の要素(r_0)を返す
r.sort()
print(r[2])
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s775818999 | Accepted | p03337 | Input is given from Standard Input in the following format:
A B | x = list(map(int, input().split()))
# SumDif = abs(x[0]) + abs(x[1])
Sum = x[0] + x[1]
Dif = x[0] - x[1]
Mul = x[0] * x[1]
print(max(Mul, Sum, Dif))
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s354025400 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | # input
a, b = (int(i) for i in input().split())
def calc(a, b):
r1 = a + b
r2 = a - b
r3 = a * b
if r1 >= r2 and r1 >= r3:
return r1
elif r1 =< r2 and r2 >= r3:
return r2
elif r1 =< r3 and r2 =< r3:
return r3
# output
print(calc(a, b)) | Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s055698551 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split())
if (type(a)=b==int) and (-1000 <= a=b <=1000):
print(max(a+b,a-b,a*b))
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s464132801 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | N=int(input())
S=input()
w=ans=9**9
for i in range(N):
e=S[:i].count("W")
w=S[i:].count("E")
ans=min(ans,e+w)
if w=0:break
print(ans)
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s735804646 | Wrong Answer | p03337 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split())
l = A + B
m = A - B
n = A * B
if l > m and l > n:
print(l)
elif m > l and m > n:
print(m)
else:
print(n)
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s364028988 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().sprit())
max=int(a+b)
if max<a*b:
max=int(a*b)
else if max<a-b:
max=int(a-b)
print(max) | Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s413068294 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | N=int(input())
S=input()
result=0
for i in range(a,N):
tmp = len(set(S[:i] & set(S[i:]))
if result<tmp:
result = tmp
print(result)
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s908982171 | Wrong Answer | p03337 | Input is given from Standard Input in the following format:
A B | # input
a, b = (int(i) for i in input().split())
def calc(a, b):
r1 = a + b
r2 = a - b
r3 = a * b
if r1 > r2 and r1 > r3:
return r1
elif r1 < r2 and r2 > r3:
return r2
elif r1 < r3 and r2 < r3:
return r3
# output
print(calc(a, b))
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s020075560 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | N = int(input())
S = input()
S_list = list(S)
S_max = 0
for n in range(N):
S_list_former = set(S_list[:n])
S_list_latter = set(S_list[n:N])
S_list_com = len(S_list_former & S_list_latter)
if S_list_com >= S_max:
S_max = S_list_com
print(S_max)
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s992950763 | Wrong Answer | p03337 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split())
maxNum = A + B
if maxNum <= A - B:
maxNum = A - B
elif maxNum <= A * B:
maxNum = A * B
print(maxNum)
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s054419634 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | N = int(input())
S = list(input())
change_min = N
for leader in range(N):
S_west = S[:leader]
S_east = S[leader + 1 : N]
change = S_west.count("W") + S_east.count("E")
if change <= change_min:
change_min = change
print(change_min)
| Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
Print the largest value among A+B, A-B and A \times B.
* * * | s336921809 | Runtime Error | p03337 | Input is given from Standard Input in the following format:
A B | input_a = int(input())
input_b = int(input())
sum = input_a + input_b
sub = input_a - input_b
mul = input_a * input_b
if [sum > sub] and [sum>mul]:
print(sum)
else if [sub > sum] and [sub>mul]:
print(sub)
else:
print(mul) | Statement
You are given two integers A and B. Find the largest value among A+B, A-B and
A \times B. | [{"input": "3 1", "output": "4\n \n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\n* * *"}, {"input": "4 -2", "output": "6\n \n\nThe largest is 4 - (-2) = 6.\n\n* * *"}, {"input": "0 0", "output": "0"}] |
For each dataset, print the minimum time units required to remove all the
bridges in a single line. Each line should not have any character other than
this number. | s175053520 | Runtime Error | p00777 | The input consists of at most 100 datasets. Each dataset is formatted as
follows.
> _n_
> _p_ 2 _p_ 3 ... _p n_
> _d_ 2 _d_ 3 ... _d n_
The first integer _n_ (3 ≤ _n_ ≤ 800) is the number of the islands. The
islands are numbered from 1 to _n_. The second line contains _n_ -1 island
numbers _p i_ (1 ≤ _p i_ < _i_), and tells that for each _i_ from 2 to _n_ the
island _i_ and the island _p i_ are connected by a bridge. The third line
contains _n_ -1 integers _d i_ (1 ≤ _d i_ ≤ 100,000) each denoting the length
of the corresponding bridge. That is, the length of the bridge connecting the
island _i_ and _p i_ is _d i_. It takes _d i_ units of time to cross the
bridge, and also the same units of time to remove it. Note that, with this
input format, it is assured that all the islands are reachable each other by
crossing one or more bridges.
The input ends with a line with a single zero. | import time
time.sleep(120)
exit(0)
| Bridge Removal
ICPC islands once had been a popular tourist destination. For nature
preservation, however, the government decided to prohibit entrance to the
islands, and to remove all the man-made structures there. The hardest part of
the project is to remove all the bridges connecting the islands.
There are _n_ islands and _n_ -1 bridges. The bridges are built so that all
the islands are reachable from all the other islands by crossing one or more
bridges. The bridge removal team can choose any island as the starting point,
and can repeat either of the following steps.
* Move to another island by crossing a bridge that is connected to the current island.
* Remove one bridge that is connected to the current island, and stay at the same island after the removal.
Of course, a bridge, once removed, cannot be crossed in either direction.
Crossing or removing a bridge both takes time proportional to the length of
the bridge. Your task is to compute the shortest time necessary for removing
all the bridges. Note that the island where the team starts can differ from
where the team finishes the work. | [{"input": "1 2 3\n 10 20 30\n 10\n 1 2 2 1 5 5 1 8 8\n 10 1 1 20 1 1 30 1 1\n 3\n 1 1\n 1 1\n 0", "output": "136\n 2"}] |
For each dataset, print the minimum time units required to remove all the
bridges in a single line. Each line should not have any character other than
this number. | s030799826 | Wrong Answer | p00777 | The input consists of at most 100 datasets. Each dataset is formatted as
follows.
> _n_
> _p_ 2 _p_ 3 ... _p n_
> _d_ 2 _d_ 3 ... _d n_
The first integer _n_ (3 ≤ _n_ ≤ 800) is the number of the islands. The
islands are numbered from 1 to _n_. The second line contains _n_ -1 island
numbers _p i_ (1 ≤ _p i_ < _i_), and tells that for each _i_ from 2 to _n_ the
island _i_ and the island _p i_ are connected by a bridge. The third line
contains _n_ -1 integers _d i_ (1 ≤ _d i_ ≤ 100,000) each denoting the length
of the corresponding bridge. That is, the length of the bridge connecting the
island _i_ and _p i_ is _d i_. It takes _d i_ units of time to cross the
bridge, and also the same units of time to remove it. Note that, with this
input format, it is assured that all the islands are reachable each other by
crossing one or more bridges.
The input ends with a line with a single zero. | def solve():
from collections import deque
def dfs(start, turn=False):
path = deque()
path.append(start)
bridge_lengths = deque()
bridge_lengths.append(0)
unvisited = [True] * (n + 1)
unvisited[start] = False
rest = n - 1
diameter = 0
while True:
u = path[-1]
for i, d in adj_list[u]:
if unvisited[i]:
path.append(i)
unvisited[i] = False
rest -= 1
bridge_lengths.append(d)
break
else:
distance = sum(bridge_lengths)
if diameter < distance:
diameter = distance
ans = diameter - bridge_lengths[1] - bridge_lengths[-1]
end_point = u
if rest == 0:
break
path.pop()
bridge_lengths.pop()
if turn:
return ans
else:
return end_point
import sys
file_input = sys.stdin
while True:
n = int(file_input.readline())
if n == 0:
break
p = list(map(int, file_input.readline().split()))
d = list(map(int, file_input.readline().split()))
adj_list = [[] for i in range(n + 1)]
end_bridges_weight = 0
for i1, i2, b_l in zip(range(2, n + 1), p, d):
adj_list[i1].append((i2, b_l))
adj_list[i2].append((i1, b_l))
if i1 not in p[i1 - 1 :]:
end_bridges_weight += b_l
if p.count(1) == 1:
end_bridges_weight += d[0]
e = dfs(1)
d_m = dfs(e, turn=True)
ans = sum(d) * 3 - end_bridges_weight * 2 - d_m
print(ans)
solve()
| Bridge Removal
ICPC islands once had been a popular tourist destination. For nature
preservation, however, the government decided to prohibit entrance to the
islands, and to remove all the man-made structures there. The hardest part of
the project is to remove all the bridges connecting the islands.
There are _n_ islands and _n_ -1 bridges. The bridges are built so that all
the islands are reachable from all the other islands by crossing one or more
bridges. The bridge removal team can choose any island as the starting point,
and can repeat either of the following steps.
* Move to another island by crossing a bridge that is connected to the current island.
* Remove one bridge that is connected to the current island, and stay at the same island after the removal.
Of course, a bridge, once removed, cannot be crossed in either direction.
Crossing or removing a bridge both takes time proportional to the length of
the bridge. Your task is to compute the shortest time necessary for removing
all the bridges. Note that the island where the team starts can differ from
where the team finishes the work. | [{"input": "1 2 3\n 10 20 30\n 10\n 1 2 2 1 5 5 1 8 8\n 10 1 1 20 1 1 30 1 1\n 3\n 1 1\n 1 1\n 0", "output": "136\n 2"}] |
Print the number of the pairs of pinholes that can be pointed by the compass.
* * * | s695174982 | Wrong Answer | p03858 | The input is given from Standard Input in the following format:
N a b
x_1 y_1
:
x_N y_N | import bisect
import sys
import random
from collections import defaultdict
class RandomizedBinarySearchTree:
def __init__(self):
self.children = [[-1], [-1]]
self.values = [0]
self.counts = [0]
self.indices = set()
self.root = 0
def merge(self, left_root, right_root):
children = self.children
counts = self.counts
li = left_root
ri = right_root
stack = []
while li != 0 and ri != 0:
if random.randrange(counts[li] + counts[ri]) < counts[li]:
stack.append((li, 1))
li = children[1][li]
else:
stack.append((ri, 0))
ri = children[0][ri]
i = li if li != 0 else ri
while stack:
pi, is_right = stack.pop()
children[is_right][pi] = i
counts[pi] = counts[children[0][pi]] + counts[children[1][pi]] + 1
i = pi
return i
def split(self, root, x):
i = root
lefts, rights = self.children
values = self.values
counts = self.counts
l_stack = []
r_stack = []
while i != 0:
if x < values[i]:
r_stack.append(i)
i = lefts[i]
else:
l_stack.append(i)
i = rights[i]
li, ri = 0, 0
while l_stack:
pi = l_stack.pop()
rights[pi] = li
counts[pi] = counts[lefts[pi]] + counts[li] + 1
li = pi
while r_stack:
pi = r_stack.pop()
lefts[pi] = ri
counts[pi] = counts[ri] + counts[rights[pi]] + 1
ri = pi
return li, ri
def insert(self, x):
if self.indices:
ni = self.indices.pop()
self.children[0][ni] = self.children[1][ni] = 0
self.values[ni] = x
self.counts[ni] = 1
else:
ni = len(self.values)
self.children[0].append(0)
self.children[1].append(0)
self.values.append(x)
self.counts.append(1)
li, ri = self.split(self.root, x)
self.root = self.merge(self.merge(li, ni), ri)
def delete(self, x):
li, mri = self.split(self.root, x - 1)
mi, ri = self.split(mri, x)
if mi == 0:
self.root = self.merge(li, ri)
return
self.indices.add(mi)
self.root = self.merge(li, ri)
return
def upper_bound(self, x, default=-1):
i = self.root
lefts, rights = self.children
values = self.values
counts = self.counts
y = default
c = counts[i]
j = 0
while i != 0:
if x < values[i]:
y = values[i]
c = j + counts[lefts[i]]
i = lefts[i]
else:
j += counts[lefts[i]] + 1
i = rights[i]
return y, c
def lower_bound(self, x, default=-1):
i = self.root
lefts, rights = self.children
values = self.values
counts = self.counts
y = default
c = counts[i]
j = 0
while i != 0:
if x <= values[i]:
y = values[i]
c = j + counts[lefts[i]]
i = lefts[i]
else:
j += counts[lefts[i]] + 1
i = rights[i]
return y, c
def get_k_th(self, k, default=-1):
i = self.root
children = self.children
values = self.values
counts = self.counts
if counts[i] <= k:
return default
j = k
while i != 0:
left_count = counts[children[0][i]]
if left_count == j:
return values[i]
elif left_count > j:
i = children[0][i]
else:
j -= left_count + 1
i = children[1][i]
return default
def debug_print(self):
print("Lefts ", self.children[0])
print("Rights", self.children[1])
print("Values", self.values)
print("Counts", self.counts)
self._debug_print(self.root, 0)
def _debug_print(self, i, depth):
if i != -1:
self._debug_print(self.children[0][i], depth + 1)
print(" " * depth, self.values[i], self.counts[i])
self._debug_print(self.children[1][i], depth + 1)
def x_check(x_dict, rev_dict, nx, y, d):
ret = set()
counter = 0
if nx in x_dict:
rbst, lst = x_dict[nx]
ny, _ = rbst.lower_bound(y - d, y + d + 1)
while ny <= y + d:
q = rev_dict[nx, ny]
ret.add(q)
rbst.delete(ny)
ny, _ = rbst.lower_bound(y - d, y + d + 1)
i = bisect.bisect_left(lst, y - d)
j = bisect.bisect(lst, y + d)
counter = j - i
return ret, counter
def y_check(y_dict, rev_dict, ny, x, d):
ret = set()
counter = 0
if ny in y_dict:
rbst, lst = y_dict[ny]
nx, _ = rbst.lower_bound(x - d, x + d + 1)
while nx <= x + d:
q = rev_dict[nx, ny]
ret.add(q)
rbst.delete(nx)
nx, _ = rbst.lower_bound(x - d, x + d + 1)
i = bisect.bisect(lst, x - d)
j = bisect.bisect_left(lst, x + d)
counter = j - i
return ret, counter
n, a, b, *xy = map(int, sys.stdin.buffer.read().split())
xxx = xy[0::2]
yyy = xy[1::2]
x_dict = defaultdict(lambda: [RandomizedBinarySearchTree(), []])
y_dict = defaultdict(lambda: [RandomizedBinarySearchTree(), []])
ppp = []
rev_dict = {}
for i in range(n):
x = xxx[i] - yyy[i]
y = xxx[i] + yyy[i]
x_dict[x][0].insert(y)
y_dict[y][0].insert(x)
x_dict[x][1].append(y)
y_dict[y][1].append(x)
ppp.append((x, y))
rev_dict[x, y] = i
for _, lst in x_dict.values():
lst.sort()
for _, lst in y_dict.values():
lst.sort()
a -= 1
b -= 1
ax, ay = ppp[a]
bx, by = ppp[b]
d = max(abs(ax - bx), abs(ay - by))
x_dict[ax][0].delete(ay)
x_dict[bx][0].delete(by)
y_dict[ay][0].delete(ax)
y_dict[by][0].delete(bx)
print(ppp)
stack = [a, b]
stacked = {a, b}
ans = 0
while stack:
p = stack.pop()
x, y = ppp[p]
qqq = set()
qs, c = x_check(x_dict, rev_dict, x - d, y, d)
qqq.update(qs)
ans += c
qs, c = x_check(x_dict, rev_dict, x + d, y, d)
qqq.update(qs)
ans += c
qs, c = y_check(y_dict, rev_dict, y - d, x, d)
qqq.update(qs)
ans += c
qs, c = y_check(y_dict, rev_dict, y + d, x, d)
qqq.update(qs)
ans += c
for q in qqq:
if q not in stacked:
stack.append(q)
stacked.add(q)
print(ans // 2)
| Statement
There are N pinholes on the xy-plane. The i-th pinhole is located at
(x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as
d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You have a peculiar pair of compasses, called _Manhattan Compass_. This
instrument always points at two of the pinholes. The two legs of the compass
are indistinguishable, thus we do not distinguish the following two states:
the state where the compass points at the p-th and q-th pinholes, and the
state where it points at the q-th and p-th pinholes.
When the compass points at the p-th and q-th pinholes and d(p,q)=d(p,r), one
of the legs can be moved so that the compass will point at the p-th and r-th
pinholes.
Initially, the compass points at the a-th and b-th pinholes. Find the number
of the pairs of pinholes that can be pointed by the compass. | [{"input": "5 1 2\n 1 1\n 4 3\n 6 1\n 5 5\n 4 8", "output": "4\n \n\nInitially, the compass points at the first and second pinholes.\n\nSince d(1,2) = d(1,3), the compass can be moved so that it will point at the\nfirst and third pinholes.\n\nSince d(1,3) = d(3,4), the compass can also point at the third and fourth\npinholes.\n\nSince d(1,2) = d(2,5), the compass can also point at the second and fifth\npinholes.\n\nNo other pairs of pinholes can be pointed by the compass, thus the answer is\n4.\n\n* * *"}, {"input": "6 2 3\n 1 3\n 5 3\n 3 5\n 8 4\n 4 7\n 2 5", "output": "4\n \n\n* * *"}, {"input": "8 1 2\n 1 5\n 4 3\n 8 2\n 4 7\n 8 8\n 3 3\n 6 6\n 4 8", "output": "7"}] |
Print the number of the pairs of pinholes that can be pointed by the compass.
* * * | s198053976 | Wrong Answer | p03858 | The input is given from Standard Input in the following format:
N a b
x_1 y_1
:
x_N y_N | import sys
from collections import defaultdict
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in range(rows_number)]
def SI():
return sys.stdin.readline()[:-1]
def main():
def dist(i, j):
x0, y0 = xy[i]
x1, y1 = xy[j]
return abs(x0 - x1) + abs(y0 - y1)
def dfs(i):
res = 0
x, y = xy[i]
zx, zy = x // d, y // d
for dx, dy in [
(0, 0),
(1, 0),
(0, 1),
(1, 1),
(-1, 0),
(0, -1),
(-1, -1),
(-1, 1),
(1, -1),
]:
for j in zone[zx + dx, zx + dy]:
if fin[i, j]:
continue
if dist(i, j) == d:
fin[i, j] = fin[j, i] = True
res += 1
if not vis[j]:
vis[j] = True
res += dfs(j)
return res
n, a, b = MI()
a, b = a - 1, b - 1
xy = LLI(n)
d = dist(a, b)
zone = defaultdict(list)
for i, (x, y) in enumerate(xy):
zone[x // d, y // d].append(i)
# print(zone)
vis = [False] * n
fin = defaultdict(bool)
print(dfs(a))
main()
| Statement
There are N pinholes on the xy-plane. The i-th pinhole is located at
(x_i,y_i).
We will denote the Manhattan distance between the i-th and j-th pinholes as
d(i,j)(=|x_i-x_j|+|y_i-y_j|).
You have a peculiar pair of compasses, called _Manhattan Compass_. This
instrument always points at two of the pinholes. The two legs of the compass
are indistinguishable, thus we do not distinguish the following two states:
the state where the compass points at the p-th and q-th pinholes, and the
state where it points at the q-th and p-th pinholes.
When the compass points at the p-th and q-th pinholes and d(p,q)=d(p,r), one
of the legs can be moved so that the compass will point at the p-th and r-th
pinholes.
Initially, the compass points at the a-th and b-th pinholes. Find the number
of the pairs of pinholes that can be pointed by the compass. | [{"input": "5 1 2\n 1 1\n 4 3\n 6 1\n 5 5\n 4 8", "output": "4\n \n\nInitially, the compass points at the first and second pinholes.\n\nSince d(1,2) = d(1,3), the compass can be moved so that it will point at the\nfirst and third pinholes.\n\nSince d(1,3) = d(3,4), the compass can also point at the third and fourth\npinholes.\n\nSince d(1,2) = d(2,5), the compass can also point at the second and fifth\npinholes.\n\nNo other pairs of pinholes can be pointed by the compass, thus the answer is\n4.\n\n* * *"}, {"input": "6 2 3\n 1 3\n 5 3\n 3 5\n 8 4\n 4 7\n 2 5", "output": "4\n \n\n* * *"}, {"input": "8 1 2\n 1 5\n 4 3\n 8 2\n 4 7\n 8 8\n 3 3\n 6 6\n 4 8", "output": "7"}] |
Print the quotient in a line. | s054532587 | Accepted | p02475 | Two integers $A$ and $B$ separated by a space character are given in a line. | x, y = list(map(int, input().split()))
z = x * y
x = abs(x)
y = abs(y)
ans = x // y
if z < 0:
ans = ans * (-1)
print(ans)
| Division of Big Integers
Given two integers $A$ and $B$, compute the quotient, $\frac{A}{B}$. Round
down to the nearest decimal. | [{"input": "5 8", "output": "0"}, {"input": "100 25", "output": "4"}, {"input": "-1 3", "output": "0"}, {"input": "12 -3", "output": "-4"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s034259531 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | int_list = sorted(
list(map(int, input().split()))
) # 標準入力してリスト化して小さい順に並べる
int_list.reverse() # リストの順番を逆にする
l = [str(a) for a in int_list] # リストのタイプをstr化する
s = " ".join(l) # リストを連結する
print(s) # 出力
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s475581543 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | a = list(map(int, (input().split())))
a = sorted(a, reverse=True)
for i in range(4):
print(a[i], end=" ")
print(a[4])
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s044011329 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | a, b, c, d, e = map(int, input().split())
list = [a, b, c, d, e]
list.sort()
list.reverse()
s = list
print(*s)
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s003105415 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(*reversed([int(e) for e in input().split()]))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s721267475 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(map(str, sorted([int(i) for i in input().split()], reverse=True))))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s253693813 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | (*S,) = map(int, input().split())
S.sort(reverse=1)
print(*S)
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s371735785 | Runtime Error | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(*sorted(map(int, input().spilt()))[::-1])
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s935305338 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(*reversed(list(map(int, input().split()))))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s250283134 | Runtime Error | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(map(str, sorted(map(int, input())))))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s169374721 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(*sorted(input().split())[::-1])
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s358529667 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(map(str, sorted(list(map(int, input().split())), reverse=True))))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s242244710 | Runtime Error | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(sorted([int(i) for i in input().split()], reverse=True)))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s636967228 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(sorted([i for i in input().split()], reverse=True)))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s856866414 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(*sorted(map(int, input().split()), reverse=True))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s139253154 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(*sorted(list(map(int, input().split()))[::-1]))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s289578875 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(map(str, reversed(sorted(input().split())))))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s567076255 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(sorted(input().split())[::-1]))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s110432180 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(sorted(map(int, input().split()), reverse=True))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s826784551 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(sorted(list(map(str, input().split())), reverse=True)))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s928954314 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | nums = input().split()
print(" ".join(nums.sort(reverse=True) or nums))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s924481105 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | numlist = [eval(item) for item in input().split()]
numlist.sort()
numlist.reverse()
for i in range(len(numlist)):
print(numlist[i], end="")
if i != len(numlist) - 1:
print(end=" ")
print()
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s715358672 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(*sorted(input().split(), reverse=True))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s567980740 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | print(" ".join(sorted((input().split()), reverse=True)))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s663604060 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | numbers = list(map(int, input().split()))
numbers.sort()
numbers.reverse()
print(" ".join(map(str, numbers)))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s734982172 | Wrong Answer | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | s = input().split()
arr = [int(s[i]) for i in range(5)]
arr.sort(reverse=True)
print(arr)
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the ordered numbers in a line. Adjacent numbers should be separated by a
space. | s321552386 | Accepted | p00018 | Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤
100000). The five numbers are separeted by a space. | l = sorted(map(int, input().split()), reverse=True)
print(" ".join(map(str, l)))
| Sorting Five Numbers
Write a program which reads five numbers and sorts them in descending order. | [{"input": "6 9 7 5", "output": "7 6 5 3"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s229894649 | Accepted | p03264 | Input is given from Standard Input in the following format:
K | A = int(input())
print((A // 2) * ((A + 1) // 2))
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s897542131 | Accepted | p03264 | Input is given from Standard Input in the following format:
K | print(int(int(input()) ** 2 // 2 / 2))
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s771005338 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | print((N // 2) * (N - N // 2))
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s797417820 | Wrong Answer | p03264 | Input is given from Standard Input in the following format:
K | s = int(input())
print(s / 2 * (s + 1) / 2)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s486492708 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | input(a)
if(a%2==1)
i=(a+1)/2
j=(a-1)/2
else
i=a/2
j=a/2
print(i+j) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s715724118 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | n=int(input())
if n%2==0:
print((n//2)*(n//2+1)
else:
print((n//2)**2) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s902458962 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | input(a)
if(a%2==1)
i=(a+1)/2
j=(a-1)/2
else
i=a/2
j=a/2
print(i+j) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s803438763 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | k = int(input())
if k %2 == 0:
print(int(k*k/2/2)
else:
print(int((k/2)*(k//2)/2) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s842030463 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | k = int(input())
if k %2 == 0:
print(int(k*k/2/2))
elif k%2 ==1:
print(int((k/2)*(k//2)/2)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s007354345 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | x1, y1, x2, y2 = list(map(int, input().split()))
dx = x2 - x1
dy = y2 - y1
print(x2 - dy, y2 + dx, x1 - dy, y1 + dx)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s517294335 | Accepted | p03264 | Input is given from Standard Input in the following format:
K | import sys
input_methods = ["clipboard", "file", "key"]
using_method = 0
input_method = input_methods[using_method]
IN = lambda: map(int, input().split())
mod = 1000000007
# +++++
def main():
a = int(input())
even = a // 2
odd = (a + 1) // 2
print(even * odd)
# +++++
isTest = False
def pa(v):
if isTest:
print(v)
def input_clipboard():
import clipboard
input_text = clipboard.get()
input_l = input_text.splitlines()
for l in input_l:
yield l
if __name__ == "__main__":
if sys.platform == "ios":
if input_method == input_methods[0]:
ic = input_clipboard()
input = lambda: ic.__next__()
elif input_method == input_methods[1]:
sys.stdin = open("inputFile.txt")
else:
pass
isTest = True
else:
pass
# input = sys.stdin.readline
ret = main()
if ret is not None:
print(ret)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s294009833 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | #include <bits/stdc++.h>
using namespace std;
#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
lli mod = 1000000007;
/// templates ///
const lli maxN = 2E5;
vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);
void ADD(lli &x, lli y) {
x += y;
if (x >= mod) x -= mod;
if (x < 0) x += mod;
}
void MUL(lli &x, lli y) {
x *= y;
x = (x % mod + mod) % mod;
}
lli mypow(lli b, lli e) {
lli ans = 1;
while (e) {
if (e & 1) MUL(ans, b);
MUL(b, b);
e >>= 1;
}
return ans;
}
lli modinv(lli n) {
return mypow(n, mod - 2);
}
void calcInv(lli n) {
for (int i = 2; i <= n; ++i) {
inv[i] = (mod - mod / i) * inv[mod % i] % mod;
}
}
void calcFac(lli n) {
for (int i = 2; i <= n; ++i) {
fac[i] = fac[i - 1] * i % mod;
}
}
lli cm(lli a, lli b) {
lli ans = 1;
if (a < b) return 0;
MUL(ans, inv[fac[a - b]]);
MUL(ans, inv[fac[b]]);
MUL(ans, fac[a]);
return ans;
}
lli Lucas(lli n, lli m) {
if (m == 0) return 1;
return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}
lli doLucas(lli n, lli m) {
calcInv(mod);
calcFac(mod);
return Lucas(n, m);
}
/// coding area ///
const lli maxn = 1E5;
void precal() {
return;
}
void solve() {
lli n;
cin >> n;
cout << (n / 2) * (n - n / 2) << '\n';
}
int main() {
precal();
int t = 1;
#ifdef LOCAL
t = INT_MAX;
#else
ACCEL;
#endif
// cin >> t;
for (int i = 1; i <= t; ++i) {
// printf("Case #%d: ", i );
solve();
}
return 0;
}
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s987764936 | Wrong Answer | p03264 | Input is given from Standard Input in the following format:
K | s = int(input())
if s % 2 == 1:
Odd = (s + 1) / 2
Even = Odd - 1
else:
Odd = s / 2
Even = Odd
res = Odd * Even
print(res)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s543707424 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | # cook your dish here
import numpy as np
if __name__ == "__main__":
xy = [int(i) for i in input().split()]
a1 = np.array([xy[0], xy[1]])
a2 = np.array([xy[2], xy[3]])
b = a2 - a1
r = np.pi / 2
rot = np.matrix(((np.cos(r), np.sin(r)), (-np.sin(r), np.cos(r))))
c = np.dot(b, rot)
a3 = a2 + c
a4 = a1 + c
print(
"{} {} {} {}".format(
np.round(a3[0, 0]),
np.round(a3[0, 1]),
np.round(a4[0, 0]),
np.round(a4[0, 1]),
)
)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s432936683 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K = int(input())
if K%2 = 0:
A = (K/2)*(K/2)
else:
A = ((K-1)/2)*((K+1)/2)
print(A) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s373309299 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | k = int(input())
if k == 0:
print(0)
else:
even = k//2
if k%2==0:
odd = k-1
else
odd = k
print(str(even*odd))
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s011908107 | Wrong Answer | p03264 | Input is given from Standard Input in the following format:
K | import sys
l = int(input())
if l > 262144:
print("-1")
sys.exit()
t = 0
while l > 2**t:
t += 1
print(t, t + 2, 0)
print(t, t + 1, 0)
print(t + 1, t + 2, 1)
if t >= 2:
for i in range(1, t):
if i == 1:
print(i, i + 1, 0)
else:
print(i, i + 1, 0)
print(i, i + 1, 2 ** (t - i))
bin_str = format(l - 2 ** (t - 1), "0" + str(t) + "b")
list = [2 ** (w - 1) for w in range(t, 0, -1)]
p = 0
c = 0
for j in range(len(str(bin_str))):
if str(bin_str[j]) == "1":
if j == 0:
print(1, 2, 2 ** (t - 1))
else:
c += list[p]
p = j
print(1, j + 2, c)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s748918862 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | x1, y1, x2, y2 = map(int, input().split())
dx = abs(x1 - x2)
dy = abs(y1 - y2)
if x1 < x2 and y1 <= y2:
x3 = x2 - dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 - dy
elif x1 >= x2 and y1 < y2:
x3 = x2 - dy
y3 = y2 - dx
x4 = x3 + dx
y4 = y3 - dy
elif x1 > x2 and y1 >= y2:
x3 = x2 - dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 - dy
elif x1 <= x2 and y1 > y2:
x3 = x2 + dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 + dy
print(x3, y3, x4, y4)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s899516467 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | N=int(input("enter number"))
even=0
odd=0
if N%2==0:
even=N/2
odd=N/2
elif N=0:
even=1
odd=1
else:
even=N//2
odd=(N//2) +1
Print(even*odd)
Comment in Mark | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s065821794 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | A, B, C, D = (int(i) for i in input().split())
if D > B and A > C:
E = C - (D - B)
F = D - (A - C)
G = A - (D - B)
H = B - (A - C)
print(E, F, G, H)
elif A > C and B > D:
E = C + (B - D)
F = D - (A - C)
G = A + (B - D)
H = B - (A - C)
print(E, F, G, H)
elif B > D and C > A:
E = C + (B - D)
F = D + (C - A)
G = A + (B - D)
H = B + (C - A)
print(E, F, G, H)
else:
E = C - (D - B)
F = D + (C - A)
G = A - (D - B)
H = B + (C - A)
print(E, F, G, H)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s775879007 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | a = int(input())
print(((a*a)/4+(a%2==0)?0:(a/4)) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s162411552 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | a = int(input())
print((a*a)/4+((a%2==0)?0:a/4)) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s133217139 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | aa
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s893832894 | Wrong Answer | p03264 | Input is given from Standard Input in the following format:
K | K = int(input()) ** 2 // 4
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s136071831 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | print(int((int(input() / 2)) ** 2))
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s353500455 | Accepted | p03264 | Input is given from Standard Input in the following format:
K | k = int(input())
od = k // 2 + k % 2
ev = k - od
print(od * ev)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s985713974 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | input(a)
if a / 2 == 0:
i = (a + 1) / 2
j = (a - 1) / 2
else:
i = a / 2
j = a / 2
print(i * j)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s716202617 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | print((int(input())//2)*(int(input())-(int(input())//2)) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s535315853 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | x1, y1, x2, y2 = map(int, input().split())
print(x2 - y2 + y1, y2 + x2 - x1, y2 - y1 + x1, x2 - x1 + y1)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s663653768 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K = int(input())
if K%2 == 0:
print ((K//2)**2)
else:
print ((K//2)*((K//2)+1)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s669828545 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | x =int(input())
y=x//2
if (y%2==0):
print (y**2)
elif print ((y**2)+1) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s283952216 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | k = int(input())
ans = k%2 == 0 ? (k/2)**2 : (k//2)*(k//2 -1)
print(ans) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s653519356 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | 108proA
k = int(input())
ans = (k//2) * ((k+1)//2)
print(ans) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s560254147 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | x1,y1,x2,y2=map(int,input().split())
x3=x2+y1-y2
y3=y2+x2-x1
x4=x3+y2-y3
y4=y3+x3-x2
print(x3 y3 x4 y4) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s978669511 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | N=int(input())
if N%2==0:
print(int((N/2)**2)
elif N%2!=0:
print((N//2)*(N-(N//2))) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s694269099 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K = int(input())
if K%2 == 0:
print ((K//2)**2)
else:
print (((K//2)*((K//2)+1))
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s077818253 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K = int(input())
if(K%2 == 0):
print(int((K/2)**2)
else:
print(int((K/2)*(K/2+1))) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s814566957 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | N = int(input())
if N% == 0:
print((N//2)**2)
else:
print(((N+1)//2)*((N-1)//2)) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s596493143 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K=int(input())
if K%2==0:
even=K/2
ans=even**2
else:
even=K//2
ans=even**2+1
print(ans) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s105078440 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | if val1 % 2 == 0:
print(int((val1 / 2) * (val1 / 2)))
else:
val1 = val1 + 1
print(int(((val1 / 2) * (val1 / 2)) - (val1 / 2))) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s394211806 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | a, b = map(int, input().split())
r = 0
for _ in range(2):
if a > b:
r += a
a -= 1
else:
r += b
b -= 1
print(r)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s095766004 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | team=input()
x=team[0]
flag=0
d=0
for i in range(len(team))
if team[i]==x:
flag+=1
else:
x=team[i]
flag=0
if flag==7:
print("yes")
d=1
break
if d=0:
print("no")
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s721252164 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | k=input()
pair=0
for i in range(1,k+1):
for j in range (2,k+1)
if i%2==0 and j%2!=0:
pair+=1
ELIF i%2!=0 and j%2==0 :
pair+=1
else:
pass
print(pair)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s881611480 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | if val1 % 2 == 0:
print(int((val1 // 2) * (val1 // 2)))
else:
val1 = val1 + 1
print(int(((val1 // 2) * (val1 // 2)) - (val1 // 2))) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s349990649 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | k = int(input())
if k == 0:
print(0)
else:
even = k//2
if k%2==0:
odd = k-1
else:
odd = k
print(str(even*odd)) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s126120466 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K=input()
Even=0
Odd=1
For x in range(2,k+1):
if x%2==0
Even+=1
else:
Odd+=1
print(Odd*Even)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s149500835 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | k=input()
pair=0
for i in range(1,k+1):
for j in range (2,k+1)
if i%2==0 and j%2!=0:
pair+=1
if i%2!=0 and j%2==0 :
pair+=1
print(pair) | Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s572480838 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | l = map(int, input().split())
a = list(l)
x1 = a[0]
y1 = a[1]
x2 = a[2]
y2 = a[3]
x = x2 - x1
y = y2 - y1
x3 = x2 - y
y3 = y2 + x
x4 = x1 - y
y4 = y1 + x
c = [x3, y3, x4, y4]
print(c[0], c[1], c[2], c[3])
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s914250275 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | import math
def li():
return list(map(int, input().split()))
def mi():
return map(int, input().split())
def ii():
return int(input())
x1, y1, x2, y2 = mi()
l = 0
# x = Cの場合
if (x2 - x1) == 0:
l = y2 - y1
if y2 > y1:
x3 = x1 - l
else:
x3 = x1 + l
y3 = y2
x4 = x3
y4 = y1
# y = Cの場合
elif (y2 - y1) == 0:
l = x2 - x1
x3 = x2
if x2 > x1:
y3 = y2 - l
else:
y3 = y2 + l
x4 = x1
y4 = y3
# y = ax + bの場合
else:
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x1 - (y2 - y1)
y4 = y1 + (x2 - x1)
print(x3, y3, x4, y4)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s267477629 | Wrong Answer | p03264 | Input is given from Standard Input in the following format:
K | from math import log2
L = int(input())
ans = []
i = 1
while True:
if 2**i > L:
last = i
break
ans.append([i, i + 1, 2 ** (i - 1)])
ans.append([i, i + 1, 0])
i += 1
"""for i in ans:
print(i)
print(last)"""
num = 2 ** (last - 1)
a = L - num
while a > 0:
ans.append([int(log2(a)) + 1, last, num])
num += 2 ** (int(log2(a)))
a = L - num
for i in ans:
print(*i)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s479439798 | Accepted | p03264 | Input is given from Standard Input in the following format:
K | print(int(input()) ** 2 >> 2)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s405673899 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K = int(input() ** 2 // 4)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Print the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive).
* * * | s291939632 | Runtime Error | p03264 | Input is given from Standard Input in the following format:
K | K = int(input() // 2**2)
| Statement
Find the number of ways to choose a pair of an even number and an odd number
from the positive integers between 1 and K (inclusive). The order does not
matter. | [{"input": "3", "output": "2\n \n\nTwo pairs can be chosen: (2,1) and (2,3).\n\n* * *"}, {"input": "6", "output": "9\n \n\n* * *"}, {"input": "11", "output": "30\n \n\n* * *"}, {"input": "50", "output": "625"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.