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 there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s635535267
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().split())
for c in range(1, 4):
if a*b*c%2 == 1:
print('Yes')
break
else:
print('No')
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s159416062
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A=list(map(int,input().split()))
sum=1
for i in A:
sum*=i
if sum%2=1:
print('Yes')
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s126735245
|
Accepted
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("Yes" if eval(input().replace(" ", "*")) % 2 else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s801136855
|
Accepted
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("Yes" if "2" not in input().split() else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s174230532
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("Yes" if (int(input()) + int(input())) % 2 == 0 else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s004812008
|
Wrong Answer
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("NO" if eval(input().replace(" ", "+")) % 2 == 0 else "YES")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s421568412
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b,c = map(int, input().split())
if a % 2 == 1 && b % 2 == 1:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s827624444
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
#
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A):
for a in A: print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
H,W=MI()
A=LLIN(H)
odds=[]
ans=[]
for i in range(H):
if i&1:
for j in range(W)[::-1]:
if A[i][j]&1:
if j==0:
dy=1
dx=0
else:
dy=0
dx=-1
if i+dy!=H:
ans.append((i+1,j+1,i+dy+1,j+dx+1))
A[i+dy][j+dx]+=1
else:
for j in range(W)[::-1]:
if A[i][j]&1:
if j==W-1:
dy=1
dx=0
else:
dy=0
dx=1
if i+dy!=H:
ans.append((i+1,j+1,i+dy+1,j+dx+1))
A[i+dy][j+dx]+=1
print(len(ans))
for a in ans:
print(*a)
if __name__ == '__main__':
main
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s720571087
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
h, w = map(int, input().split())
c = [list(map(int, input().split())) for i in range(h)]
ans = []
for i in range(h):
for j in range(w):
if c[i][j] % 2 == 1:
if i < h - 1:
ans.append((i, j, i + 1, j))
c[i + 1][j] += 1
elif j < w - 1:
ans.append((i, j, i, j + 1))
c[i][j + 1] += 1
print(len(ans))
for a in ans:
print(" ".join(map(str, a)))
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s315177969
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
import math
num=int(input())
a,b=num.split()
if a%2==0 and b%2==0:
print("Yes")
else
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s763074880
|
Accepted
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print(" YNeos"[eval(input().replace(" ", "*")) % 2 :: 2])
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s882094856
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A,B(int input())
if (A * B % 2):
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s271851211
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("Yes" if i%2==1 for i in [map(int, input().split())] else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s769044156
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
return input() * input() % 2
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s751038645
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b=map(int,input().split())
if a*b%2=1:
print(Yes)
else:
print(No)
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s716550620
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A, B = map(int, input().split())
if A * B % 2
print("Yes")
else
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s152171243
|
Wrong Answer
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
#! /usr/bin/python
print("Yes" if sum(map(int, input().split())) % 2 == 1 else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s400585925
|
Wrong Answer
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("YES" if all(int(i) % 2 for i in input().split()) else "NO")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s589258480
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("Yes" if (int(input()) * int(input())) % 2 != 0 else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s687805417
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b=map(int,input().split())
if a*b%2=1:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s780067505
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
Print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s710979821
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(nit, input().split())
print("Yes") if a * b % 2 == 1 else print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s299560678
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
t = map(int, input().split())
if t[0]*t[1] % 2 == 0:
print("No")
else:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s139772956
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A,B=map(int,input().split())
if (A==2 or B==2:
print("No")
else:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s428067487
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a=map(int,input().split())
if a[0]!=2 and a[1]!=2:
print("Yes")
else:
print("No)
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s915447169
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b=map(int,input().split())
if a%2==0 or b%==0:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s121678723
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a , b = map(int, input().split())
if (a * b %% 2 == 1) :
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s221809228
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b = map(int, input().split())
if (a*b)%2 = 1:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s952104513
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A,B = int(input().split())
if (A*B*C) % 2 != 0 and 1=<C=<3;
print(Yes)
else ;
print(No)
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s185892084
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
nums = map(int, input().split())
if nums[0] * nums[1] % 2:
return "Yes"
return "No"
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s485480368
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A, B=map(int, input(). split())
if (A*B)%2==1:
print(“Yes”)
else:
print(“No”)
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s324682338
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
/* converted by scratch2cpp (https://github.com/yos1up/scratch2cpp)
This script is compatible with the following compilers:
- GCC (unless every name of variables contains non-ascii characters)
- Clang
*/
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#define debug cerr << "--" << __LINE__ << "--" << "\n"
using namespace std;
const double EPS = 1e-8;
static int roundToInt(double x){
return (x < 0) ? -(int)(-x + 0.5) : (int)(x + 0.5);
}
class Var{
public:
string sval;
double dval;
enum VarType {STRING = 0, NUMBER = 1};
VarType type;
enum NumericState {UNKNOWN = -1, STRINGY = 0, NUMERIC = 1};
mutable NumericState numericState;
Var(){sval = ""; type = STRING; numericState = STRINGY;} // represent null?
Var(string s){
sval = s; type = STRING; numericState = UNKNOWN;
}
Var(double d){dval = d; type = NUMBER; numericState = NUMERIC;}
Var(const Var &v){
sval = string(v.sval); dval = v.dval;
type = v.type; numericState = v.numericState;
}
static bool isNumericString(const string &s) {
char* ep;
strtod(s.c_str(), &ep);
return !ep || !*ep;
// TODO: In Scratch '000' is regarded as non-numeric (but here regarded as numeric)
}
bool isNumeric() const{
if (type == NUMBER) return true;
if (numericState != UNKNOWN) return numericState == NUMERIC;
bool numeric = isNumericString(sval);
numericState = (numeric) ? NUMERIC : STRINGY;
return numeric;
}
double asNumber() const{
if (type == NUMBER) return dval;
return (isNumeric()) ? atof(sval.c_str()) : 0.0;
}
static bool isNearInteger(const double &x){
return fabs(round(x) - x) < EPS;
// TODO: allow integer type in Var class
}
static bool isNearNumber(const double &x, const double &y){
return fabs(x - y) < EPS;
}
string asString() const{
if (type == STRING) return sval;
if (isNearInteger(dval)) return to_string(roundToInt(dval));
return to_string(dval);
}
Var operator+(const Var &y) const{
return Var(this->asNumber() + y.asNumber());
}
Var operator+=(const Var &y){
*this = *this + y;
return *this;
}
Var operator-(const Var &y) const{
return Var(this->asNumber() - y.asNumber());
}
Var operator*(const Var &y) const{
return Var(this->asNumber() * y.asNumber());
}
Var operator/(const Var &y) const{
return Var(this->asNumber() / y.asNumber());
}
Var operator%(const Var &y) const{
return Var(fmod(this->asNumber(), y.asNumber()));
}
bool operator<(const Var &y) const{
if (this->isNumeric() && y.isNumeric()){
return this->asNumber() < y.asNumber();
}// compare as number if both can be interpreted as numeric
return this->asString() < y.asString();
}
bool operator>(const Var &y) const{
return y < *this;
}
bool operator==(const Var &y) const{
if (this->isNumeric() && y.isNumeric()){
return this->asNumber() == y.asNumber();
}// compare as numeric if both are numeric
return this->asString() == y.asString();
}
friend ostream& operator << (ostream& os, const Var& p);
friend istream& operator >> (istream& is, const Var& p);
};
ostream& operator << (ostream& os, const Var& p){
os << p.asString();
return os;
}
istream& operator >> (istream& is, Var& p){
string s; is >> s; p = Var(s);
return is;
}
Var letterOf(Var index, Var sourceString){
/* index: 1-origined */
string str = sourceString.asString();
int idx = (int)(index.asNumber() - 1);
// seem to be dirty but Scratch seems to do like this.
// ex. letterOf(0.01, "world") == "w", letterOf(1.99, "world") == "w", letterOf(5.99, "world") == "d"
if (0 <= idx && idx < str.size()) return Var(str.substr(idx, 1));
return Var();
}
// TODO: should we make a new class for vector<Var>?
Var getLineOfList(const Var &index, const vector<Var> &list){
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
// (unlike 'letterOf', index==0.9 does not work.)
if (0 <= idx && idx < list.size()) return list[idx];
return Var();
}
void setLineOfListTo(const Var &index, vector<Var> &list, const Var &v){
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < list.size()) list[idx] = v;
}
void deleteLineOfList(const Var &index, vector<Var> &list){
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < list.size()) list.erase(list.begin() + idx);
}
void insertAtIndexOfList(const Var &item, const Var &index, vector<Var> &list){
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx <= list.size()) list.insert(list.begin() + idx, item);
}
void insertAtRandomOfList(const Var &item, vector<Var> &list){
int idx = rand() % (list.size() + 1);
list.insert(list.begin() + idx, item);
}
Var contentsOfList(const vector<Var> &list){
/* concatenate elements of list with space */
string ret;
for(int i=0;i<list.size();i++){
if (i > 0) ret += ' ';
ret += list[i].asString();
}
return Var(ret);
}
double randUniform(double x, double y){
if (x > y) return randUniform(y, x);
if (Var::isNearInteger(x) && Var::isNearInteger(y)){
int xi = roundToInt(x), yi = roundToInt(y);
return xi + rand() % (yi - xi + 1);
}else{
return x + (y - x) * (0.0 + rand()) / RAND_MAX;
}
}
Var buf_answer; // for "answer"
// ============================= Scripts =============================
Var var_a(0);
Var var_b(0);
Var var_c(0);
Var var_ans(0);
// prototype declaration
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s475241922
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
aimport sys
def main():
input = sys.stdin.readline
a, b = map(int, input().split())
if (a % 2 == 1) and (b % 2 == 1):
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s864956708
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
count, init = tuple(map(int, input().split(" ")))
Xs = [init] + list(map(int, input().split(" ")))
l = [abs(Xs[i] - Xs[i + 1]) for i in range(count)]
for i in range(2, min(l) + 1)[::-1]:
if max(map(lambda x: x % i, l)) == 0:
print(i)
exit(0)
print(1)
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s715130727
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
#abc109 a
a,b=map(int,input().split())
flag=False
for c in range(1,4):
x=a*b*c
if x%2==1:
flag=True
break
if flag:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s100532796
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A, B = map(int, input().split())
judge=0
for i in range(1,4):
if (j+k+i)*2==1:
judge=1
if judge==1:
print ("Yes")
else:
print ("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s228356422
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int,input().split())
c for i in range(3)
if (a+b)+ i == 0:
print("No")
else:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s799288586
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b=map(int,input().split())
if a==2 or b==2:
print('No')
else:
print('Yes')
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s319120801
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A, B = map(int, input().split())
int C
if A == 2 or B == 2:
print("No")
elif C == 1 or C == 3:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s526171034
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().split())]
if a & 1 and b & 1:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s571203356
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A, B = [int(i) for i in input().split()]
int C
if A == 2 or B == 2:
print("No")
elif C == 1 or C ==3:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s886587627
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
if (A = 2) or (B = 2):
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s235730093
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().split())
if a%2 == 1 .and. b%2 == 1:
print('Yes')
else:
print('No')
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s681181422
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A,B = map(int,input().split())
X = A * B
if X % == 0:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s617708924
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
int A, B, C
A = input()
B = input()
if A == 2 or B == 2:
print("No")
elif C == 1 or C ==3:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s559201864
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = (int(i) for i in input().split())
if a % 2 == 0 && b % 2 == 0:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s546150287
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
input(x);
a, b = map(int, split(x));
if (a%2 == 1) && (b%2 == 1):
print("Yes");
else:
print("No");
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s903895011
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
judge=0
j,k=A,B
for i in range(1,4):
if (j+k+i)*2==1:
judge=1
if judge==1:
print ("Yes")
else:
print ("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s125988060
|
Wrong Answer
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A, B = map(int, input().rstrip().split())
print("Yes" if A % 2 == 0 and B % 2 == 0 else "Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s745373989
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
t = map(int, input().split())
if t[0]*t[1] % 2 == 0:
print("No")
else:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s851460884
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().split())
2.if a * b % 2 == 0:
3. print('No')
4.else:
5. print('Yes')
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s692463911
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b = map(int, input().split())
if (a*b=1) or (a*b=3):
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s673799064
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
int i, t
A, B = int(input(i, t))
int C
if A == 2 or B == 2:
print("No")
elif C == 1 or C == 3:
print("Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s970629501
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
list1 = list(map(int, input().split()))
h = list1[0]
w = list1[1]
a = list()
i = 0
n = 0
ans = list()
while i <= h - 1:
a.append(list(map(int, input().split())))
i += 1
for i in range(h):
for j in range(w - 1):
if a[i][j] % 2 != 0:
a[i][j] -= 1
a[i][j + 1] += 1
n += 1
ans.append([i + 1, j + 1, i + 1, j + 2])
for i in range(h - 1):
if a[i][w - 1] % 2 != 0:
a[i][w - 1] -= 1
a[i + 1][w - 1] += 1
ans.append([i + 1, w, i + 2, w])
n += 1
print(n)
for i in range(n):
print(ans[i][0], ans[i][1], ans[i][2], ans[i][3])
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s938380558
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
(H, W) = map(int, input().split())
a = []
for i in range(H):
a.append(list(map(int, input().split())))
# print("a: ")
# print(a)
odd_flag = []
for i in range(len(a)):
odd_flag.append(list())
for j in range(len(a[i])):
if a[i][j] % 2 != 0:
odd_flag[i].append(True)
else:
odd_flag[i].append(False)
# print("odd_flag: ")
# print(odd_flag)
odd_sum = 0
for i in range(len(odd_flag)):
odd_sum += odd_flag[i].count(True)
# print(odd_sum)
s_h = 0
s_w = 0
move_flag = False
def move(h, w):
if h % 2 == 0:
if w == W - 1:
return (h + 1, w)
else:
return (h, w + 1)
else:
if w == 0:
return (h + 1, w)
else:
return (h, w - 1)
N = 0
ans = ""
while odd_sum >= 2:
# 移動先到着
if move_flag is True and odd_flag[s_h][s_w] is True:
move_flag = False
(s_h, s_w) = move(s_h, s_w)
odd_sum -= 2
N += 1
# 移動中
elif move_flag is True and odd_flag[s_h][s_w] is False:
ans += str(s_h + 1) + " " + str(s_w + 1) + " "
(s_h, s_w) = move(s_h, s_w)
ans += str(s_h + 1) + " " + str(s_w + 1) + "\n"
# 移動すべきものなし
elif move_flag is False and odd_flag[s_h][s_w] is False:
(s_h, s_w) = move(s_h, s_w)
# 移動元到着
elif move_flag is False and odd_flag[s_h][s_w] is True:
move_flag = True
ans += str(s_h + 1) + " " + str(s_w + 1) + " "
(s_h, s_w) = move(s_h, s_w)
ans += str(s_h + 1) + " " + str(s_w + 1) + "\n"
print(N)
# print(ans[0:-1])
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s486446152
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int(input()))
if a%2 == 1:
if b%2 == 1:
print("Yes")
else:
print("No")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s461177436
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
A, B=map(int, input(). split())
if A%2==1 and B%2==1:
print(“Yes”)
else:
print(“No”)
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s784856757
|
Accepted
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("Yes" if eval(input().replace(" ", "*")) % 2 == 1 else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s139451199
|
Accepted
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().rstrip().split())
print("Yes" if (a * b) % 2 else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s435672875
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("YNeos"[eval(input().replace(" ", "*") % 2 == 0) :: 2])
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s528798746
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, s, c = int(input())
print(["No", "Yes"][a * c % 2])
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s319781771
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
input(A,B)
x=A*B
if x%2==0:
return 'Yes'
else:
returun 'No'
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s890466894
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("No" * "2" in input() or "Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s068640909
|
Wrong Answer
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = [int(a) for a in input().split()]
print("Yes" if a * b % 2 == 0 else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s200546734
|
Wrong Answer
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
print("Yes" if 3 in [int(x) for x in input().split()] else "No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s819232627
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().split())
if (a*b) % 2 == 1:
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s842300223
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,s=map(int,input().split())
if a!=2 and s!=2!:
print('YES')
else:
print('NO')
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s020362997
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a,b=map(int,input().split())
ans=false
for i in range(1,4):
if a*b*c %2 ==1:
ans=True
break
if ans;print("Yes")
else:print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s616000758
|
Accepted
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
data = [int(i) for i in input().split(" ")]
print("No" if (data[0] * data[1]) % 2 == 0 else "Yes")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s974672930
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().split())
if a % 2 == 0 or b % 2 == 0:
print('No')
else:
print('Yes)
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
If there is an integer C between 1 and 3 that satisfies the condition, print
`Yes`; otherwise, print `No`.
* * *
|
s666666083
|
Runtime Error
|
p03260
|
Input is given from Standard Input in the following format:
A B
|
list = list(map(int,input().split())
if(list[0]%2 == 1 and list[1]%2 ==1):
print("Yes")
else:
print("No")
|
Statement
You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A
\times B \times C is an odd number.
|
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
|
Print the minimum number of power strips required.
* * *
|
s773083197
|
Wrong Answer
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
def calulate(m, n):
n_adapters = n // m
if n > m:
n_adapters += 1
print(n_adapters)
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the minimum number of power strips required.
* * *
|
s202238519
|
Runtime Error
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
S, T = input().split()
print(S + T - 1) // S
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the minimum number of power strips required.
* * *
|
s688512487
|
Runtime Error
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
S = input()
List = [input() for i in range(1)]
T = List[0]
Slst = list(S)
Tlst = list(T)
M = 0
for x in range(3):
if Slst[x] == Tlst[x]:
M += 1
print(M)
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the minimum number of power strips required.
* * *
|
s568838626
|
Accepted
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int, input().split())
if b == 1:
print(0)
if 1 < b <= a:
print(1)
for i in range(a):
if (a - i + i * a) < b <= (a - (i + 1) + (i + 1) * a):
print(1 + (i + 1))
for i in range(a**2):
if ((a**2) - i + i * a) < b <= ((a**2) - (i + 1) + (i + 1) * a):
print(1 + a + (i + 1))
for i in range(a**3):
if ((a**3) - i + i * a) < b <= ((a**3) - (i + 1) + (i + 1) * a):
print(1 + a + (a**2) + (i + 1))
for i in range(a**4):
if ((a**4) - i + i * a) < b <= ((a**4) - (i + 1) + (i + 1) * a):
print(1 + a + (a**2) + (a**3) + (i + 1))
for i in range(a**5):
if ((a**5) - i + i * a) < b <= ((a**5) - (i + 1) + (i + 1) * a):
print(1 + a + (a**2) + (a**3) + (a**4) + (i + 1))
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the minimum number of power strips required.
* * *
|
s816973708
|
Runtime Error
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
a, b = map(int.input().split())
print((b - 0.1) // a + 1)
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the minimum number of power strips required.
* * *
|
s802503968
|
Wrong Answer
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
print(-eval("-~" + input().replace(" ", "//~")))
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the minimum number of power strips required.
* * *
|
s863682623
|
Wrong Answer
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
n, m = input().split()
n = int(n)
m = int(m)
print((m // n) + 1)
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the minimum number of power strips required.
* * *
|
s820292642
|
Wrong Answer
|
p02922
|
Input is given from Standard Input in the following format:
A B
|
A, B = map(int, input().split())
if B == 1:
print(0)
if A >= B:
print(1)
if (2 * A - 1) >= B:
print(2)
if (3 * A - 2) >= B:
print(3)
if (4 * A - 3) >= B:
print(4)
if (5 * A - 4) >= B:
print(5)
if (6 * A - 5) >= B:
print(6)
if (7 * A - 6) >= B:
print(7)
if (8 * A - 7) >= B:
print(8)
if (9 * A - 8) >= B:
print(9)
if (10 * A - 9) >= B:
print(10)
if (11 * A - 10) >= B:
print(11)
if (12 * A - 11) >= B:
print(12)
if (13 * A - 12) >= B:
print(13)
if (14 * A - 13) >= B:
print(14)
if (15 * A - 14) >= B:
print(15)
if (16 * A - 15) >= B:
print(16)
if (17 * A - 16) >= B:
print(17)
if (18 * A - 17) >= B:
print(18)
if (19 * A - 18) >= B:
print(19)
if (20 * A - 19) >= B:
print(20)
|
Statement
Takahashi's house has only one socket.
Takahashi wants to extend it with some number of power strips, each with A
sockets, into B or more empty sockets.
One power strip with A sockets can extend one empty socket into A empty
sockets.
Find the minimum number of power strips required.
|
[{"input": "4 10", "output": "3\n \n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\n* * *"}, {"input": "8 9", "output": "2\n \n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\n* * *"}, {"input": "8 8", "output": "1"}]
|
Print the maximum possible area of Snuke's rectangle.
* * *
|
s373187276
|
Wrong Answer
|
p03630
|
Input is given from Standard Input in the following format:
H W
S_1
S_2
:
S_H
|
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・2x2内の偶奇が不変量。これが偶数なら、そこは単色でとれる
・単色でとれる領域を調べる -> 色変更なしに大きい長方形をとる問題になる
・ベースラインを固定すると、ヒストグラムの長方形の問題(アリ本)
"""
H, W = map(int, readline().split())
grid = read().replace(b"\r", b"").replace(b"\n", b"")
# 左上に集める
cnt = [0] * (H * W)
for x in range(H * W):
if grid[x] == ord("#"):
# その場
cnt[x] ^= 1
# 左
if x % W:
cnt[x - 1] ^= 1
# 上
if x >= W:
cnt[x - W] ^= 1
if x % W and x >= W:
cnt[x - W - 1] ^= 1
max_area = 0
height = [1] * (W - 1)
for i in range(H - 1):
for j in range(W - 1):
if cnt[W * i + j]:
height[j] = 1
else:
height[j] += 1
# 最大長方形の変種。横幅を1乗せる
stack = []
for j, h in enumerate(height + [0]):
while stack:
prev_h = height[stack[-1]]
if prev_h <= h:
break
left_end = stack.pop()
area = (j - left_end + 1) * height[left_end]
if max_area < area:
max_area = area
stack.append(j)
# 幅1の長方形は2x2を素材としない
if max_area < max(W, H):
max_area = max(W, H)
print(max_area)
|
Statement
We have a board with an H \times W grid. Each square in the grid is painted in
black or white. The square at the i-th row from the top and j-th column from
the left is black if the j-th character in S_i is `#`, and white if that
character is `.`.
Snuke can perform the following operation on the grid any number of times:
* Select a row or column in the grid, and invert the color of all the squares in that row or column (that is, black squares become white and vice versa).
Then, Snuke draws a rectangle along grid lines. Here, all the squares
contained in the rectangle must be painted in black.
Find the maximum possible area of Snuke's rectangle when the operation is
performed optimally.
|
[{"input": "3 3\n ..#\n ##.\n .#.", "output": "6\n \n\nIf the first row from the top and the third column from the left are inverted,\na 2 \\times 3 rectangle can be drawn, as shown below:\n\n\n\n* * *"}, {"input": "4 4\n ....\n ....\n ....\n ....", "output": "16\n \n\n* * *"}, {"input": "10 8\n ##...#.#\n ##...#.#\n ..###.#.\n #.##.#.#\n .#..#.#.\n ..##.#.#\n ##.#.#..\n ...#.#..\n ###.#.##\n ###..###", "output": "27"}]
|
Print the maximum possible area of Snuke's rectangle.
* * *
|
s956066914
|
Runtime Error
|
p03630
|
Input is given from Standard Input in the following format:
H W
S_1
S_2
:
S_H
|
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<complex>
#include<bitset>
#include<numeric>
#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound
const int MAX_H = 2000, MAX_W = 2000;
int H, W;
string S[MAX_H];
int bad[MAX_H - 1][MAX_W - 1];
signed main() {
cin >> H >> W;
rep(i, H) {
cin >> S[i];
}
rep(h, H - 1) {
rep(w, W - 1) {
rep(i, 2) {
rep(j, 2) {
bad[h][w] += (S[h + i][w + j] == '#');
}
}
bad[h][w] %= 2;
}
}
rep(w, W - 1)bad[0][w] = 2 - bad[0][w];
rep(h, H - 2) {
rep(w, W - 1) {
if (bad[h + 1][w] == 1)bad[h + 1][w] = 1;
else bad[h + 1][w] = bad[h][w] + 1;
}
}
int ans = max(H, W);
rep(h, H - 1) {
stack<pii> st;
rep(w, W - 1) {
int tmp = w;
while (!st.empty() && st.top().second > bad[h][w]) {
pii p = st.top();
st.pop();
ans = max(ans, p.second * (w - p.first + 1));
tmp = p.first;
}
st.push(pii(tmp, bad[h][w]));
}
while (!st.empty()) {
pii p = st.top();
st.pop();
ans = max(ans, p.second * (W - p.first));
}
}
cout << ans << endl;
return 0;
}
|
Statement
We have a board with an H \times W grid. Each square in the grid is painted in
black or white. The square at the i-th row from the top and j-th column from
the left is black if the j-th character in S_i is `#`, and white if that
character is `.`.
Snuke can perform the following operation on the grid any number of times:
* Select a row or column in the grid, and invert the color of all the squares in that row or column (that is, black squares become white and vice versa).
Then, Snuke draws a rectangle along grid lines. Here, all the squares
contained in the rectangle must be painted in black.
Find the maximum possible area of Snuke's rectangle when the operation is
performed optimally.
|
[{"input": "3 3\n ..#\n ##.\n .#.", "output": "6\n \n\nIf the first row from the top and the third column from the left are inverted,\na 2 \\times 3 rectangle can be drawn, as shown below:\n\n\n\n* * *"}, {"input": "4 4\n ....\n ....\n ....\n ....", "output": "16\n \n\n* * *"}, {"input": "10 8\n ##...#.#\n ##...#.#\n ..###.#.\n #.##.#.#\n .#..#.#.\n ..##.#.#\n ##.#.#..\n ...#.#..\n ###.#.##\n ###..###", "output": "27"}]
|
For each dataset, output in a line the possible maximum total after-tax price
when the VAT rate is changed to _y_ %.
|
s998126035
|
Wrong Answer
|
p00773
|
The input consists of multiple datasets. Each dataset is in one line, which
consists of three integers _x_ , _y_ , and _s_ separated by a space. _x_ is
the VAT rate in percent _before_ the VAT-rate change, _y_ is the VAT rate in
percent _after_ the VAT-rate change, and _s_ is the sum of after-tax prices of
two items _before_ the VAT-rate change. For these integers, 0 < _x_ < 100, 0 <
_y_ < 100, 10 < _s_ < 1000, and _x_ ≠ _y_ hold. For before-tax prices of
items, all possibilities of 1 yen through _s_ -1 yen should be considered.
The end of the input is specified by three zeros separated by a space.
|
if __name__ == "__main__":
while 1:
x, y, z = list(map(int, input().strip().split()))
if x == 0 and y == 0 and z == 0:
break
data = []
for i in range(1, z):
t1 = i + int(i * x / 100)
for j in range(1, z - t1 + 1):
t2 = j + int(j * (x / 100))
if t1 + t2 == z:
data.append([i, j])
ans = 0
for k in data:
temp = k[0] + int(k[0] * (y / 100)) + k[1] + int(k[1] * y / 100)
if temp > ans:
ans = temp
print(ans)
|
Tax Rate Changed
VAT (value-added tax) is a tax imposed at a certain rate proportional to the
sale price.
Our store uses the following rules to calculate the after-tax prices.
* When the VAT rate is _x_ %, for an item with the before-tax price of _p_ yen, its after-tax price of the item is _p_ (100+_x_) / 100 yen, fractions rounded off.
* The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items.
The VAT rate is changed quite often. Our accountant has become aware that
"different pairs of items that had the same total after-tax price may have
different total after-tax prices after VAT rate changes." For example, when
the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax
prices of 105 yen before can now have after-tax prices either of 107, 108, or
109 yen, as shown in the table below.
Before-tax prices of two items| After-tax price with 5% VAT| After-tax price
with 8% VAT
---|---|---
20, 80| 21 + 84 = 105| 21 + 86 = 107
2, 99| 2 + 103 = 105| 2 + 106 = 108
13, 88| 13 + 92 = 105| 14 + 95 = 109
Our accountant is examining effects of VAT-rate changes on after-tax prices.
You are asked to write a program that calculates the possible maximum total
after-tax price of two items with the new VAT rate, knowing their total after-
tax price before the VAT rate change.
|
[{"input": "8 105\n 8 5 105\n 1 2 24\n 99 98 24\n 12 13 26\n 1 22 23\n 1 13 201\n 13 16 112\n 2 24 50\n 1 82 61\n 1 84 125\n 1 99 999\n 99 1 999\n 98 99 999\n 1 99 11\n 99 1 12\n 0 0 0", "output": "103\n 24\n 24\n 26\n 27\n 225\n 116\n 62\n 111\n 230\n 1972\n 508\n 1004\n 20\n 7"}]
|
For each dataset, output in a line the possible maximum total after-tax price
when the VAT rate is changed to _y_ %.
|
s705664596
|
Accepted
|
p00773
|
The input consists of multiple datasets. Each dataset is in one line, which
consists of three integers _x_ , _y_ , and _s_ separated by a space. _x_ is
the VAT rate in percent _before_ the VAT-rate change, _y_ is the VAT rate in
percent _after_ the VAT-rate change, and _s_ is the sum of after-tax prices of
two items _before_ the VAT-rate change. For these integers, 0 < _x_ < 100, 0 <
_y_ < 100, 10 < _s_ < 1000, and _x_ ≠ _y_ hold. For before-tax prices of
items, all possibilities of 1 yen through _s_ -1 yen should be considered.
The end of the input is specified by three zeros separated by a space.
|
# 税抜価格から税込価格を計算する関数
#
# [引数]
# zeinuki : 税抜価格(整数)
# zeiritsu : 税率(パーセント, 整数)
# [返り値]
# 税込価格(整数)
def calcZeikomi(zeinuki, zeiritsu):
return zeinuki + zeinuki * zeiritsu // 100
# 税込価格から税抜価格の最小値を探索する関数
#
# [考え方]
# 税抜価格の最小値は1から税込価格の間にあり、1から探索すれば最小値が求まる
# [引数]
# zeikomi : 税込価格(整数)
# zeiritsu : 税率(パーセント, 整数)
# [返り値]
# 税抜価格の最小値(整数)。存在しない場合はNone。
def calcZeinukiMinimum(zeikomi, zeiritsu):
for i in range(1, zeikomi + 1):
if calcZeikomi(i, zeiritsu) == zeikomi:
return i
return None
# 税込価格から税抜価格の最大値を探索する関数
#
# [考え方]
# 税抜価格の最大値は1から税込価格の間にあり、税込価格から探索すれば最大値が
# 求まる
# [引数]
# zeikomi : 税込価格(整数)
# zeiritsu : 税率(パーセント, 整数)
# [返り値]
# 税抜価格の最大値(整数)。存在しない場合はNone。
def calcZeinukiMaximum(zeikomi, zeiritsu):
for i in range(zeikomi, 0, -1):
if calcZeikomi(i, zeiritsu) == zeikomi:
return i
return None
# 改定価格の最大値を計算する関数
#
# [引数]
# rate0 : 変更前の消費税率(整数)
# rate1 : 変更後の消費税率(整数)
# price0 : 消費税率変更前の価格(整数)
# [返り値]
# 消費税率変更後の価格(整数)。存在しなければNone。
def calcKaiteiMaximum(rate0, rate1, price0):
zeinuki = calcZeinukiMaximum(price0, rate0)
if zeinuki == None:
return None
return calcZeikomi(zeinuki, rate1)
# 問題を解く関数
#
# [考え方]
# 2商品の合計価格が与えられるので、総当たり法を実施
# [引数]
# x : 変更前の消費税率(パーセント, 整数)
# y : 変更後の消費税率(パーセント, 整数)
# s : 消費税率変更前の2商品の税込合計価格
def solve(x, y, s):
res = 0
for i in range(1, s):
price1 = calcKaiteiMaximum(x, y, i)
price2 = calcKaiteiMaximum(x, y, s - i)
if price1 == None or price2 == None:
continue
res = max(res, price1 + price2)
return res
# メインルーチン
while True:
ary = input().split()
x = int(ary[0])
y = int(ary[1])
s = int(ary[2])
if x == 0 and y == 0 and s == 0:
break
print(solve(x, y, s))
|
Tax Rate Changed
VAT (value-added tax) is a tax imposed at a certain rate proportional to the
sale price.
Our store uses the following rules to calculate the after-tax prices.
* When the VAT rate is _x_ %, for an item with the before-tax price of _p_ yen, its after-tax price of the item is _p_ (100+_x_) / 100 yen, fractions rounded off.
* The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items.
The VAT rate is changed quite often. Our accountant has become aware that
"different pairs of items that had the same total after-tax price may have
different total after-tax prices after VAT rate changes." For example, when
the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax
prices of 105 yen before can now have after-tax prices either of 107, 108, or
109 yen, as shown in the table below.
Before-tax prices of two items| After-tax price with 5% VAT| After-tax price
with 8% VAT
---|---|---
20, 80| 21 + 84 = 105| 21 + 86 = 107
2, 99| 2 + 103 = 105| 2 + 106 = 108
13, 88| 13 + 92 = 105| 14 + 95 = 109
Our accountant is examining effects of VAT-rate changes on after-tax prices.
You are asked to write a program that calculates the possible maximum total
after-tax price of two items with the new VAT rate, knowing their total after-
tax price before the VAT rate change.
|
[{"input": "8 105\n 8 5 105\n 1 2 24\n 99 98 24\n 12 13 26\n 1 22 23\n 1 13 201\n 13 16 112\n 2 24 50\n 1 82 61\n 1 84 125\n 1 99 999\n 99 1 999\n 98 99 999\n 1 99 11\n 99 1 12\n 0 0 0", "output": "103\n 24\n 24\n 26\n 27\n 225\n 116\n 62\n 111\n 230\n 1972\n 508\n 1004\n 20\n 7"}]
|
Print the number of the ways to paint the squares, modulo 10^9+7.
* * *
|
s955574153
|
Runtime Error
|
p03299
|
Input is given from Standard Input in the following format:
N
h_1 h_2 ... h_N
|
mod = 10**9 + 7
n = int(input())
H = list(map(int, input().split()))
def solve(h):
if not h:
return 1
elif len(h) == 1:
return pow(2, h[0], mod)
N = len(h)
a = [h[i] for i in range(N)]
a = list(set(a))
a.sort()
comp = {i: e + 1 for e, i in enumerate(a)}
data = {comp[e]: e for e in comp.keys()}
data[0] = 0
data[0] = 1
# print(comp)
dp = [[0 for i in range(len(a) + 1)] for j in range(N)]
i = 0
if h[i + 1] >= h[i]:
id = comp[h[i]]
dp[i][id] = 2
dp[i][id + 1] = 2
for j in range(0, id):
dp[i][j] = 1
else:
id = comp[h[i + 1]]
for j in range(0, id):
dp[i][j] = pow(2, h[i] - h[i + 1], mod)
dp[i][id] = 2 * (pow(2, h[i] - h[i + 1], mod) - 1)
dp[i][id] %= mod
id2 = comp[h[i]]
dp[i][id] += 2
dp[i][id] %= mod
for i in range(1, N - 1):
if h[i + 1] >= h[i]:
id = comp[h[i]]
id2 = comp[h[i + 1]]
for j in range(id, id2 + 1):
dp[i][j] = (2 * dp[i - 1][id]) % mod
for j in range(0, id):
dp[i][j] = dp[i - 1][j]
else:
id = comp[h[i + 1]]
id2 = comp[h[i]]
for j in range(0, id):
dp[i][j] = (pow(2, h[i] - h[i + 1], mod) * dp[i - 1][j]) % mod
for j in range(id, id2):
low = data[j]
up = data[j + 1] - 1
dp[i][id] += (
dp[i - 1][j]
* pow(2, h[i] - up, mod)
* (pow(2, up - low + 1, mod) - 1)
)
dp[i][id] %= mod
dp[i][id] += 2 * dp[i - 1][id2]
dp[i][id] %= mod
ans = 0
id = comp[h[-1]]
for i in range(0, id):
low = data[i]
up = data[i + 1] - 1
ans += dp[N - 2][i] * pow(2, h[-1] - up, mod) * (pow(2, up - low + 1, mod) - 1)
ans %= mod
ans += 2 * dp[N - 2][id]
ans %= mod
return ans
ans = pow(2, H.count(1), mod)
check = [i for i in range(n) if H[i] == 1]
check = [-1] + check + [n]
for i in range(len(check) - 1):
l, r = check[i], check[i + 1]
ans *= solve(H[l + 1 : r])
ans %= mod
print(ans)
|
Statement
Let us consider a grid of squares with 10^9 rows and N columns. Let (i, j) be
the square at the i-th column (1 \leq i \leq N) from the left and j-th row (1
\leq j \leq 10^9) from the bottom.
Snuke has cut out some part of the grid so that, for each i = 1, 2, ..., N,
the bottom-most h_i squares are remaining in the i-th column from the left.
Now, he will paint the remaining squares in red and blue. Find the number of
the ways to paint the squares so that the following condition is satisfied:
* Every remaining square is painted either red or blue.
* For all 1 \leq i \leq N-1 and 1 \leq j \leq min(h_i, h_{i+1})-1, there are exactly two squares painted red and two squares painted blue among the following four squares: (i, j), (i, j+1), (i+1, j) and (i+1, j+1).
Since the number of ways can be extremely large, print the count modulo
10^9+7.
|
[{"input": "9\n 2 3 5 4 1 2 4 2 1", "output": "12800\n \n\nOne of the ways to paint the squares is shown below:\n\n \n \n #\n ## #\n ### #\n #### ###\n #########\n \n\n* * *"}, {"input": "2\n 2 2", "output": "6\n \n\nThere are six ways to paint the squares, as follows:\n\n \n \n ## ## ## ## ## ##\n ## ## ## ## ## ##\n \n\n* * *"}, {"input": "5\n 2 1 2 1 2", "output": "256\n \n\nEvery way to paint the squares satisfies the condition.\n\n* * *"}, {"input": "9\n 27 18 28 18 28 45 90 45 23", "output": "844733013\n \n\nRemember to print the number of ways modulo 10^9 + 7."}]
|
Print the number of the ways to paint the squares, modulo 10^9+7.
* * *
|
s445373224
|
Runtime Error
|
p03299
|
Input is given from Standard Input in the following format:
N
h_1 h_2 ... h_N
|
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 105, MOD = 1e9 + 7;
int n, h[N], mn[N][N], dp[2][N][N], same[N][N], g[N][N], p[N];
int bp(int x, int y) {
int res = 1;
while (y) {
if (y & 1)
res = (ll)res * x % MOD;
x = (ll)x * x % MOD;
y /= 2;
}
return res;
}
void add(int & x, int y) {
x += y;
if (x >= MOD) x -= MOD;
}
int get(int l, int r) {
if (l > r) return 1;
int & res = g[l][r];
if (res != -1) return res;
return res = (ll)bp(2, max(0, h[l] - max(h[l - 1], mn[l + 1][r + 1]))) * get(l + 1, r) % MOD;
}
int solve(int f, int l, int r) {
if (l > r) return 1;
int & res = dp[f][l][r];
if (res != -1) return res;
res = 0;
if (f == 0) {
for (int i = l; i <= r; i++)
add(res, (ll)get(l, i) * solve(1, i + 1, r) % MOD);
} else {
for (int i = l + 1; i <= r; i++)
add(res, (ll)same[l][i] * solve(0, i + 1, r) % MOD);
}
return res;
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
memset(& g, -1, sizeof(g));
memset(& dp, -1, sizeof(dp));
cin >> n;
int mul = 0;
for (int i = 1; i <= n; i++) {
cin >> h[i];
if (h[i] == 1) mul++, h[i] = 0;
}
for (int r = n + 1; r >= 1; r--) {
mn[r][r] = h[r];
for (int l = r - 1; l >= 1; l--) {
mn[l][r] = min(h[l], mn[l + 1][r]);
}
}
p[0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= i - 2; j++) {
add(p[i], p[j]);
}
}
for (int l = 1; l <= n; l++) {
for (int r = l; r <= n; r++) {
same[l][r] = 1;
for (int k = l; k <= r; k++) {
int hl = (k == l) ? 0 : h[k - 1];
int hr = (k == r) ? 0 : h[k + 1];
same[l][r] = (ll)same[l][r] * bp(2, max(0, h[k] - max(hl, hr))) % MOD;
}
same[l][r] = (ll)same[l][r] * p[r - l + 1] % MOD;
}
}
int last = 0, res = 1;
for (int i = 1; i <= n + 1; i++) {
if (h[i] == 0) {
if (last + 1 <= i - 1) {
int cur = (solve(0, last + 1, i - 1) + solve(1, last + 1, i - 1)) % MOD;
cur = cur * 2 % MOD;
cur = (cur - get(last + 1, i - 1) + MOD) % MOD;
res = (ll)res * cur % MOD;
}
last = i;
}
}
cout << (ll)res * bp(2, mul) % MOD;
}
|
Statement
Let us consider a grid of squares with 10^9 rows and N columns. Let (i, j) be
the square at the i-th column (1 \leq i \leq N) from the left and j-th row (1
\leq j \leq 10^9) from the bottom.
Snuke has cut out some part of the grid so that, for each i = 1, 2, ..., N,
the bottom-most h_i squares are remaining in the i-th column from the left.
Now, he will paint the remaining squares in red and blue. Find the number of
the ways to paint the squares so that the following condition is satisfied:
* Every remaining square is painted either red or blue.
* For all 1 \leq i \leq N-1 and 1 \leq j \leq min(h_i, h_{i+1})-1, there are exactly two squares painted red and two squares painted blue among the following four squares: (i, j), (i, j+1), (i+1, j) and (i+1, j+1).
Since the number of ways can be extremely large, print the count modulo
10^9+7.
|
[{"input": "9\n 2 3 5 4 1 2 4 2 1", "output": "12800\n \n\nOne of the ways to paint the squares is shown below:\n\n \n \n #\n ## #\n ### #\n #### ###\n #########\n \n\n* * *"}, {"input": "2\n 2 2", "output": "6\n \n\nThere are six ways to paint the squares, as follows:\n\n \n \n ## ## ## ## ## ##\n ## ## ## ## ## ##\n \n\n* * *"}, {"input": "5\n 2 1 2 1 2", "output": "256\n \n\nEvery way to paint the squares satisfies the condition.\n\n* * *"}, {"input": "9\n 27 18 28 18 28 45 90 45 23", "output": "844733013\n \n\nRemember to print the number of ways modulo 10^9 + 7."}]
|
Print the number of the ways to paint the squares, modulo 10^9+7.
* * *
|
s873971071
|
Runtime Error
|
p03299
|
Input is given from Standard Input in the following format:
N
h_1 h_2 ... h_N
|
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
LL powmod(LL a, LL n){
if(n == 0) return 1;
if(n % 2) return (a*powmod(a,n-1)) % MOD;
LL c = powmod(a, n/2);
return (c*c) % MOD;
}
LL inv(LL a){
return powmod(a, MOD-2);
}
LL fact[110000];
LL invfact[110000];
LL ncr(LL n, LL r){
if(r < 0 || n < 0) return 0;
if(n < r) return 0;
LL a = fact[n];
a = (a * invfact[r]) % MOD;
a = (a * invfact[n-r]) % MOD;
return a;
}
void init(){
fact[0] = 1;
invfact[0] = 1;
LL inv2 = inv(2);
for(LL i = 1; i < 110000; i++){
fact[i] = (i*fact[i-1]) % MOD;
invfact[i] = inv(fact[i]);
}
}
pair<LL,LL> solve(vector<LL> a){
LL r = a[0];
for(int j = 0; j < a.size(); j++){
r = min(r, a[j]);
}
LL num0 = 0;
for(int j = 0; j < a.size(); j++){
a[j] -= r;
if(a[j] == 0) num0++;
}
vector<LL> cur;
LL total = powmod(2, num0);
LL alternating = 2;
a.push_back(0);
for(int j = 0; j < a.size(); j++){
if(a[j] == 0 && cur.size() > 0){
pair<LL,LL> d = solve(cur);
cur.clear();
total = (total * (d.first + d.second) ) % MOD;
alternating = (alternating * d.second) % MOD;
}
if(a[j] != 0){
cur.push_back(a[j]);
}
if(a[j] == 0){
num0 ++;
}
}
total -= alternating;
alternating = (alternating * powmod(2, r-1)) % MOD;
total += alternating;
total %= MOD;
if(total < 0) total += MOD;
if(alternating < 0) alternating += MOD;
return {total, alternating};
}
int main(){
LL N;
cin >> N;
vector<LL> h;
for(int i = 0; i < N; i++){
LL a;
cin >> a;
h.push_back(a);
}
pair<LL,LL> ans = solve(h);
cout << ans.first << endl;
}
|
Statement
Let us consider a grid of squares with 10^9 rows and N columns. Let (i, j) be
the square at the i-th column (1 \leq i \leq N) from the left and j-th row (1
\leq j \leq 10^9) from the bottom.
Snuke has cut out some part of the grid so that, for each i = 1, 2, ..., N,
the bottom-most h_i squares are remaining in the i-th column from the left.
Now, he will paint the remaining squares in red and blue. Find the number of
the ways to paint the squares so that the following condition is satisfied:
* Every remaining square is painted either red or blue.
* For all 1 \leq i \leq N-1 and 1 \leq j \leq min(h_i, h_{i+1})-1, there are exactly two squares painted red and two squares painted blue among the following four squares: (i, j), (i, j+1), (i+1, j) and (i+1, j+1).
Since the number of ways can be extremely large, print the count modulo
10^9+7.
|
[{"input": "9\n 2 3 5 4 1 2 4 2 1", "output": "12800\n \n\nOne of the ways to paint the squares is shown below:\n\n \n \n #\n ## #\n ### #\n #### ###\n #########\n \n\n* * *"}, {"input": "2\n 2 2", "output": "6\n \n\nThere are six ways to paint the squares, as follows:\n\n \n \n ## ## ## ## ## ##\n ## ## ## ## ## ##\n \n\n* * *"}, {"input": "5\n 2 1 2 1 2", "output": "256\n \n\nEvery way to paint the squares satisfies the condition.\n\n* * *"}, {"input": "9\n 27 18 28 18 28 45 90 45 23", "output": "844733013\n \n\nRemember to print the number of ways modulo 10^9 + 7."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s907046257
|
Accepted
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache
class cin:
def int():
return int(sys.stdin.readline().rstrip())
def string():
return sys.stdin.readline().rstrip()
def mapInt():
return [int(x) for x in cin.string().split()]
def stringList(n):
return [input() for i in range(n)]
def intListList(n):
return [cin.mapInt() for i in range(n)]
def intColsList(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():
N = cin.int()
S = cin.stringList(N)
T = [defaultdict(int) for i in range(N)]
for i, s in enumerate(S):
for t in s:
T[i][t] += 1
for s in string.ascii_lowercase:
m = int(1e09)
for t in T:
m = min(m, t[s])
print(s * m, end="")
print("")
return
if __name__ == "__main__":
main()
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s817832770
|
Accepted
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
from functools import partial, reduce
from operator import mul
prod = partial(reduce, mul)
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin.readline())
def SI():
return input()
from collections import Counter
fibo = [1, 1]
for i in range(2, 9):
fibo.append(fibo[i - 1] + fibo[i - 2])
def main():
n = II()
S = []
for _ in range(n):
S.append(SI())
cnt = Counter(S[0])
for s in S[1:]:
s = Counter(s)
for x in cnt.keys():
cnt[x] = min(cnt[x], s[x])
cnt = +cnt
ans = ""
for k, v in sorted(list(cnt.items())):
ans += k * v
return ans
print(main())
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s498062901
|
Accepted
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
from collections import Counter
import string
def counterWithDefaultValue(arr, defaultValue):
dic = Counter(arr)
for k in dic.keys():
dic[k] = defaultValue
return dic
def answer(arr, n):
_max = 50
alphabets = [c for c in string.ascii_lowercase]
dic = Counter(alphabets)
for i in range(n):
for a in alphabets:
if a in arr[i]:
dic[a] += 1
commonAlphabets = []
for k, v in dic.items():
if v == (n + 1):
commonAlphabets.append(k)
if len(commonAlphabets) == 0:
return ""
dic = counterWithDefaultValue(commonAlphabets, _max)
for i in range(n):
_dic = Counter(arr[i])
for k in dic.keys():
dic[k] = min(dic[k], _dic[k])
lexicalSortedKeys = sorted(dic.keys())
result = []
for i in range(len(lexicalSortedKeys)):
k = lexicalSortedKeys[i]
result = result + ([k] * dic[k])
return "".join(result)
n = int(input())
arr = []
for _ in range(n):
s = input().rstrip()
arr.append([c for c in s])
print(answer(arr, n))
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s274467386
|
Accepted
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
def examC():
N = I()
d = defaultdict(int)
for i in range(N):
curD = defaultdict(int)
S = SI()
for s in S:
curD[s] += 1
if i == 0:
d = curD
continue
for s in alphabet:
d[s] = min(d[s], curD[s])
d = sorted(d.items())
ans = ""
for key, i in d:
ans += key * i
print(ans)
return
import sys, copy, bisect, itertools, heapq, math
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque
def I():
return int(sys.stdin.readline())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LSI():
return list(map(str, sys.stdin.readline().split()))
def LS():
return sys.stdin.readline().split()
def SI():
return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord("a") + i) for i in range(26)]
if __name__ == "__main__":
examC()
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s540961298
|
Accepted
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
N = int(input()) # 入力回数を決める
lis = []
mins = []
for i in range(N):
lis.append(input())
alpha = "abcdefghijklmnopqrstuvwxyz"
for charas in alpha:
counts = []
for words in lis:
d = words.count(charas)
counts.append(d)
mins.append(min(counts))
i = 0
ans = ""
while i < 26:
ans += alpha[i] * mins[i]
i += 1
print(ans)
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s165834282
|
Accepted
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
c = [
min(p)
for p in zip(
*[
[i.count(chr(97 + j)) for j in range(26)]
for i in [input() for _ in range(int(input()))]
]
)
]
print("".join([chr(i + 97) * c[i] for i in range(26)]))
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s529725705
|
Accepted
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
print(
(
lambda s: "".join(
[chr(c) * min([t.count(chr(c)) for t in s]) for c in range(97, 123)]
)
)([input() for i in range(int(input()))])
)
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s130264917
|
Runtime Error
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
from collections import Counter
N = int(input())
S = [input() for _ in range(N)
cl = [Counter(s) for s in S]
ans = ""
for i in range(26):
s = chr(ord("a")+i)
val = min([c[s] for c in cl])
ans += s*val
print(ans)
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Print the lexicographically smallest string among the longest strings that
satisfy the condition. If the answer is an empty string, print an empty line.
* * *
|
s244546321
|
Runtime Error
|
p03763
|
Input is given from Standard Input in the following format:
n
S_1
...
S_n
|
n = int(input())
s = [input() for _ in range(n)]
t = []
for i in range()
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
cl = [Counter(s) for s in S]
ans = ""
for i in range(26):
s = chr(ord("a")+i)
val = min([c[s] for c in cl])
ans += s*val
print(ans)
|
Statement
Snuke loves "paper cutting": he cuts out characters from a newspaper headline
and rearranges them to form another string.
He will receive a headline which contains one of the strings S_1,...,S_n
tomorrow. He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in
strings that can be created regardless of which string the headline contains.
Find the longest string that can be created regardless of which string among
S_1,...,S_n the headline contains. If there are multiple such strings, find
the lexicographically smallest one among them.
|
[{"input": "3\n cbaa\n daacc\n acacac", "output": "aac\n \n\nThe strings that can be created from each of `cbaa`, `daacc` and `acacac`, are\n`aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are\nthe longest, and the lexicographically smallest of these three is `aac`.\n\n* * *"}, {"input": "3\n a\n aa\n b", "output": "The answer is an empty string."}]
|
Format
The Output expects T_{\text{max}} integers in the format specified below.
\mathrm{command}_{0}
\mathrm{command}_{1}
:
\mathrm{command}_{T_{\text{max}}-1}
In particular, \mathrm{command}_{i} shall specify the movement of the delivery
car by using one of the following two options:
1) `stay`, if the car shall not move:
-1
2) `move w`, if the car shall be moved one step towards the neighboring vertex
w
w
Note that in case of 2) w has to satisfy the following conditions:
* w \in V
* If the car is at vertex u: \left\\{ u, w \right\\} \in E .
* If the car is on the edge \left\\{ u, v \right\\}, w must either satisfy u = w or v = w.
* * *
|
s289756489
|
Runtime Error
|
p02871
|
Format
Input is provided in the following form:
|V| |E|
u_{1} v_{1} d_{u_{1}, v_{1}}
u_{2} v_{2} d_{u_{2}, v_{2}}
:
u_{|E|} v_{|E|} d_{u_{|E|}, v_{|E|}}
T_{\text{max}}
\mathrm{info}_{0}
\mathrm{info}_{1}
:
\mathrm{info}_{T_{\text{max}}-1}
* In the first line |V| denotes the number of vertices, while |E| denotes the number of edges.
* The following |E| lines denote the edges of the graph. In particular, in the ith line u_{i} and v_{i} denote the edge connecting u_{i} and v_{i} and d_{u_{i}, v_{i}} the corresponding distance.
* The following line denotes the number of steps T_{\text{max}}.
In the following line, \mathrm{info}_t is information about the order from the
customer that occurs at time t. \mathrm{info}_t is given in the form:
N_{\text{new}}
\mathrm{new\_id}_1 \mathrm{dst}_1
\mathrm{new\_id}_2 \mathrm{dst}_2
\vdots
\mathrm{new\_id}_{N_{\text{new}}} \mathrm{dst}_{N_{\text{new}}}
* N_{\text{new}} represents the number of new orders which appear at time t.
* The next N_{\text{new}} lines give the newly generated order information. The i-th order information indicates that the order ID \mathrm{new\\_{id}}_i of the new order, while \mathrm{dst}_i denotes the vertex to which the customer wishes the order to be delivered.
* Note: If N_{\text{new}}=0, there are no new lines.
|
import random
class maps(object):
def __init__(self):
with open("test.in") as f:
self.readinputs(f)
# recieve |V| and |E|
def readinputs(self, file):
self.V, self.E = map(int, file.readline().split())
self.es = [[] for i in range(self.V)]
self.Mes = [[0] * self.V for i in range(self.V)]
for _ in range(self.E):
# recieve edges
a, b, c = map(int, file.readline().split())
a, b = a - 1, b - 1
self.es[a].append((b, c))
self.es[b].append((a, c))
self.Mes[a][b] = c
self.Mes[b][a] = c
self.T = int(file.readline())
# recieve info
self.info = [[] for i in range(self.T)]
for t in range(self.T):
Nnew = int(file.readline())
for _ in range(Nnew):
new_id, dst = map(int, file.readline().split())
self.info[t].append((new_id, dst))
def random_walk(self):
where = [("v", 0)] # ('e',from,to,dist)
self.path = [0] * self.T
for t in range(self.T):
now_where = where[-1]
if now_where[0] == "v":
to, dist = random.choice(self.es[now_where[1]])
# to, dist = self.es[now_where[1]][n]
self.path[t] = to
if dist == 1:
where.append(("v", to))
else:
where.append(("e", now_where[1], to, 1))
elif now_where[0] == "e":
now_where = where[-1]
num = random.randint(0, 1)
if num == 0:
self.path[t] = now_where[2]
if now_where[3] + 1 < self.Mes[now_where[1]][now_where[2]]:
where.append(
("e", now_where[1], now_where[2], now_where[3] + 1)
)
elif now_where[3] + 1 == self.Mes[now_where[1]][now_where[2]]:
where.append(("v", now_where[2]))
else:
# ココの分岐に来ることはありえない。
pass
else:
self.path[t] = now_where[1]
if now_where[3] - 1 > 0:
where.append(
("e", now_where[1], now_where[2], now_where[3] - 1)
)
elif now_where[3] - 1 == 0:
where.append(("v", now_where[1]))
else:
# ココの分岐に来ることはありえない。
pass
else:
# ココの分岐に来ることはありえない。
pass
def all_stay(self):
self.path = [0] * self.T
for t in range(self.T):
self.path[t] = -1
def output(self):
for t in range(self.T):
print(self.path[t] + 1)
if __name__ == "__main__":
M = maps()
M.random_walk()
M.output()
|
Setting
|
[]
|
Format
The Output expects T_{\text{max}} integers in the format specified below.
\mathrm{command}_{0}
\mathrm{command}_{1}
:
\mathrm{command}_{T_{\text{max}}-1}
In particular, \mathrm{command}_{i} shall specify the movement of the delivery
car by using one of the following two options:
1) `stay`, if the car shall not move:
-1
2) `move w`, if the car shall be moved one step towards the neighboring vertex
w
w
Note that in case of 2) w has to satisfy the following conditions:
* w \in V
* If the car is at vertex u: \left\\{ u, w \right\\} \in E .
* If the car is on the edge \left\\{ u, v \right\\}, w must either satisfy u = w or v = w.
* * *
|
s059034576
|
Runtime Error
|
p02871
|
Format
Input is provided in the following form:
|V| |E|
u_{1} v_{1} d_{u_{1}, v_{1}}
u_{2} v_{2} d_{u_{2}, v_{2}}
:
u_{|E|} v_{|E|} d_{u_{|E|}, v_{|E|}}
T_{\text{max}}
\mathrm{info}_{0}
\mathrm{info}_{1}
:
\mathrm{info}_{T_{\text{max}}-1}
* In the first line |V| denotes the number of vertices, while |E| denotes the number of edges.
* The following |E| lines denote the edges of the graph. In particular, in the ith line u_{i} and v_{i} denote the edge connecting u_{i} and v_{i} and d_{u_{i}, v_{i}} the corresponding distance.
* The following line denotes the number of steps T_{\text{max}}.
In the following line, \mathrm{info}_t is information about the order from the
customer that occurs at time t. \mathrm{info}_t is given in the form:
N_{\text{new}}
\mathrm{new\_id}_1 \mathrm{dst}_1
\mathrm{new\_id}_2 \mathrm{dst}_2
\vdots
\mathrm{new\_id}_{N_{\text{new}}} \mathrm{dst}_{N_{\text{new}}}
* N_{\text{new}} represents the number of new orders which appear at time t.
* The next N_{\text{new}} lines give the newly generated order information. The i-th order information indicates that the order ID \mathrm{new\\_{id}}_i of the new order, while \mathrm{dst}_i denotes the vertex to which the customer wishes the order to be delivered.
* Note: If N_{\text{new}}=0, there are no new lines.
|
V, E = map(int, input().split()) # 点の数、辺の数
roads = list() # 道路を格納(始点、終点、長さ)
for i in range(E):
roads.append(list(map(int, input().split())))
Tmax = int(input()) # 制限時間
orders = list() # 注文
for i in range(Tmax - 1):
n = int(input())
for i in range(n):
orders.append(list(map(int, input().split())))
if n == 0:
pass
# 入力終わり
location = list()
for t in range(Tmax):
tasks = list(orders[0:t][1])
print(min(tasks))
location = min(tasks)[0], 1
if location == min(tasks):
tasks.remove(min(tasks))
|
Setting
|
[]
|
Format
The Output expects T_{\text{max}} integers in the format specified below.
\mathrm{command}_{0}
\mathrm{command}_{1}
:
\mathrm{command}_{T_{\text{max}}-1}
In particular, \mathrm{command}_{i} shall specify the movement of the delivery
car by using one of the following two options:
1) `stay`, if the car shall not move:
-1
2) `move w`, if the car shall be moved one step towards the neighboring vertex
w
w
Note that in case of 2) w has to satisfy the following conditions:
* w \in V
* If the car is at vertex u: \left\\{ u, w \right\\} \in E .
* If the car is on the edge \left\\{ u, v \right\\}, w must either satisfy u = w or v = w.
* * *
|
s829235307
|
Wrong Answer
|
p02871
|
Format
Input is provided in the following form:
|V| |E|
u_{1} v_{1} d_{u_{1}, v_{1}}
u_{2} v_{2} d_{u_{2}, v_{2}}
:
u_{|E|} v_{|E|} d_{u_{|E|}, v_{|E|}}
T_{\text{max}}
\mathrm{info}_{0}
\mathrm{info}_{1}
:
\mathrm{info}_{T_{\text{max}}-1}
* In the first line |V| denotes the number of vertices, while |E| denotes the number of edges.
* The following |E| lines denote the edges of the graph. In particular, in the ith line u_{i} and v_{i} denote the edge connecting u_{i} and v_{i} and d_{u_{i}, v_{i}} the corresponding distance.
* The following line denotes the number of steps T_{\text{max}}.
In the following line, \mathrm{info}_t is information about the order from the
customer that occurs at time t. \mathrm{info}_t is given in the form:
N_{\text{new}}
\mathrm{new\_id}_1 \mathrm{dst}_1
\mathrm{new\_id}_2 \mathrm{dst}_2
\vdots
\mathrm{new\_id}_{N_{\text{new}}} \mathrm{dst}_{N_{\text{new}}}
* N_{\text{new}} represents the number of new orders which appear at time t.
* The next N_{\text{new}} lines give the newly generated order information. The i-th order information indicates that the order ID \mathrm{new\\_{id}}_i of the new order, while \mathrm{dst}_i denotes the vertex to which the customer wishes the order to be delivered.
* Note: If N_{\text{new}}=0, there are no new lines.
|
def main():
V, E = (int(i) for i in input().split())
G = [[] for _ in range(V)]
for i in range(E):
u, v, d = (int(i) for i in input().split())
G[u - 1].append((v - 1, d))
G[v - 1].append((u - 1, d))
T_max = int(input())
info = []
for _ in range(T_max):
N = int(input())
t_order = []
for i in range(N):
new_id, dst = (int(i) for i in input().split())
t_order.append((new_id, dst))
info.append(t_order)
posi = 0
from random import choice
for t in range(T_max):
posi, dist = choice(G[posi])
print(posi + 1)
if __name__ == "__main__":
main()
|
Setting
|
[]
|
Print the total distance traveled by Takahashi throughout the game when
Takahashi and Aoki acts as above. It is guaranteed that K is always an integer
when L_i,R_i are integers.
* * *
|
s198750814
|
Runtime Error
|
p03333
|
Input is given from Standard Input in the following format:
N
L_1 R_1
:
L_N R_N
|
N = int(input())
L,R = [None]*N,[None]*N
for i in range(N):
L[i],R[i] = map(int,input().split())
L.sort(reverse=True)
R.sort()
def it():
for l,r in zip(L,R):
if r < l
yield 2*(l-r)
else:
return
print(sum(it()))
|
Statement
Takahashi and Aoki will play a game with a number line and some segments.
Takahashi is standing on the number line and he is initially at coordinate 0.
Aoki has N segments. The i-th segment is [L_i,R_i], that is, a segment
consisting of points with coordinates between L_i and R_i (inclusive).
The game has N steps. The i-th step proceeds as follows:
* First, Aoki chooses a segment that is still not chosen yet from the N segments and tells it to Takahashi.
* Then, Takahashi walks along the number line to some point within the segment chosen by Aoki this time.
After N steps are performed, Takahashi will return to coordinate 0 and the
game ends.
Let K be the total distance traveled by Takahashi throughout the game. Aoki
will choose segments so that K will be as large as possible, and Takahashi
walks along the line so that K will be as small as possible. What will be the
value of K in the end?
|
[{"input": "3\n -5 1\n 3 7\n -4 -2", "output": "10\n \n\nOne possible sequence of actions of Takahashi and Aoki is as follows:\n\n * Aoki chooses the first segment. Takahashi moves from coordinate 0 to -4, covering a distance of 4.\n * Aoki chooses the third segment. Takahashi stays at coordinate -4.\n * Aoki chooses the second segment. Takahashi moves from coordinate -4 to 3, covering a distance of 7.\n * Takahashi moves from coordinate 3 to 0, covering a distance of 3.\n\nThe distance covered by Takahashi here is 14 (because Takahashi didn't move\noptimally). It turns out that if both players move optimally, the distance\ncovered by Takahashi will be 10.\n\n* * *"}, {"input": "3\n 1 2\n 3 4\n 5 6", "output": "12\n \n\n* * *"}, {"input": "5\n -2 0\n -2 0\n 7 8\n 9 10\n -2 -1", "output": "34"}]
|
Print the total distance traveled by Takahashi throughout the game when
Takahashi and Aoki acts as above. It is guaranteed that K is always an integer
when L_i,R_i are integers.
* * *
|
s043161174
|
Runtime Error
|
p03333
|
Input is given from Standard Input in the following format:
N
L_1 R_1
:
L_N R_N
|
n = int(input())
L,R = [],[]
for num in range(n):
l,r = (int(i) for i in input().split())
if l<=0<=r: continue
L.append(l)
R.append(r)
L,R,a,b = sorted(L),sorted(R),-1,0
if R and L and R[0]<=0 and L[-1]>=0:
if abs(R[0])<L[-1]: flag,now,ans,a = True,L[-1],L[-1],-2
else: flag,now,ans,b = False,R[0],abs(R[0]),1
elif R and L and R[0]<=0 and L[-1]<0: flag,now,ans,b = False,R[0],abs(R[0]),1
elif R and L and R[0]>0 and L[-1]>=0: flag,now,ans,a = True,L[-1],L[-1],-2
else: ans,now = 0,0
while ans!=0 and b-a!=len(L)+1:
if flag: flag,now,ans,b = False,R[b],ans+abs(now-R[b]),b+1
else: flag,now,ans,a = True,L[a],ans+abs(now-L[a]),a-1
if print(ans+abs(now))
|
Statement
Takahashi and Aoki will play a game with a number line and some segments.
Takahashi is standing on the number line and he is initially at coordinate 0.
Aoki has N segments. The i-th segment is [L_i,R_i], that is, a segment
consisting of points with coordinates between L_i and R_i (inclusive).
The game has N steps. The i-th step proceeds as follows:
* First, Aoki chooses a segment that is still not chosen yet from the N segments and tells it to Takahashi.
* Then, Takahashi walks along the number line to some point within the segment chosen by Aoki this time.
After N steps are performed, Takahashi will return to coordinate 0 and the
game ends.
Let K be the total distance traveled by Takahashi throughout the game. Aoki
will choose segments so that K will be as large as possible, and Takahashi
walks along the line so that K will be as small as possible. What will be the
value of K in the end?
|
[{"input": "3\n -5 1\n 3 7\n -4 -2", "output": "10\n \n\nOne possible sequence of actions of Takahashi and Aoki is as follows:\n\n * Aoki chooses the first segment. Takahashi moves from coordinate 0 to -4, covering a distance of 4.\n * Aoki chooses the third segment. Takahashi stays at coordinate -4.\n * Aoki chooses the second segment. Takahashi moves from coordinate -4 to 3, covering a distance of 7.\n * Takahashi moves from coordinate 3 to 0, covering a distance of 3.\n\nThe distance covered by Takahashi here is 14 (because Takahashi didn't move\noptimally). It turns out that if both players move optimally, the distance\ncovered by Takahashi will be 10.\n\n* * *"}, {"input": "3\n 1 2\n 3 4\n 5 6", "output": "12\n \n\n* * *"}, {"input": "5\n -2 0\n -2 0\n 7 8\n 9 10\n -2 -1", "output": "34"}]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.