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 |
|---|---|---|---|---|---|---|---|
If it is possible that there are exactly X cats, print `YES`; if it is
impossible, print `NO`.
* * * | s554564032 | Runtime Error | p03377 | Input is given from Standard Input in the following format:
A B X | #!/usr/bin/env python
# -*- coding: utf-8 -*-
N,M,X = map(int,input().split()) #整数の入力
a = list(map(int,input().split()))
#検問所の入力
b=[]
c=[]
for i in range(X+1,N): #X+1からNの範囲の整数について
if i in a: #ある整数が検問所の整数として存在する
b.append(1)
for i in range(1,X): #1からX-1の範囲の整数について
if i in a: #ある整数が検問所の整数として存在する
c.append(1)
print(min(sum(b),sum(c)) | Statement
There are a total of A + B cats and dogs. Among them, A are known to be cats,
but the remaining B are not known to be either cats or dogs.
Determine if it is possible that there are exactly X cats among these A + B
animals. | [{"input": "3 5 4", "output": "YES\n \n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4\ncats in total.\n\n* * *"}, {"input": "2 2 6", "output": "NO\n \n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in\ntotal.\n\n* * *"}, {"input": "5 3 2", "output": "NO\n \n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in\ntotal."}] |
If it is possible that there are exactly X cats, print `YES`; if it is
impossible, print `NO`.
* * * | s410007169 | Runtime Error | p03377 | Input is given from Standard Input in the following format:
A B X | a,b,x = map(int,input().split())
if a <= x and a + b >= x:
print('YES')
else:
print('NO) | Statement
There are a total of A + B cats and dogs. Among them, A are known to be cats,
but the remaining B are not known to be either cats or dogs.
Determine if it is possible that there are exactly X cats among these A + B
animals. | [{"input": "3 5 4", "output": "YES\n \n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4\ncats in total.\n\n* * *"}, {"input": "2 2 6", "output": "NO\n \n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in\ntotal.\n\n* * *"}, {"input": "5 3 2", "output": "NO\n \n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in\ntotal."}] |
If AtCoDeer can carry out his plan, print `Yes`; if he cannot, print `No`.
* * * | s483242221 | Accepted | p03459 | Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()
n = ni()
txy = nan(n)
ct = 0
cx, cy = 0, 0
flag = True
for i in range(n):
t, x, y = txy[i]
nx, ny = abs(cx - x), abs(cy - y)
p = abs(nx - ny)
if ct + t < nx + ny:
flag = False
if t > nx + ny and (ct + t) % 2 != p % 2:
flag = False
cx, cy = x, y
ct = t
print("Yes" if flag else "No")
| Statement
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan,
he will depart from point (0, 0) at time 0, then for each i between 1 and N
(inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following
points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he
cannot stay at his place**. Determine whether he can carry out his plan. | [{"input": "2\n 3 1 2\n 6 1 1", "output": "Yes\n \n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1),\n(1,0), then (1,1).\n\n* * *"}, {"input": "1\n 2 100 100", "output": "No\n \n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\n* * *"}, {"input": "2\n 5 1 1\n 100 1 1", "output": "No"}] |
If AtCoDeer can carry out his plan, print `Yes`; if he cannot, print `No`.
* * * | s274324265 | Runtime Error | p03459 | Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
class Scanner:
def int():
return int(sys.stdin.readline().rstrip())
def string():
return sys.stdin.readline().rstrip()
def map_int():
return [int(x) for x in Scanner.string().split()]
def string_list(n):
return [input() for i in range(n)]
def int_list_list(n):
return [Scanner.map_int() for i in range(n)]
def int_cols_list(n):
return [int(input()) for i in range(n)]
class Math:
def gcd(a, b):
if b == 0:
return a
return Math.gcd(b, a % b)
def lcm(a, b):
return (a * b) // Math.gcd(a, b)
def roundUp(a, b):
return -(-a // b)
def toUpperMultiple(a, x):
return Math.roundUp(a, x) * x
def toLowerMultiple(a, x):
return (a // x) * x
def nearPow2(n):
if n <= 0:
return 0
if n & (n - 1) == 0:
return n
ret = 1
while n > 0:
ret <<= 1
n >>= 1
return ret
def isPrime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False
d = int(n**0.5) + 1
for i in range(3, d + 1, 2):
if n % i == 0:
return False
return True
MOD = int(1e09) + 7
def main():
sys.stdin = open("sample.txt")
N = Scanner.int()
T = Scanner.int_list_list(N)
x, y, t = 0, 0, 0
for i in T:
len = abs(i[1] - x) + abs(i[2] - y)
time = i[0] - t
if len <= time and len % 2 == time % 2:
t, x, y = i
else:
print("No")
return
print("Yes")
return
if __name__ == "__main__":
main()
| Statement
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan,
he will depart from point (0, 0) at time 0, then for each i between 1 and N
(inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following
points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he
cannot stay at his place**. Determine whether he can carry out his plan. | [{"input": "2\n 3 1 2\n 6 1 1", "output": "Yes\n \n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1),\n(1,0), then (1,1).\n\n* * *"}, {"input": "1\n 2 100 100", "output": "No\n \n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\n* * *"}, {"input": "2\n 5 1 1\n 100 1 1", "output": "No"}] |
If AtCoDeer can carry out his plan, print `Yes`; if he cannot, print `No`.
* * * | s487079636 | Runtime Error | p03459 | Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N | N, K = map(int, input().split())
xyc = []
for i in range(N):
tmp_x, tmp_y, tmp_c = input().split()
xyc.append([int(tmp_x), int(tmp_y), tmp_c])
def check(sx, sy, K, x, y):
x = x % (2 * K)
y = y % (2 * K)
if x < sx or x >= sx + K:
if y < sy:
return "W"
elif y < sy + K:
return "B"
else:
return "W"
# elif x >= sx and x < sx + K:
else:
if y < sy:
return "B"
elif y < sy + K:
return "W"
else:
return "B"
ans = 0
for sx in range(K + 1):
for sy in range(K + 1):
r = 0
for i in range(N):
if check(sx, sy, K, xyc[i][0], xyc[i][1]) == xyc[i][2]:
r = r + 1
ans = max(ans, r)
print(ans)
| Statement
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan,
he will depart from point (0, 0) at time 0, then for each i between 1 and N
(inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following
points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he
cannot stay at his place**. Determine whether he can carry out his plan. | [{"input": "2\n 3 1 2\n 6 1 1", "output": "Yes\n \n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1),\n(1,0), then (1,1).\n\n* * *"}, {"input": "1\n 2 100 100", "output": "No\n \n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\n* * *"}, {"input": "2\n 5 1 1\n 100 1 1", "output": "No"}] |
If AtCoDeer can carry out his plan, print `Yes`; if he cannot, print `No`.
* * * | s869142716 | Runtime Error | p03459 | Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N | n = int(input())
ti = [0] * (n-1)
xi = [0] * (n-1)
yi = [0] * (n-1)
P = 'Yes'
for i in range(n):
tii, xii, yii = map(int, input().split())
ti.append(tii)
xi.append(xii)
yi.append(yii)
tc = ti[i-1] - ti[i]
#dest = abs(xi[i]-xi[i-1]) - abs(yi[i]-yi[i-1])
#if tc == abs(dest): pass
if (ti[i]-ti[i-1]) < (abs(xi[i]-xi[i-1]+abs(yi[i]-yi[i-1])) or (xi[i]+yi[i]+ti[i]-ti[i-1])%2: P = 'No'
print(P)
| Statement
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan,
he will depart from point (0, 0) at time 0, then for each i between 1 and N
(inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following
points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he
cannot stay at his place**. Determine whether he can carry out his plan. | [{"input": "2\n 3 1 2\n 6 1 1", "output": "Yes\n \n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1),\n(1,0), then (1,1).\n\n* * *"}, {"input": "1\n 2 100 100", "output": "No\n \n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\n* * *"}, {"input": "2\n 5 1 1\n 100 1 1", "output": "No"}] |
If AtCoDeer can carry out his plan, print `Yes`; if he cannot, print `No`.
* * * | s638172655 | Runtime Error | p03459 | Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N | N = int(input())
nx, ny = 0, 0
for i in range(N):
t, x, y = list(map(int(input().split(" ")))
if abs(nx - x) + abs(ny - y) != t:
print("No")
return
else:
nx, ny = x, y
print("Yes") | Statement
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan,
he will depart from point (0, 0) at time 0, then for each i between 1 and N
(inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following
points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he
cannot stay at his place**. Determine whether he can carry out his plan. | [{"input": "2\n 3 1 2\n 6 1 1", "output": "Yes\n \n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1),\n(1,0), then (1,1).\n\n* * *"}, {"input": "1\n 2 100 100", "output": "No\n \n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\n* * *"}, {"input": "2\n 5 1 1\n 100 1 1", "output": "No"}] |
If AtCoDeer can carry out his plan, print `Yes`; if he cannot, print `No`.
* * * | s872304540 | Accepted | p03459 | Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N | n = int(input())
s, a, b = 0, 0, 0
f = True
for _ in [0] * n:
t, x, y = map(int, input().split())
p = t - s - (abs(x - a) + abs(y - b))
if p % 2 == 1 or p < 0:
f = False
print("Yes" if f else "No")
| Statement
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan,
he will depart from point (0, 0) at time 0, then for each i between 1 and N
(inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following
points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he
cannot stay at his place**. Determine whether he can carry out his plan. | [{"input": "2\n 3 1 2\n 6 1 1", "output": "Yes\n \n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1),\n(1,0), then (1,1).\n\n* * *"}, {"input": "1\n 2 100 100", "output": "No\n \n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\n* * *"}, {"input": "2\n 5 1 1\n 100 1 1", "output": "No"}] |
If AtCoDeer can carry out his plan, print `Yes`; if he cannot, print `No`.
* * * | s950446453 | Accepted | p03459 | Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N | t, x, y = 0, 0, 0
for i in range(int(input())):
next_t, next_x, next_y = map(int, input().split())
diff = abs(x - next_x) + abs(y - next_y)
if diff > (next_t - t):
print("No")
exit(0)
if (diff - (next_t - t)) % 2 == 1:
print("No")
exit(0)
(
t,
x,
y,
) = (
next_t,
next_x,
next_y,
)
print("Yes")
| Statement
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan,
he will depart from point (0, 0) at time 0, then for each i between 1 and N
(inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following
points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he
cannot stay at his place**. Determine whether he can carry out his plan. | [{"input": "2\n 3 1 2\n 6 1 1", "output": "Yes\n \n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1),\n(1,0), then (1,1).\n\n* * *"}, {"input": "1\n 2 100 100", "output": "No\n \n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\n* * *"}, {"input": "2\n 5 1 1\n 100 1 1", "output": "No"}] |
Print the number of ways to have H blocks on every square, modulo 10^9+7.
* * * | s845773234 | Runtime Error | p03009 | Input is given from Standard Input in the following format:
N H D | n = int(input())
ga, sa, ba = list(map(int, input().split()))
gb, sb, bb = list(map(int, input().split()))
w_ab = []
v_ab = []
if ga < gb:
w_ab.append(ga)
v_ab.append(gb)
if sa < sb:
w_ab.append(sa)
v_ab.append(sb)
if ba < bb:
w_ab.append(ba)
v_ab.append(bb)
num = (n + 1) * (len(w_ab) + 1)
dp = [0] * num
for i in range(len(w_ab)):
for j in range(n + 1):
if j < w_ab[i]:
dp[(i + 1) * (n + 1) + j] = dp[i * (n + 1) + j]
else:
dp[(i + 1) * (n + 1) + j] = max(
dp[i * (n + 1) + j], dp[(i + 1) * (n + 1) + j - w_ab[i]] + v_ab[i]
)
ans = 0
length = len(w_ab)
for j in range(n + 1):
ans = max(ans, dp[length * (n + 1) + j] + n - j)
n = ans
w_ab = []
v_ab = []
if ga > gb:
w_ab.append(gb)
v_ab.append(ga)
if sa > sb:
w_ab.append(sb)
v_ab.append(sa)
if ba > bb:
w_ab.append(bb)
v_ab.append(ba)
num = (n + 1) * (len(w_ab) + 1)
dp = [0] * num
for i in range(len(w_ab)):
for j in range(n + 1):
if j < w_ab[i]:
dp[(i + 1) * (n + 1) + j] = dp[i * (n + 1) + j]
else:
dp[(i + 1) * (n + 1) + j] = max(
dp[i * (n + 1) + j], dp[(i + 1) * (n + 1) + j - w_ab[i]] + v_ab[i]
)
length = len(w_ab)
ans = 0
for j in range(n + 1):
ans = max(ans, dp[length * (n + 1) + j] + n - j)
print(ans)
| Statement
There are N squares arranged in a row, numbered 1 to N from left to right.
Takahashi will stack building blocks on these squares, on which there are no
blocks yet.
He wants to stack blocks on the squares evenly, so he will repeat the
following operation until there are H blocks on every square:
* Let M and m be the maximum and minimum numbers of blocks currently stacked on a square, respectively. Choose a square on which m blocks are stacked (if there are multiple such squares, choose any one of them), and add a positive number of blocks on that square so that there will be at least M and at most M + D blocks on that square.
Tell him how many ways there are to have H blocks on every square by repeating
this operation. Since there can be extremely many ways, print the number
modulo 10^9+7. | [{"input": "2 2 1", "output": "6\n \n\nThe possible transitions of (the number of blocks on Square 1, the number of\nblocks on Square 2) are as follows:\n\n * (0, 0) -> (0, 1) -> (1, 1) -> (1, 2) -> (2, 2)\n\n * (0, 0) -> (0, 1) -> (1, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (0, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 1) -> (1, 2) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 2) -> (2, 2)\n\nThus, there are six ways to have two blocks on every square.\n\n* * *"}, {"input": "2 30 15", "output": "94182806\n \n\n* * *"}, {"input": "31415 9265 3589", "output": "312069529\n \n\nBe sure to print the number modulo 10^9+7."}] |
Print the number of ways to have H blocks on every square, modulo 10^9+7.
* * * | s643305000 | Runtime Error | p03009 | Input is given from Standard Input in the following format:
N H D | n = int(input())
fib = 1
if n < 10:
fib = [1, 2, 4, 7, 12, 20, 33, 54, 88]
else:
fib = [1, 2, 4, 7, 12, 20, 33, 54, 55]
prod = [1] * 10
for i in range(1, 9):
prod[i] = prod[i - 1] * fib[i]
ans = [[0] * n for i in range(n)]
for i in range(n):
for j in range(i + 1, n):
ans[i][j] = ans[j][i] = fib[j - i - 1] * prod[n - 2 - i]
for i in range(n):
print(" ".join(list(map(str, ans[i]))))
| Statement
There are N squares arranged in a row, numbered 1 to N from left to right.
Takahashi will stack building blocks on these squares, on which there are no
blocks yet.
He wants to stack blocks on the squares evenly, so he will repeat the
following operation until there are H blocks on every square:
* Let M and m be the maximum and minimum numbers of blocks currently stacked on a square, respectively. Choose a square on which m blocks are stacked (if there are multiple such squares, choose any one of them), and add a positive number of blocks on that square so that there will be at least M and at most M + D blocks on that square.
Tell him how many ways there are to have H blocks on every square by repeating
this operation. Since there can be extremely many ways, print the number
modulo 10^9+7. | [{"input": "2 2 1", "output": "6\n \n\nThe possible transitions of (the number of blocks on Square 1, the number of\nblocks on Square 2) are as follows:\n\n * (0, 0) -> (0, 1) -> (1, 1) -> (1, 2) -> (2, 2)\n\n * (0, 0) -> (0, 1) -> (1, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (0, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 1) -> (1, 2) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 2) -> (2, 2)\n\nThus, there are six ways to have two blocks on every square.\n\n* * *"}, {"input": "2 30 15", "output": "94182806\n \n\n* * *"}, {"input": "31415 9265 3589", "output": "312069529\n \n\nBe sure to print the number modulo 10^9+7."}] |
Print the number of ways to have H blocks on every square, modulo 10^9+7.
* * * | s365906627 | Runtime Error | p03009 | Input is given from Standard Input in the following format:
N H D | n, h, d = map(int, input().split())
MOD = 10**9 + 7
# dp[i][j] := 高さiのブロックが最大高さでj個ある時の通り数
dp = [[0] * (n + 1) for i in range(h + 1)]
dp[0][n] = 1
# O(HDN)
for i in range(h):
# j = 0 -> j = 1 にする
for diff in range(1, d + 1):
if i + 1 - diff < 0:
continue
for cnt in range(1, n + 1):
dp[i + 1][1] += dp[i + 1 - diff][cnt] * cnt
dp[i + 1][1] %= MOD
# j -> j + 1 にする
for j in range(2, n + 1):
dp[i + 1][j] += dp[i + 1][j - 1] * (n - (j - 1))
dp[i + 1][j] %= MOD
print(dp[-1][-1])
| Statement
There are N squares arranged in a row, numbered 1 to N from left to right.
Takahashi will stack building blocks on these squares, on which there are no
blocks yet.
He wants to stack blocks on the squares evenly, so he will repeat the
following operation until there are H blocks on every square:
* Let M and m be the maximum and minimum numbers of blocks currently stacked on a square, respectively. Choose a square on which m blocks are stacked (if there are multiple such squares, choose any one of them), and add a positive number of blocks on that square so that there will be at least M and at most M + D blocks on that square.
Tell him how many ways there are to have H blocks on every square by repeating
this operation. Since there can be extremely many ways, print the number
modulo 10^9+7. | [{"input": "2 2 1", "output": "6\n \n\nThe possible transitions of (the number of blocks on Square 1, the number of\nblocks on Square 2) are as follows:\n\n * (0, 0) -> (0, 1) -> (1, 1) -> (1, 2) -> (2, 2)\n\n * (0, 0) -> (0, 1) -> (1, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (0, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 1) -> (1, 2) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 1) -> (2, 1) -> (2, 2)\n\n * (0, 0) -> (1, 0) -> (1, 2) -> (2, 2)\n\nThus, there are six ways to have two blocks on every square.\n\n* * *"}, {"input": "2 30 15", "output": "94182806\n \n\n* * *"}, {"input": "31415 9265 3589", "output": "312069529\n \n\nBe sure to print the number modulo 10^9+7."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s450045757 | Wrong Answer | p02248 | In the first line, a text T is given. In the second line, a string P is given. | if __name__ == "__main__":
# ??????????????\???
# T = 'aabaaabaaabaa'
# P = 'aa'
T = input()
P = input()
p_len = len(P)
# ????????????????´¢
results = []
offset = 0
while len(T) >= p_len:
truncate = 1
mismatch_at = 0
match = True
for i in range(p_len):
if T[i] != P[i]:
match = False
mismatch_at = i + 1
break
if match is True:
results.append(offset)
else:
truncate = mismatch_at
T = T[truncate:]
offset += truncate
# ???????????¨???
for r in results:
print(r)
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s732883212 | Wrong Answer | p02248 | In the first line, a text T is given. In the second line, a string P is given. | text = input().strip()
pattern = input().strip()
skip_table = {}
def make_skip_table(pattern):
global skip_table
for i in range(len(pattern)):
c = pattern[-1 * (i + 1)]
if c not in skip_table.keys():
skip_table[c] = i
def boyer_moore(text, pattern):
loop_num = len(text) - len(pattern)
pattern_length = len(pattern)
start = 0
while start <= loop_num:
for i in range(pattern_length):
pos = start + pattern_length - (i + 1)
c = text[pos]
if c != pattern[-(i + 1)]:
if c not in skip_table.keys():
start += pattern_length
else:
start += skip_table[c]
break
print(start)
start += 1
make_skip_table(pattern)
boyer_moore(text, pattern)
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s895112503 | Runtime Error | p02248 | In the first line, a text T is given. In the second line, a string P is given. | class RKSearch:
shift = 40
size = 33554393
def __init__(self, s1, s2):
self.haystack = self.encode(s1)
self.needle = self.encode(s2)
def find(self):
m, n = len(self.haystack), len(self.needle)
h1 = self.hash(self.haystack, n)
h2 = self.hash(self.needle, n)
dm = self.shift ** (n - 1) % self.size
for i in range(m - n + 1):
if h1 == h2:
yield i
if i + n < m:
h1 = (
(h1 - self.haystack[i] * dm) * self.shift + self.haystack[i + n]
) % self.size
def hash(self, s, length):
h = 0
for i in range(length):
h = (h * self.shift + s[i]) % self.size
return h
def encode(cls, s):
basea = int.from_bytes(b"a", "little")
based = int.from_bytes(b"0", "little")
bs = []
for c in s:
if c.isdigit():
bs.append(int.from_bytes(c.encode("utf8"), "little") - based + 27)
else:
bs.append(int.from_bytes(c.encode("utf8"), "little") - basea)
return bs
def run():
s1 = input()
s2 = input()
rk = RKSearch(s1, s2)
for i in rk.find():
print(i)
if __name__ == "__main__":
run()
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s641741756 | Accepted | p02248 | In the first line, a text T is given. In the second line, a string P is given. | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_B&lang=jp
# String Search : python3
# 2018.11.26 yonezawa
import sys
input = sys.stdin.readline
# import cProfile
def main():
s1 = str(input()).rstrip("\n")
s2 = str(input()).rstrip("\n")
s1_len = len(s1)
s2_len = len(s2)
sc = 1
for k in range(1, len(s2)):
if s2[0] != s2[k]:
break
sc += 1
tc = len(set(s2))
if tc == 1 and s2_len > 1:
cnt = 0
for k in range(s1_len):
if s1[k] == s2[0]:
cnt += 1
else:
cnt = 0
if cnt >= s2_len:
print(cnt - s2_len)
else:
i = s1.find(s2)
while i != -1:
print(i)
i = s1.find(s2, i + 1)
if __name__ == "__main__":
main()
# pr = cProfile.Profile()
# pr.runcall(main)
# pr.print_stats()
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s955526066 | Wrong Answer | p02248 | In the first line, a text T is given. In the second line, a string P is given. | def create_skip_table(pattern):
table = [0 for i in range(len(pattern))]
j = 0
for i in range(1, len(pattern)):
if pattern[i] == pattern[j]:
table[i] = j
j += 1
else:
table[i] = j
j = 0
return table
def kmp_search(text, pattern):
skip_table = create_skip_table(pattern)
ti, pi = 0, 0
while ti < len(text):
# print(text)
# print(' '*(ti-pi) + pattern)
# print(' '*ti + '^')
if text[ti] == pattern[pi]:
ti += 1
pi += 1
elif pi == 0:
ti += 1
else:
pi = skip_table[pi]
if pi == len(pattern):
print(ti - pi)
pi = 0
ti -= len(pattern) - 1
text = input()
pattern = input()
kmp_search(text, pattern)
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s620641558 | Accepted | p02248 | In the first line, a text T is given. In the second line, a string P is given. | def f(T, P):
for i in range(len(T)):
P != T[i : i + len(P)] or print(i)
if "__main__" == __name__:
f(input(), input())
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s890054044 | Accepted | p02248 | In the first line, a text T is given. In the second line, a string P is given. | T, P = input(), input()
for i in range(len(T)):
P != T[i : i + len(P)] or print(i)
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s686287113 | Accepted | p02248 | In the first line, a text T is given. In the second line, a string P is given. | def atoi(a):
return ord(a) + (1 << 31)
S = input()
T = input()
ns = len(S)
nt = len(T)
if ns < nt:
exit()
mod = (1 << 61) - 1
b = 10**9 + 7
bn = pow(b, nt, mod)
hs = 0
ht = 0
for s, t in zip(S, T):
hs = (hs * b + atoi(s)) % mod
ht = (ht * b + atoi(t)) % mod
for i in range(ns - nt + 1):
if hs == ht:
print(i)
if ns - nt <= i:
break
hs = (hs * b + atoi(S[i + nt]) - bn * atoi(S[i])) % mod
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Print an index of T where P found in a line. Print the indices in ascending
order. | s001422478 | Accepted | p02248 | In the first line, a text T is given. In the second line, a string P is given. | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
T = sys.stdin.buffer.readline().decode().rstrip()
P = sys.stdin.buffer.readline().decode().rstrip()
MASK30 = (1 << 30) - 1
MASK31 = (1 << 31) - 1
MOD = (1 << 61) - 1
MASK61 = MOD
def Mul(a, b):
au = a >> 31
ad = a & MASK31
bu = b >> 31
bd = b & MASK31
mid = ad * bu + au * bd
midu = mid >> 30
midd = mid & MASK30
return au * bu * 2 + midu + (midd << 31) + ad * bd
# mod 2^61-1を計算する関数
def CalcMod(x):
xu = x >> 61
xd = x & MASK61
res = xu + xd
if res >= MOD:
res -= MOD
return res
class RollingHash:
# Verify: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_B
def __init__(self, seq, base=10**9 + 7):
"""
:param str|typing.Sequence[int] seq:
:param int base:
:param int mod:
"""
if isinstance(seq, str):
self._seq = seq = list(map(ord, seq))
else:
self._seq = seq
hashes = [0] * (len(seq) + 1)
power = [1] * (len(seq) + 1)
for i, c in enumerate(seq):
hashes[i + 1] = CalcMod(Mul(hashes[i], base) + c)
power[i + 1] = CalcMod(Mul(power[i], base))
self._hashes = hashes
self._power = power
def get(self, L, r):
"""
[L, r) のハッシュ値を取得します
:param int L:
:param int r:
"""
if L >= r:
return 0
return (self._hashes[r] - self._hashes[L] * self._power[r - L]) % MOD
t_rh = RollingHash(T)
p_rh = RollingHash(P)
obj = p_rh.get(0, len(P))
r = len(P)
l = 0
while r <= len(T):
if t_rh.get(l, r) == obj:
print(l)
r += 1
l += 1
# S = 'ababa'
# rh = RollingHash(S)
# for l in range(len(S)):
# for r in range(l + 1, len(S) + 1):
# print(S[l:r], l, r, rh.get(l, r))
#
# print(t_rh._hashes)
| String Search
Find places where a string P is found within a text T. Print all indices of T
where P found. The indices of T start with 0. | [{"input": "aabaaa\n aa", "output": "0\n 3\n 4"}, {"input": "xyzz\n yz", "output": "1"}, {"input": "abc\n xyz", "output": "The output should be empty."}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s802330644 | Runtime Error | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | from bisect import bisect_left
from random import randint
D = int(input())
C = [0] + list(map(int, input().split()))
S = [0] + [[0] + list(map(int, input().split())) for _ in range(D)]
contest = [[0] for _ in range(27)]
# SL:満足度、sch:スケジュール
SL, sch = 0, [0]
T = [0] + [randint(1, 365) for _ in range(365)]
# tの日程でコンテストを行った時の満足度を計算
for d in range(1, D + 1):
t = T[d]
sch.append(t)
# コンテストの開催日時を記録
contest[t].append(d)
SL += S[d][t]
for i in range(1, 27):
SL -= C[i] * (d - contest[i][-1])
for i in range(1, 27):
contest[i].append(D + 1)
M = 10000
for i in range(M):
d, q = [randint(1, 365) for _ in range(2)]
before_SL = SL.copy()
before_sch = sch.copy()
before_contest = contest.copy()
SL += S[d][q] - S[d][sch[d]]
# print("1", contest[sch[d]])
ind = bisect_left(contest[sch[d]], d)
# print("2", ind)
k = d - contest[sch[d]][ind - 1]
l = contest[sch[d]][ind + 1] - d
SL -= C[sch[d]] * k * l
del contest[sch[d]][ind]
ind = bisect_left(contest[q], d)
contest[q].insert(ind, d)
k = d - contest[q][ind - 1]
l = contest[q][ind + 1] - d
SL += C[q] * k * l
sch[d] = q
if before_SL > SL:
SL = before_SL
sch = before_sch
contest = before_contest
else:
T[d] = q
# print(SL)
print(*T, sep="\n")
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s785108269 | Accepted | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | for i in range(1, 366):
print(5)
exit()
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s250297654 | Accepted | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | D = int(input())
A = [[0] * 26] * D
S = 0
C = list(map(int, input().split()))
P = 0
ld = [0] * 26 # 最後に行った日の格納
l = [0] * 26 # 損失の計算
sp = 0 # 一時格納
t = [0] * D
for i in range(D):
A[i] = list(map(int, input().split()))
for j in range(D):
maxvalue = max(A[j])
index = A[j].index(maxvalue)
for n in range(26):
ld[n] = ld[n] + 1
sp = ld[index]
ld[index] = 0
for k in range(26):
l[k] = C[k] * ld[k]
lmax = max(l)
if 13 * lmax > maxvalue:
lindex = l.index(lmax)
ld[index] = sp
ld[lindex] = 0
for m in range(26):
l[m] = C[m] * ld[m]
S = S + maxvalue - sum(l)
t[j] = index + 1
for num in range(D):
print(t[num])
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s374537186 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | print(int(input()))
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s952789717 | Runtime Error | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | n = int(input())
list_c = list(map(int, input().split()))
list_d = []
for i in range(n):
list_d.append(list(map(int, input().split())))
now = [0] * 26
max_happy = 0
index_max = -1
for day in range(1, n + 1):
max_happy = 0
index_max = -1
for i in range(n):
score = list_d[day - 1][i] - (day - now[i]) * list_c[i]
if score > max_happy:
index_max = i
max_happy = score
print(index_max + 1)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s292372386 | Accepted | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | import sys
import numpy as np
TYPE_NUM = 26
def resolve():
inp = sys.stdin.readlines()
D = int(inp[0])
c = np.array(list(map(int, inp[1].split(" "))))
s = []
last = np.zeros(TYPE_NUM, dtype=int)
types = []
for i in range(2, len(inp)):
s.append(list(map(int, inp[i].split(" "))))
s = np.array(s, dtype=int)
for d in range(D):
temp_delta_satis = np.zeros([TYPE_NUM, TYPE_NUM], dtype=int)
for idx in range(TYPE_NUM):
val = s[d, idx]
org = last[idx]
last[idx] = d + 1
temp_delta_satis[:, idx] = (np.sum(-c * (d + 1 - last)) + val) * 4
if D != d + 1:
for idx2 in range(TYPE_NUM):
val2 = s[d + 1, idx2]
org2 = last[idx2]
last[idx2] = d + 2
temp_delta_satis[idx2, idx] += np.sum(-c * (d + 2 - last)) + val2
last[idx2] = org2
last[idx] = org
opt_idx = np.unravel_index(np.argmax(temp_delta_satis), temp_delta_satis.shape)[
1
]
types.append(opt_idx + 1)
print(*types, sep="\n")
resolve()
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s854753873 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | de = int(input())
c = list(map(int, input().split()))
d = 0
f = 0
for i in range(de):
g = sum(list(map(int, input().split())))
if g > d:
d = g
f = i
for i in range(d):
print(f)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s574899497 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | from bisect import bisect_right
from random import randint
def calculate_score(c, L):
global D, last, S
rst = 0
_last = L
for d in range(1, D + 1):
down = C[c] * (d - _last[d])
up = S[d][c] if _last[d] == d else 0
rst += up - down
return rst
Z = 26
D = int(input())
C = list(map(int, input().split()))
S = [tuple([0] * Z)] + [tuple(map(int, input().split())) for _ in range(D)]
last = [-1] * Z
ans = 0
T = [0]
for d in range(D):
maxScore = -float("inf")
cand = 0
for i in range(26):
tmp = last[i]
last[i] = d
up = S[d][i]
down = sum(C[j] * (d - last[j]) for j in range(Z))
score = up - down
if maxScore < score:
cand = i
maxScore = score
last[i] = tmp
last[cand] = d
T.append(cand)
last = [[0] * (D + 1) for _ in range(Z)]
V = [0] * Z
for d in range(1, D + 1):
t = T[d]
for p in range(Z):
last[p][d] = last[p][d - 1]
last[t][d] = d
for p in range(Z):
V[p] = calculate_score(p, last[p])
score = sum(V)
print("Initial Score: ", score)
max_iter = 10**4
for _ in range(max_iter):
d = randint(1, D)
q = randint(0, Z - 1)
p = T[d]
if p == q:
continue
e = bisect_right(last[p], d)
_lastP = [0] * (D + 1)
for j in range(d):
_lastP[j] = last[p][j]
for j in range(d, e):
_lastP[j] = _lastP[j - 1]
for j in range(e, D + 1):
_lastP[j] = last[p][j]
old = last[q][d]
e = bisect_right(last[q], old)
_lastQ = [0] * (D + 1)
for j in range(d):
_lastQ[j] = last[q][j]
for j in range(d, e):
_lastQ[j] = d
for j in range(e, D + 1):
_lastQ[j] = last[q][j]
Vp = calculate_score(p, _lastP)
Vq = calculate_score(q, _lastQ)
if V[p] + V[q] < Vp + Vq:
score -= V[p] + V[q]
score += Vp + Vq
V[p] = Vp
V[q] = Vq
T[d] = q
last[p] = _lastP
last[q] = _lastQ
for i in range(1, D + 1):
print(T[i] + 1)
print(score)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s908357153 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from numba import njit
def getInputs():
D = int(readline())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
return D, C, S
@njit("(i8, i4[:], i4[:, :], i4[:], )", cache=True)
def _compute_score1(D, C, S, out):
score = 0
last = np.zeros(26, np.int32)
for d in range(len(out)):
i = out[d]
score += S[d, i]
last[i] = d + 1
score -= np.sum(C * (d + 1 - last))
return last, score
def _update_score():
pass
@njit("(i8, i4[:], i4[:, :], i4[:], i8, )", cache=True)
def _ramdom_update(D, C, S, out, score):
d = np.random.randint(0, D)
q = np.random.randint(0, 26)
p = out[d]
out[d] = q
last, new_score = _compute_score1(D, C, S, out)
if score < new_score:
score = new_score
else:
out[d] = p
return out, score
def _random_swap():
pass
def step1(D, C, S):
out = []
LAST = 0
for d in range(D):
max_score = -10000000
best_i = 0
for i in range(26):
out.append(i)
last, score = _compute_score1(D, C, S, np.array(out, np.int32))
if max_score < score:
max_score = score
LAST = last
best_i = i
out.pop()
out.append(best_i)
return np.array(out), LAST, max_score
def step2(D, C, S, out, score):
for _ in range(10**4):
out.dtype = np.int32
out, score = _ramdom_update(D, C, S, out, score)
return out, score
def output(out):
out += 1
print("\n".join(out.astype(str).tolist()))
D, C, S = getInputs()
out, _, score = step1(D, C, S)
# print(score)
out, score = step2(D, C, S, out, score)
output(out)
# print(score)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s548942913 | Accepted | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
D = I()
c = [0] + LI()
s = [0] + [[0] + LI() for _ in range(D)]
last = [[0] * 27 for _ in range(D + 1)]
t = [0]
for i in range(1, D + 1):
r = 0
manzoku = 0
for j in range(1, 27):
m = s[i][j]
for k in range(1, 27):
if k != j:
m -= c[k] * (i - last[i - 1][k])
else:
continue
if j == 1:
r = 1
manzoku = m
else:
if manzoku < m:
manzoku = m
r = j
t.append(r)
for j in range(1, 27):
if j == r:
last[i][j] = i
else:
last[i][j] = last[i - 1][j]
dq = []
for i in range(1, D + 1, 7):
for j in range(1, 27):
dq.append([i, j])
from copy import deepcopy
for d, q in dq:
t0 = t[d]
last2 = deepcopy(last)
manzoku = s[d][q] - s[d][t0]
for j in range(d, D + 1):
if j == d:
last2[d][t0] = last2[d - 1][t0]
manzoku -= c[t0] * (d - last2[d][t0])
last2[d][q] = d
manzoku += c[q] * (d - last2[d - 1][q])
else:
if last2[j][t0] == d:
last2[j][t0] = last2[d - 1][t0]
manzoku -= c[t0] * (d - last2[d][t0])
if last2[j][q] == last2[d - 1][q]:
last2[j][q] = d
manzoku += c[q] * (d - last2[d - 1][q])
if manzoku > 0:
t[d] = q
last = last2
del t[0]
print(*t, sep="\n")
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s726374201 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | import random
D = int(input())
C = list(map(int, input().split()))
S = list(list(map(int, input().split())) for i in range(D))
manzoku = 0
yasumi = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
besttbl = []
for day in range(D):
yasumi = list(map(lambda x: x + 1, yasumi))
zouka = 0
for t in range(26):
if zouka < S[day][t] + C[t] * yasumi[t]:
zouka = S[day][t] + C[t] * yasumi[t]
best = t
manzoku += zouka
yasumi[best] = 0
besttbl.append(best + 1)
manman = manzoku
T = besttbl
for roop in range(20):
T[random.choice(range(D))] = random.choice(range(26))
manzoku = 0
yasumi = [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
]
for day in range(D):
yasumi = list(map(lambda x: x + 1, yasumi))
yasumi[T[day] - 1] = 0
manzoku += S[day][T[day] - 1]
for i in range(26):
manzoku -= C[i] * yasumi[i]
if manman < manzoku:
manman = manzoku
besttbl = T
print(besttbl)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s034851752 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | print("2")
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s664235354 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | for d in range(365):
print(d % 365 + 1)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s851988093 | Accepted | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | D = int(input()) # コンテの日数
c = list(map(int, input().split())) # 26タイプ(AAC~AZC)のコンテストの満足度低下度
s = [
list(map(int, input().split())) for _ in range(D)
] # s[d][i]...d(1<=d<=D)日目にi(1<=i<=26)番目のコンテストを行った時の満足度上昇
# types=[int(input()) for _ in range(D)] #コンテタイプ(1~26)
# 満足度低下はΣ(1<=i<=26)ci*(d-last(d,i)) #なおlast(d,i)=d日目以前に最後にタイプiのコンテストをやった日にち(ない場合0)
# よって満足度はs[d][i]-Σ(1<=i<=26)ci*(d-last(d,i))
# i日目のスコアはmax(10^6+s[d][i]-Σ(1<=i<=26)ci*(d-last(d,i)),0)
# last=[0]*26 #typeごとに、最後に使われた日にちを記録するよ
typ = 0
ans = 0
# greedyに最大とりまーす
for i in range(D):
print(i % 26 + 1)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s837261582 | Accepted | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | d = int(input())
c = list(map(int, input().split())) # scoreを減らす
s = [] # scoreを増やす
for i in range(d):
t = list(map(int, input().split()))
s.append(t)
last = [0] * 26 # それぞれのコンテストが最後に行われたのは何日目か
for i in range(1, d + 1): # 365日、1日目ならi=1
temp_best = -100000000
for j in range(26): # それぞれの日において、26個のコンテストを順番にピックアップ
temp = s[i - 1][j]
for k in range(26): # ピックアップされていないコンテストは、スコアを減らす
if j != k:
temp -= c[k] * (i - last[k])
if temp > temp_best:
temp_best = temp
rem = j
print(rem + 1)
last[rem] = i
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s666421978 | Accepted | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | from time import time
start_time = time()
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]
INF = float("inf")
DF = 7000
last = [0] * 26
cur_ans = []
nexts = []
for i, s in enumerate(S):
best_k = -1
best_score = -INF
scores = []
for k, s in enumerate(s):
score = s
for j, c in enumerate(C):
if j == k:
continue
score -= c * (i + 1 - last[j])
if score > best_score:
best_score = score
best_k = k
scores.append((score, k))
last[best_k] = i + 1
cur_ans.append(best_k + 1)
for sc, k in scores:
if k == best_k:
continue
if sc < best_score - DF:
continue
nexts.append((best_score - sc, i, k))
nexts.sort(key=lambda x: x[0])
def evaluate(ans):
last = [0] * 26
score = 0
for i, (s, a) in enumerate(zip(S, ans)):
score += s[a - 1]
last[a - 1] = i + 1
for j, c in enumerate(C):
score -= c * (i + 1 - last[j])
return score + 10**6
cur_score = evaluate(cur_ans)
selects = [-1] * D
for _, ni, nk in nexts:
if selects[ni] >= 0:
continue
last = [0] * 26
ans = []
for i, s in enumerate(S):
if selects[i] >= 0:
last[selects[i]] = i + 1
ans.append(selects[i] + 1)
continue
if i == ni:
last[nk] = i + 1
ans.append(nk + 1)
continue
best_k = -1
best_score = -INF
for k, s in enumerate(s):
score = s
for j, c in enumerate(C):
if j == k:
continue
score -= c * (i + 1 - last[j])
if score > best_score:
best_score = score
best_k = k
last[best_k] = i + 1
ans.append(best_k + 1)
sc = evaluate(ans)
if sc > cur_score:
cur_score = sc
cur_ans = ans
selects[ni] = nk
if time() - start_time > 1.9:
break
print(*cur_ans, sep="\n")
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at
day d. Print D integers t_d to Standard Output in the following format:
t_1
t_2
\vdots
t_D
Any output that does not follow the above format may result in ~~0
points~~**WA** for that test case. | s987004034 | Wrong Answer | p02618 | Input is given from Standard Input in the following format:
D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26} | # 貪欲法 + 山登り法 + スワップ操作
import time
s__ = time.time()
limit = 1.9
# limit = 10
from numba import njit
import numpy as np
d = int(input())
cs = list(map(int, input().split()))
cs = np.array(cs, dtype=np.int64)
sm = [list(map(int, input().split())) for _ in range(d)]
sm = np.array(sm, dtype=np.int64)
@njit("i8(i8[:], i8)", cache=True)
def total_satisfaction(ts, d):
ls = np.zeros(26, dtype=np.int64)
s = 0
for i in range(d):
t = ts[i]
t -= 1
s += sm[i][t]
ls[t] = i + 1
dv = cs * ((i + 1) - ls)
s -= dv.sum()
return s
@njit("i8[:]()", cache=True)
def greedy():
ts = np.array([0] * d, dtype=np.int64)
for i in range(d):
mx = -1e10
mxt = None
for t in range(1, 26 + 1):
ts[i] = t
s = total_satisfaction(ts, i + 1)
if s > mx:
mx = s
mxt = t
ts[i] = mxt
return ts
@njit("i8(i8, i8[:])", cache=True)
def loop(mxsc, ts):
it = 50
rds = np.random.randint(0, 4, (it,))
rdd = np.random.randint(1, d, (it,))
rdq = np.random.randint(1, 26, (it,))
rdx = np.random.randint(1, 12, (it,))
for i in range(it):
bk1 = 0
bk2 = 0
if rds[0] == 0:
# trailing
di = rdd[i]
qi = rdq[i]
bk1 = ts[di]
ts[di] = qi
else:
# swap
di = rdd[i]
xi = rdx[i]
if di + xi >= d:
xi = di - xi
else:
xi = xi + xi
bk1 = ts[di]
bk2 = ts[xi]
ts[di] = bk2
ts[xi] = bk1
sc = total_satisfaction(ts, d)
if sc > mxsc:
# print(mxsc, '->', sc)
mxsc = sc
else:
# 最大値を更新しなかったら戻す
if rds[0] == 0:
ts[di] = bk1
else:
ts[di] = bk1
ts[xi] = bk2
return mxsc
ts = greedy()
mxsc = total_satisfaction(ts, d)
mxbk = mxsc
s_ = time.time()
mxsc = loop(mxsc, ts)
e_ = time.time()
consume = s_ - s__
elapsed = e_ - s_
print("consume:", consume)
print("elapsed:", elapsed)
if consume < limit:
lp = int((limit - consume) / elapsed)
# print('loop', lp)
for _ in range(lp):
mxsc = loop(mxsc, ts)
for t in ts:
print(t)
# print(mxbk, mxsc)
# print(time.time() - s__)
| Statement
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the
number of users has grown, in order to meet the needs of more users, AtCoder
has decided to increase the number of contests to 26 types, from AAC to AZC.
For convenience, we number these 26 types as type 1 through type 26. AtCoder
wants to schedule contests for D days so that user satisfaction is as high as
possible. For every day, AtCoder will hold exactly one contest, and each
contest will end on that day. The satisfaction is calculated as follows.
* The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.
* Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.
* If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).
Please schedule contests on behalf of AtCoder. If the satisfaction at the end
of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test
cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your
submissions will be your score. | [{"input": "5\n 86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n 19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n 6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n 6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n 8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n 19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192", "output": "1\n 17\n 13\n 14\n 13\n \n\nNote that this example is a small one for checking the problem specification.\nIt does not satisfy the constraint D=365 and is never actually given as a test\ncase. The final satisfaction with this output is 79325, so the score is\n1079325.\n\nInput generator, score calculator, and visualizer"}] |
For the birthdate specified in each dataset, print in a line the number of
days from the birthdate, inclusive, to the millennium day, exclusive. Output
lines should not contain any character other than this number. | s211735732 | Accepted | p00760 | The input is formatted as follows.
> _n_
> _Y 1 M1 D1_
> _Y 2 M2 D2_
> ...
> _Y n Mn Dn_
Here, the first line gives the number of datasets as a positive integer _n_ ,
which is less than or equal to 100. It is followed by _n_ datasets. Each
dataset is formatted in a line and gives three positive integers, _Y i_ (<
1000), _M i_ (≤ 10), and _D i_ (≤ 20), that correspond to the year, month and
day, respectively, of a person's birthdate in the king's calendar. These three
numbers are separated by a space. | def get_no_days(day_str):
day_split = day_str.split(" ")
year = int(day_split[0])
month = int(day_split[1])
day = int(day_split[2])
result = 0
for y in range(1, year, 1):
if y % 3 != 0:
result += 195
else:
result += 200
year_not_mod_3 = year % 3 != 0
for m in range(1, month, 1):
if year_not_mod_3 and m % 2 == 0:
result += 19
else:
result += 20
result += day
return 196471 - result
total = int(input())
for i in range(total):
d = input()
print(str(get_no_days(d)))
| Millennium
A wise king declared a new calendar. "Tomorrow shall be the first day of the
calendar, that is, the day 1 of the month 1 of the year 1. Each year consists
of 10 months, from month 1 through month 10, and starts from a _big month_. A
common year shall start with a big month, followed by _small months_ and big
months one after another. Therefore the first month is a big month, the second
month is a small month, the third a big month, ..., and the 10th and last
month a small one. A big month consists of 20 days and a small month consists
of 19 days. However years which are multiples of three, that are year 3, year
6, year 9, and so on, shall consist of 10 big months and no small month."
Many years have passed since the calendar started to be used. For celebration
of the millennium day (the year 1000, month 1, day 1), a royal lottery is
going to be organized to send gifts to those who have lived as many days as
the number chosen by the lottery. Write a program that helps people calculate
the number of days since their birthdate to the millennium day. | [{"input": "1 1 1\n 344 3 1\n 696 5 1\n 182 9 5\n 998 8 7\n 344 2 19\n 696 4 19\n 999 10 20", "output": "128976\n 59710\n 160715\n 252\n 128977\n 59712\n 1"}] |
For the birthdate specified in each dataset, print in a line the number of
days from the birthdate, inclusive, to the millennium day, exclusive. Output
lines should not contain any character other than this number. | s444244673 | Accepted | p00760 | The input is formatted as follows.
> _n_
> _Y 1 M1 D1_
> _Y 2 M2 D2_
> ...
> _Y n Mn Dn_
Here, the first line gives the number of datasets as a positive integer _n_ ,
which is less than or equal to 100. It is followed by _n_ datasets. Each
dataset is formatted in a line and gives three positive integers, _Y i_ (<
1000), _M i_ (≤ 10), and _D i_ (≤ 20), that correspond to the year, month and
day, respectively, of a person's birthdate in the king's calendar. These three
numbers are separated by a space. | c = int(input())
a = [0]
for i in range(30):
if i % 2 == 0 or i >= 20:
a.append(a[i] + 20)
else:
a.append(a[i] + 19)
for i in range(c):
y, m, d = map(int, input().split())
b = int((y - 1) / 3) * 590 + a[m + ((y + 2) % 3) * 10 - 1] + d
print(196470 - b + 1)
| Millennium
A wise king declared a new calendar. "Tomorrow shall be the first day of the
calendar, that is, the day 1 of the month 1 of the year 1. Each year consists
of 10 months, from month 1 through month 10, and starts from a _big month_. A
common year shall start with a big month, followed by _small months_ and big
months one after another. Therefore the first month is a big month, the second
month is a small month, the third a big month, ..., and the 10th and last
month a small one. A big month consists of 20 days and a small month consists
of 19 days. However years which are multiples of three, that are year 3, year
6, year 9, and so on, shall consist of 10 big months and no small month."
Many years have passed since the calendar started to be used. For celebration
of the millennium day (the year 1000, month 1, day 1), a royal lottery is
going to be organized to send gifts to those who have lived as many days as
the number chosen by the lottery. Write a program that helps people calculate
the number of days since their birthdate to the millennium day. | [{"input": "1 1 1\n 344 3 1\n 696 5 1\n 182 9 5\n 998 8 7\n 344 2 19\n 696 4 19\n 999 10 20", "output": "128976\n 59710\n 160715\n 252\n 128977\n 59712\n 1"}] |
Print the product in a line. | s217539092 | Accepted | p02474 | Two integers $A$ and $B$ separated by a space character are given in a line. | a, b = input().split(" ")
print(int(a) * int(b))
| Multiplication of Big Integers
Given two integers $A$ and $B$, compute the product, $A \times B$. | [{"input": "5 8", "output": "40"}, {"input": "100 25", "output": "2500"}, {"input": "-1 0", "output": "0"}, {"input": "12 -3", "output": "-36"}] |
Print the product in a line. | s442238550 | Accepted | p02474 | Two integers $A$ and $B$ separated by a space character are given in a line. | print(eval(input().replace(*" *")))
| Multiplication of Big Integers
Given two integers $A$ and $B$, compute the product, $A \times B$. | [{"input": "5 8", "output": "40"}, {"input": "100 25", "output": "2500"}, {"input": "-1 0", "output": "0"}, {"input": "12 -3", "output": "-36"}] |
Print the product in a line. | s963956087 | Accepted | p02474 | Two integers $A$ and $B$ separated by a space character are given in a line. | if __name__ == "__main__":
a, b = list(map(lambda x: int(x), input().split()))
print(a * b)
| Multiplication of Big Integers
Given two integers $A$ and $B$, compute the product, $A \times B$. | [{"input": "5 8", "output": "40"}, {"input": "100 25", "output": "2500"}, {"input": "-1 0", "output": "0"}, {"input": "12 -3", "output": "-36"}] |
Print the factorial of n in a line. | s478979268 | Accepted | p00019 | An integer n (1 ≤ n ≤ 20) in a line. | number = int(input())
i = 1
product = 1
for i in range(1, number + 1):
product = product * i
print(product)
| Factorial
Write a program which reads an integer n and prints the factorial of n. You
can assume that n ≤ 20\. | [{"input": "", "output": "0"}] |
Print the factorial of n in a line. | s127706582 | Accepted | p00019 | An integer n (1 ≤ n ≤ 20) in a line. | s = int(input())
k = 1
for i in range(2, s + 1):
k *= i
print(k)
| Factorial
Write a program which reads an integer n and prints the factorial of n. You
can assume that n ≤ 20\. | [{"input": "", "output": "0"}] |
Print the factorial of n in a line. | s596875020 | Wrong Answer | p00019 | An integer n (1 ≤ n ≤ 20) in a line. | ret = 1
for i in range(2, int(input())):
ret *= i
print(ret)
| Factorial
Write a program which reads an integer n and prints the factorial of n. You
can assume that n ≤ 20\. | [{"input": "", "output": "0"}] |
Print the factorial of n in a line. | s348783967 | Accepted | p00019 | An integer n (1 ≤ n ≤ 20) in a line. | print(
[
"1",
"1",
"2",
"6",
"24",
"120",
"720",
"5040",
"40320",
"362880",
"3628800",
"39916800",
"479001600",
"6227020800",
"87178291200",
"1307674368000",
"20922789888000",
"355687428096000",
"6402373705728000",
"121645100408832000",
"2432902008176640000",
"51090942171709440000",
][int(input())]
)
| Factorial
Write a program which reads an integer n and prints the factorial of n. You
can assume that n ≤ 20\. | [{"input": "", "output": "0"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s664298455 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x, y, x2, y2 = map(int, input().split())
hen = (x2 - x) ** 2 + (y2 - y) ** 2
for x3 in range(-200, 200):
for y3 in range(-200, 200):
x4 = x + (x3 - x2)
y4 = y3 + (y - y2)
if (
hen == (x - x4) ** 2 + (y - y4) ** 2 == (x3 - x4) ** 2 + (y3 - y4) ** 2
and (x4 - x2) ** 2 + (y4 - y2) ** 2 == (x3 - x) ** 2 + (y3 - y) ** 2
):
print(x3, y3, x4, y4)
exit()
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s722643074 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1, y1, x2, y2 = map(int, input().split())
r = (x2 - x1) ** 2 + (y2 - y1) ** 2
for i in range(-200, 201):
for j in range(-200, 201):
if (x1 - i) ** 2 + (y1 - j) ** 2 == r and (x1 - i) * (x2 - x1) + (y1 - j) * (
y2 - y1
) == 0:
print(i + x2 - x1, j + y2 - y1, i, j)
exit()
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s366010450 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1, y1, x2, y2 = map(int, input().split())
def point_point_dist(xy1, xy2):
x1, y1 = xy1
x2, y2 = xy2
return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
d12 = point_point_dist((x1, y1), (x2, y2))
candidate = []
for x3 in range(-200, 201):
if x3 == x1 or x3 == x2:
continue
for y3 in range(-200, 201):
if y3 == x1 or y3 == x2:
continue
if point_point_dist((x2, y2), (x3, y3)) == d12:
candidate.append((x3, y3))
# print(candidate)
for xy3 in candidate:
x3, y3 = xy3
for x4 in range(-200, 201):
for y4 in range(-200, 201):
if (
point_point_dist((x4, y4), (x3, y3))
== point_point_dist((x4, y4), (x1, y1))
== d12
):
if point_point_dist((x1, y1), (x3, y3)) == point_point_dist(
(x2, y2), (x4, y4)
):
print(x3, y3, x4, y4)
exit()
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s399089244 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | import heapq
def solve():
x1, y1, x2, y2 = (int(i) for i in input().split())
que = []
que2 = []
for i in range(-300, 300):
for j in range(-300, 300):
if (x2 - x1) ** 2 + (y2 - y1) ** 2 == (i - x1) ** 2 + (j - y1) ** 2:
if (i, j) != (x1, y1) and (i, j) != (x2, y2):
que.append((i, j))
if (x2 - x1) ** 2 + (y2 - y1) ** 2 == (i - x2) ** 2 + (j - y2) ** 2:
if (i, j) != (x1, y1) and (i, j) != (x2, y2):
que2.append((i, j))
# define x3,y3
while que2:
(x3, y3) = heapq.heappop(que2)
for i in range(len(que)):
x4, y4 = que[i]
if (x3 - x2) ** 2 + (y3 - y2) ** 2 == (x4 - x1) ** 2 + (y4 - y1) ** 2:
if (x3 - x4) ** 2 + (y3 - y4) ** 2 == (x2 - x1) ** 2 + (y2 - y1) ** 2:
if (x3 - x1) ** 2 + (y3 - y1) ** 2 == (x2 - x4) ** 2 + (
y2 - y4
) ** 2:
print(x3, y3, x4, y4)
exit()
# print(que)
# print(que2)
solve()
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s864333449 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | import math
import copy
import sys
inputa = input().split()
# inputb = input().split()
# inputc = input().split()
# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])
# x = int(inputb[0])
# y = int(inputb[1])
inputaList = [int(n) for n in inputa]
# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
# inputNum = input().split()
# inputNumList = list(inputNum[0])
# inputList.append(inputNumList)
# inputList = [int(n) for n in inputList]
# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]
x1 = inputaList[0]
y1 = inputaList[1]
x2 = inputaList[2]
y2 = inputaList[3]
edgeDisx = x2 - x1
edgeDisy = y2 - y1
x3 = x2 - edgeDisy
y3 = y2 + edgeDisx
x4 = x1 - edgeDisy
y4 = y1 + edgeDisx
print(x3, y3, x4, y4)
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s274789347 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | import sys
def main():
input = sys.stdin.readline
x1, y1, x2, y2 = map(int, input().split())
x4 = -(y2 - y1) + x1
y4 = (x2 - x1) + y1
x3 = x2 + x4 - x1
y3 = y2 + y4 - y1
print('{} {} {} {}'.format(x3, y3, x4, y4)
if __name__ == '__main__':
main() | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s376969996 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | a,b,c,d=map(int,input().split())
e=c-a
f=d-b
g=c-f
h=d+e
i=g-e
j=h-f
print(int(g) int(h) int(i) int(j)) | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s971616572 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | k = int(input())
print((k//2)*((k+1)//2)
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s074174588 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1,y1,x2,y2=map(int,input().split())
dx=x1-x2
dy=y1-y2
x3=x2+dy
y3=y2-dx
x4=x1+dy
y4=y1-dx
ans=[x3,y3,x4,y4]
print("".join(list(map(str,ans))) | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s295379925 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1, y1, x2, y2 = map(int, input().rstrip().split())
xx = x2 - x1
yy = abs(y2 - y1)
print(x2 - yy, y2 + xx, end=" ")
print(x2 - yy - xx, y2 + xx - yy)
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s532672533 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | l = list(map(int, input().split()))
print(l[1] + l[2] - l[3], end=" "),
print(l[3] + l[1] - l[0], end=" "),
print(l[2] - l[3] + l[0], end=" "),
print(l[1] - l[0] + l[2], end=" ")
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s331506026 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter # itemgetter(1), itemgetter('key')
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict # subclass of dict. defaultdict(facroty)
# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate # accumulate(iter[, f])
# from functools import reduce # reduce(f, iter[, init])
# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy # to copy multi-dimentional matrix without reference
# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)
def main():
mod = 1000000007 # 10^9+7
inf = float("inf") # sys.float_info.max = 1.79...e+308
# inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19
sys.setrecursionlimit(10**6) # 1000 -> 1000000
def input():
return sys.stdin.readline().rstrip()
def ii():
return int(input())
def mi():
return map(int, input().split())
def mi_0():
return map(lambda x: int(x) - 1, input().split())
def lmi():
return list(map(int, input().split()))
def lmi_0():
return list(map(lambda x: int(x) - 1, input().split()))
def li():
return list(input())
x1, y1, x2, y2 = mi()
vec = (x2 - x1, y2 - y1)
vec2 = (-vec[1], vec[0])
vec3 = (-vec2[1], vec2[0])
x3, y3 = x2 + vec2[0], y2 + vec2[1]
x4, y4 = x3 + vec3[0], y3 + vec3[1]
print("{} {} {} {}".format(x3, y3, x4, y4))
if __name__ == "__main__":
main()
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s857316270 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | 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 + (D - B)
G = A + (B - D)
H = B + (D - B)
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
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s487593617 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | import sys
# 関数 solve は,もちろん,問題に応じて書き換える
def solve(a,b,c,d):
x = c-a
y = d-b
x3 = 0
x4 = 0
y3 = 0
y4 = 0
#print(x,y)
x3 = c-y
y3 = d+x
x4 = x3-x
y4 = y3-y
return x3,x4,y3,y4
# ここから下は,入力・出力形式が同じであれば,変えなくて良い.
def readQuestion():
line = sys.stdin.readline().rstrip()
[str_a, str_b, str_c, str_d] = line.split(' ')
return (int(str_a), int(str_b), int(str_c)), int(str_d))
def main():
a, b, c, d = readQuestion()
answer = solve(a, b, c, d)
print(answer)
if __name__ == '__main__':
main() | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s811397613 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | nums = [int(num) for num in input().split()]
x1 = nums[0]
y1 = nums[1]
x2 = nums[2]
y2 = nums[3]
print(x2 - (y2 - y1), y2 + (x2 - x1), x1 - (y2 - y1), y1 + (x2 - x1))
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s510502521 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | A, B, C, D = map(int, input().split())
def solve(A, B, C, D):
dx, dy = C - A, D - B
x, y = C - dy, D + dx
ans = [x, y]
x, y = x - dx, y - dy
ans += [x, y]
return ans
print(*solve(A, B, C, D), sep=" ")
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s496610767 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1,y1,x2,y2 = map(int,int(input().split())
h = max(abs(x2-x1),abs(y2-y1))
v = min(abs(x2-x1),abs(y2-y1))
if x1 > x2:
if y1 > y2: print(x2+h,y2-v,x1+h,y1-v)
else:print(x2-v,y2-h,x1-v,y1-h)
else:
if y1 > y2: print(x2+v,y2+h,x1+v,y1+h)
else:print(x2-h,y2+v,x1-h,y1+v) | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s127403913 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | #include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
int main(){
int a,b,c,d;
cin >> a >> b >> c >> d;
cout << c-(d-b) << " " << d+(c-a) << " " << a-(d-b) << " " << b+(c-a) << endl;
return 0;
} | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s764852728 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | import sys
# 関数 solve は,もちろん,問題に応じて書き換える
def solve(a,b,c,d):
x = c-a
y = d-b
x3 = 0
x4 = 0
y3 = 0
y4 = 0
#print(x,y)
x3 = c-y
y3 = d+x
x4 = x3-x
y4 = y3-y
return x3,x4,y3,y4
# ここから下は,入力・出力形式が同じであれば,変えなくて良い.
def readQuestion():
line = sys.stdin.readline().rstrip()
[str_a, str_b, str_c, str_d] = line.split(' ')
return (int(str_a), int(str_b), int(str_c)), int(str_d))
def main():
a, b, c = readQuestion()
answer = solve(a, b, c, d)
print(answer)
if __name__ == '__main__':
main() | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s946649608 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | fun main(args:Array<String>){
val input = readLine()!!.split(" ")
val x1 = input[0].toInt()
val y1 = input[1].toInt()
val x2 = input[2].toInt()
val y2 = input[3].toInt()
println("${x2-(y2-y1)} ${y2+(x2-x1)} ${x1-(y2-y1)} ${y1+(x2-x1)}")
} | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s946527924 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x, y, s, t = map(int, input().split())
a = s + y - t
b = s + t - x
c = x + y - t
d = s + y - x
print(a, b, c, d)
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s216838122 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | o
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s999642489 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | a,b,c,d=map(int,input().split())
e=c-a
f=d-b
g=c-f
h=d+e
i=g-e
j=h-f
print(g h i j) | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s276099170 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1,y1,x2,y2 = map(int,input().split())
d1 = abs(x2-x1)
d2 = abs(y2-y1)
x3 = x2 + d2
y3 = y2 + d1
x4 = x1 + d1
y4 = y1 + d2
print(x3 y3 x4 y4)
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s865675867 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | %%test_input https://abc108.contest.atcoder.jp/tasks/abc108_b
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1
x3, y3 = x2 - dy, y2 + dx
x4, y4 = x3 - dx, y3 - dy
print('{} {} {} {}'.format(x3, y3, x4, y4)) | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s887312872 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x(1),y(1),x(2),y(2)=map(int,input().split())
for i in range(3,5):
x(i)=x(i-1)+y(i-2)-y(i-1)
y(i)=y(i-1)+x(i-1)-x(i-2)
print(x(3) y(3) x(4) y(4))
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s982868092 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1, y1, x2, y2 = map(int, input().split())
d1 = abs(x2 - x1)
d2 = abs(y2 - y1)
x3 = x2 + d2
y3 = y2 + d1
x4 = x1 + d1
y4 = y1 + d2
print(str("x3 y3 x4 y4"))
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s975232529 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | z = list(map(int, input().split()))
z.append(z[2] + z[1] - z[3]) # z[4](x_3)を生成
z.append(z[3] - z[0] + z[2]) # z[5](y_3)を生成
z.append(z[4] + z[3] - z[5]) # z[6](x_4)を生成
z.append(z[5] - z[2] + z[4]) # z[7](y_4)を生成
print(z[4], z[5], z[6], z[7])
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s006068153 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1, y1, x2, y2 = map(int, input().split())
if x1 <= x2:
X = x2 - x1
if y1 <= y2:
Y = y2 - y1
print("{} {} {} {}".format(x2 - Y, y2 + X, x1 - Y, y1 + X))
else:
Y = y1 - y2
print("{} {} {} {}".format(x2 + Y, y2 + X, x1 + Y, y1 + X))
else:
X = x1 - x2
if y1 <= y2:
Y = y2 - y1
print("{} {} {} {}".format(x2 - Y, y2 - X, x1 - Y, y1 - X))
else:
Y = y1 - y2
print("{} {} {} {}".format(x2 + Y, y2 - X, x1 + Y, y1 - X))
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s306672024 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | import sys
input = sys.stdin.readline
def read():
x1, y1, x2, y2 = map(int, input().strip().split())
return x1, y1, x2, y2
def solve(x1, y1, x2, y2):
v12 = (x2 - x1, y2 - y1)
v34 = (-x2 + x1, -y2 + y1)
v23 = (-y2 + y1, x2 - x1)
x3, y3 = x2 + v23[0], y2 + v23[1]
x4, y4 = x3 + v34[0], y3 + v34[1]
return "%d %d %d %d" % (x3, y3, x4, y4)
if __name__ == "__main__":
inputs = read()
outputs = solve(*inputs)
if outputs is not None:
print("%s" % str(outputs))
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s011350675 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | points = list(map(int, input().split(" ")))
point1 = {"x": points[0], "y": points[1]}
point2 = {"x": points[2], "y": points[3]}
delta_x = point2["x"] - point1["x"]
delta_y = point2["y"] - point1["y"]
point3 = {"x": point2["x"] - delta_y, "y": point2["y"] - (-delta_x)}
delta_x = point3["x"] - point2["x"]
delta_y = point3["y"] - point2["y"]
point4 = {"x": point3["x"] - delta_y, "y": point3["y"] - (-delta_x)}
print(point3["x"], point3["y"], point4["x"], point4["y"])
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s659987669 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | a1, b1, a2, b2 = map(int, input().split())
c = a2 - a1
d = b2 - b1
e = -d
f = c
a3 = a2 + e
b3 = b2 + f
a4 = a3 - c
b4 = b3 - d
print(a3, b3, a4, b4)
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s188443422 | Runtime Error | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1, y1, x2, y2 = map(int, input().split())
y3 = y2 + x2- x1
y4 = x2 - x1 + y1
x3 = y1 - y2 + x2
x4 = y1 - y2 + x1
print(x3 y3 x4 y4) | Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s144244315 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | N = list(map(int, input().split()))
x = N[2] - N[0]
y = N[3] - N[1]
for i in range(0, 3, 2):
N[i] -= y
N[i + 1] += x
print(N[2], end=" ")
print(N[3], end=" ")
print(N[0], end=" ")
print(N[1], end=" ")
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s800047944 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | X = list(map(int, input().split(" ")))
A = [X[1] + X[2] - X[3], -X[0] + X[2] + X[3], X[0] + X[1] - X[3], -X[0] + X[1] + X[2]]
print(
str(X[1] + X[2] - X[3])
+ " "
+ str(-X[0] + X[2] + X[3])
+ " "
+ str(X[0] + X[1] - X[3])
+ " "
+ str(-X[0] + X[1] + X[2])
)
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s301821736 | Accepted | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | z = [int(i) for i in input().split()]
x = z[2] - z[0]
y = z[3] - z[1]
x_3 = [z[2] - y, z[3] + x]
x_4 = [x_3[0] - x, x_3[1] - y]
square = x_3 + x_4
for i in square:
print(i, end=" ")
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print x_3,y_3,x_4 and y_4 as integers, in this order.
* * * | s839004789 | Wrong Answer | p03265 | Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2 | x1, y1, x2, y2 = map(int, input().split())
vx = x2 - x1
vy = y2 - y1
tmp = vx
vx = -vy
vy = tmp
x3 = x2 + vx
y3 = x2 + vy
vx = x3 - x2
vy = y3 - y2
tmp = vx
vx = -vy
vy = tmp
x4 = x3 + vx
y4 = y3 + vy
print(str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4))
| Statement
There is a square in the xy-plane. The coordinates of its four vertices are
(x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points
up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and
(x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that
x_3,y_3,x_4 and y_4 uniquely exist and have integer values. | [{"input": "0 0 0 1", "output": "-1 1 -1 0\n \n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-\nclockwise order. Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as\nthe vertices are in clockwise order.\n\n* * *"}, {"input": "2 3 6 6", "output": "3 10 -1 7\n \n\n* * *"}, {"input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}] |
Print the number of blocks in K-city.
* * * | s194159851 | Accepted | p03635 | Input is given from Standard Input in the following format:
n m | tmp = input().split(" ")
print((int(tmp[0]) - 1) * (int(tmp[1]) - 1))
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s782732851 | Accepted | p03635 | Input is given from Standard Input in the following format:
n m | nums = list(map(int, input().split()))
print((nums[0] - 1) * (nums[1] - 1))
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s545371217 | Accepted | p03635 | Input is given from Standard Input in the following format:
n m | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(map(list, sys.stdin.readline().split()))
def S():
return list(sys.stdin.readline())[:-1]
def IR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = I()
return l
def LIR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = LI()
return l
def SR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = S()
return l
def LSR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = SR()
return l
mod = 1000000007
# A
n, m = LI()
print((n - 1) * (m - 1))
# B
# C
"""
n = I()
a = LI()
d = [0,0]
for i in a:
if i%2:
d[0] += 1
if i%4 == 0:
d[1] += 1
if n % 2:
d[0] -= 1
d[0] -= d[1]
if d[0] <= 0:
print("Yes")
else:
print("No")
"""
# D
"""
h,w = LI()
n = I()
a = LI()
c = [[None for x in range(w)] for y in range(h)]
i = 0
for y in range(h):
if y%2:
for x in range(w)[::-1]:
if not a[i]:
i += 1
c[y][x] = i+1
a[i] -= 1
else:
for x in range(w):
if not a[i]:
i += 1
c[y][x] = i+1
a[i] -= 1
for i in c:
print(*i)
"""
# E
# F
# G
# H
# I
# J
# K
# L
# M
# N
# O
# P
# Q
# R
# S
# T
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s575344480 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
input = sys.stdin.readline
inf = float("inf")
mod = 10**9 + 7
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 [input() 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():
H, W = MI()
N = I()
A = [(int(a), i) for i, a in enumerate(input().split(), start=1)]
A.sort()
stack = []
for a, i in A:
stack.extend([i] * a)
ans = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
c = stack.pop()
if i % 2 == 0:
ans[i][j] = c
else:
ans[i][W - 1 - j] = c
for a in ans:
print(*a)
if __name__ == "__main__":
main()
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s653289220 | Wrong Answer | p03635 | Input is given from Standard Input in the following format:
n m | def blocks(n, m):
n = int(n)
m = int(m)
print(n * m)
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s521808195 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | a, b = map(int, input().split(" ''))
print((a-1) * (b-1))
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s698231730 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | n, m = = map(int, input().split())
print((n-1)*(m-1)) | Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s262453810 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | input(sum([int(x) - 1 for x in input().split()]))
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s732391010 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | aaa
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s582946981 | Accepted | p03635 | Input is given from Standard Input in the following format:
n m | a = input().split()
b = int(a[0])
c = int(a[1])
b = b - 1
c = c - 1
print(b * c)
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s957561000 | Wrong Answer | p03635 | Input is given from Standard Input in the following format:
n m | a, *b, c = map(str, input())
print(a + str(len(b)) + c)
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s179556309 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
i = 0
s = ["" for j in range(H)]
for y in range(H):
for x in range(W):
if x != 0:
s[y] = s[y] + " "
s[y] = s[y] + str(i + 1)
a[i] = a[i] - 1
if a[i] == 0:
i = i + 1
if y % 2 == 0:
print(s[y])
else:
print(" ".join(s[y].split()[::-1]))
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s637359816 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | from sys import stdin
input = stdin.readline
def BFS(K, path, N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
import queue
dist = [-1] * N
dist[K] = 0
que = queue.Queue()
que.put(K)
while que.qsize():
label = que.get()
for i, c in path[label]:
if dist[i] == -1:
dist[i] = dist[label] + c
que.put(i)
return dist
N = int(input())
path = [[] for i in range(N)]
for i in range(N - 1):
a, b, c = map(int, input().split())
path[a - 1] += [(b - 1, c)]
path[b - 1] += [(a - 1, c)]
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(Q)]
distance = BFS(K - 1, path, N)
for i in range(Q):
print(distance[xy[i][0] - 1] + distance[xy[i][1] - 1])
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s900455515 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | H, W = [int(x) for x in input().split()]
N = int(input())
a = [int(x) for x in input().split()]
s = ""
for i in range(N):
s = s + str(i + 1) * a[i]
for l in range(H):
if l % 2 == 0:
print(" ".join(s[W * l : W * (l + 1)]))
else:
print(" ".join(s[W * l : W * (l + 1)][::-1]))
| Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s167998144 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | print(eval('('+input().replace(' ','-1)*(')+('-1)')) | Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Print the number of blocks in K-city.
* * * | s572376908 | Runtime Error | p03635 | Input is given from Standard Input in the following format:
n m | n, m = map(int(input().split())
print((n-1)*(m-1)) | Statement
In _K-city_ , there are n streets running east-west, and m streets running
north-south. Each street running east-west and each street running north-south
cross each other. We will call the smallest area that is surrounded by four
streets a block. How many blocks there are in K-city? | [{"input": "3 4", "output": "6\n \n\nThere are six blocks, as shown below:\n\n\n\n* * *"}, {"input": "2 2", "output": "1\n \n\nThere are one block, as shown below:\n\n"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.