output_description stringlengths 15 956 | submission_id stringlengths 10 10 | status stringclasses 3 values | problem_id stringlengths 6 6 | input_description stringlengths 9 2.55k | attempt stringlengths 1 13.7k | problem_description stringlengths 7 5.24k | samples stringlengths 2 2.72k |
|---|---|---|---|---|---|---|---|
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s283573263 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | N, M = map(int, input().split())
pat = [[int(i) for i in input().split()] for _ in range(M)]
Graph = [[0 for i in range(N)] for _ in range(N)]
for i, j in pat:
Graph[i - 1][j - 1] = 1
Graph[j - 1][i - 1] = 1
def dfs(v, N=N, visit_list):
all_visit = True
for i in range(N):
if visit_list[i] == False:
all_visit = False
if all_visit:
return 1
ret = 0
for k in range(N):
if Graph[v][k] == False:
continue
if visit_list[k]:
continue
visit_list[k] = True
ret += dfs(k, N, visit_list)
visit_list[k] = False
return ret
visit_list = [False for i in range(N)]
visit_list[0] = True
print(dfs(0, N, visit_list))
| Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s250430477 | Wrong Answer | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | n, m = map(int, input().split())
graphs = list([list(map(int, input().split())) for x in range(m)])
def search_indecies(index, remainGraph):
indecies = []
for i, x in enumerate(remainGraph):
if x[0] == index or x[1] == index:
indecies.append(i)
return indecies
def search_iterative(currentGraph, currentNodeNum, currentIndex, path):
prev = currentNodeNum
currentNode = currentGraph.pop(currentIndex)
path.append(currentNode)
if len(path) == n - 1:
return [path]
nextNum = get_other_num(currentNode, prev)
nextCandidateIndecies = search_indecies(nextNum, currentGraph)
pathList = []
for nextIndex in nextCandidateIndecies:
nextNum = get_other_num(currentGraph[nextIndex], nextNum)
c = search_iterative(currentGraph[:], nextNum, nextIndex, path[:])
pathList.append(c)
return pathList
return []
def get_other_num(currentNode, prev):
return currentNode[0] if currentNode[1] == prev else currentNode[1]
startIndecies = search_indecies(1, graphs)
resuts = []
for startIndex in startIndecies:
path = []
resuts.append(search_iterative(graphs[:], 1, startIndex, path))
print(len(resuts))
| Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s706323058 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | def dfs(v):
for i in range(len(seen)):
if !seen[i] and i != v:
brea;
else:
res += 1
seen[i] = True
for nv in G[v]:
if seen[nv]:
continue
def(nv)
seen[i] = False
N, M = map(int, input().split())
G = dict([[i, [] for i in range(N)]])
for i in range(M):
a, b = map(int, input().split())
G[a-1].append(b-1)
G[b-1].append(a-1)
seen = [False]*N
res = 0
dfs(0)
print(res)
| Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s678594627 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | N, M = map(int, input().split())
matrix=[[0]*N for i in range(N)]
for i in range(M):
a, b = map(int, input().split())
matrix[a-1][b-1]=1
matrix[b-1][a-1]=1
import itertools
count=0
result=1
for i in itertools.permulations(range(1, N+1)):
if i==1:
for j in range(N-1):
result+=matrix[i[j]][i[j+1]]
if result=1:
count+=1
else:
result=1
else:
break
print(count) | Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s328568564 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | from itertools import permutations
n,m=map(int,input().split())
path=set()
for _ in range(m):
u,v=map(int,input().split())
path|={(u-1,v-1),(v-1,u-1)}
s = 0
for i in permutations(range(n)):
s+=(all((h,j) in path for h,j in zip(i[1:],i))) if i[0] ==0
print(s) | Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s429755951 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | N,M = gets.split.map(&:to_i)
g = Array.new(N){Array.new(N)}
M.times do |i|
a,b = gets.split.map(&:to_i).sort.reverse
a -= 1
b -= 1
g[a][b] = g[b][a] = 1
end
pattern = [*1...N].permutation.to_a.map{ |k| [0] + k }
ans = 0
pattern.each do |p|
f = true
(1...N).each do |i|
p [p[i-1], p[i]]
if g[p[i-1]][p[i]].nil?
f = false
break
end
end
ans += 1 if f
end
puts ans | Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s105446178 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | N, M = map(int, input().split())
matrix=[[0]*N for i in range(N)]
for i in range(M):
a, b = map(int, input().split())
matrix[a-1][b-1]=1
matrix[b-1][a-1]=1
import itertools
count=0
result=1
for i in itertools.permulations(range(1, N+1)):
if i==1:
for j in range():
result+=matrix[i[j]][i[j+1]]
if result=1:
count+=1
else:
result=1
print(count) | Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s971961629 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | import numpy as np
n,m=map(int,input().split())
if m==0:
print(0)
exit()
ans=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
ans[a-1].append((b-1))
ans[b-1].append((a-1))
v=[]
def dfs(now,visited=[]):
global v
if len(visited)==n:
v.append([visited])
return
for j in ans[now]:
for j not in visited:
dfs(j,visited+[j])
dfs(0,[0])
print(len(v)) | Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s791786160 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | import itertools
N, M = map(int, input().split())
p = [list(map(int, input().split())) for i in range(M)]
v = list(map(list, itertools.permutations(range(2,N+1), N-1)))
cnt = 0
for i in range(len(v)):
vit = True
v_i = [1]+v[i]
for j in range(N-1):
if sorted(v_i[j:j+2]) not in p:
vit = False
if vit:
cnt += 1
print(cnt) | Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s014879902 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | N,M=map(int,input().split())
tbl=[[0]*(N+1) for _ in range(N+1)]
for i in range(M):
a,b=map(int,input().split())
tbl[a][b]=1
tbl[b][a]=1 # グラフの行列を用いた表現
def dfs(s,visited):
if len(visited)==N:
return 1
ans=0
for i in range(1,N+1):
if i==s: continue #自己閉路は関係ない。
if tbl[s][i]==1 and (i not in visited):
visited.append(i)
ans+=dfs(i,visited)
visited.pop() #dfsを考えているからiをpopする。
return ans
answer=dfs(1,[1,])
print(answer)
| Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
Print the number of the different paths that start from vertex 1 and visit all
the vertices exactly once.
* * * | s380031187 | Runtime Error | p03805 | The input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M | from itertools import permutations
def f(n, m, uu, vv):
a = [[0] * n for _ in range(n)]
for u, v in zip(uu, vv):
a[u][v] = 1
a[v][u] = 1
res = 0
for p in permutations(range(n)):
if p[0] != 0:
break
ok = True
for i in range(n-1):。
if a[p[i][p[i+1]] == 0:
ok = False
break
if ok:
res += 1
return res
n,m = map(int,input().split())
a = []
b = []
for i in range(m):
_a, _b = map(int, input().split())
_a -= 1
_b -= 1
a.append(_a)
b.append(_b)
print(f(n, m, a, b))
| Statement
You are given an undirected unweighted graph with N vertices and M edges that
contains neither self-loops nor double edges.
Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are
two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices
exactly once?
Here, the endpoints of a path are considered visited.
For example, let us assume that the following undirected graph shown in Figure
1 is given.

Figure 1: an example of an undirected graph
The following path shown in Figure 2 satisfies the condition.

Figure 2: an example of a path that satisfies the condition
However, the following path shown in Figure 3 does not satisfy the condition,
because it does not visit all the vertices.

Figure 3: an example of a path that does not satisfy the condition
Neither the following path shown in Figure 4, because it does not start from
vertex 1.

Figure 4: another example of a path that does not satisfy the condition | [{"input": "3 3\n 1 2\n 1 3\n 2 3", "output": "2\n \n\nThe given graph is shown in the following figure:\n\n\n\nThe following two paths satisfy the condition:\n\n\n\n* * *"}, {"input": "7 7\n 1 3\n 2 7\n 3 4\n 4 5\n 4 6\n 5 6\n 6 7", "output": "1\n \n\nThis test case is the same as the one described in the problem statement."}] |
For each query, report IDs of points such that sxi ≤ x ≤ txi and syi ≤ y ≤
tyi. The IDs should be reported in ascending order. Print an ID in a line, and
print a blank line at the end of output for the each query. | s934345013 | Wrong Answer | p02347 | n
x0 y0
x1 y1
:
xn-1 yn-1
q
sx0 tx0 sy0 ty0
sx1 tx1 sy1 ty1
:
sxq-1 txq-1 syq-1 tyq-1
The first integer n is the number of points. In the following n lines, the
coordinate of the i-th point is given by two integers xi and yi.
The next integer q is the number of queries. In the following q lines, each
query is given by four integers, sxi, txi, syi, tyi. | class Node:
def __init__(self, nid, data):
self.nid = nid
self.data = data
self.left = None
self.right = None
class KDTree:
def __init__(self):
self.root = None
def fit(self, data):
if len(data) == 0:
raise Exception("List length must be larger than 0.")
self.d = len(data[0]["value"])
self.root = self._construct(data, 0)
def _construct(self, data, depth):
if len(data) == 0:
return None
elif len(data) == 1:
return Node(data[0]["id"], data[0]["value"])
data.sort(key=lambda x: x["value"][depth % self.d])
mid = len(data) // 2
node = Node(data[mid]["id"], data[mid]["value"])
node.left = self._construct(data[:mid], depth + 1)
node.right = self._construct(data[mid + 1 :], depth + 1)
return node
def find(self, rec):
if self.root is None:
raise Exception("Not yet constructed")
if len(rec) != self.d:
raise Exception("The number of dimensions doesn't match")
return self._search(self.root, rec, 0)
def _search(self, node, rec, depth):
ret = []
if node is not None:
r = depth % self.d
if rec[r][0] <= node.data[r]:
ret += self._search(node.left, rec, depth + 1)
if node.data[r] <= rec[r][1]:
ret += self._search(node.right, rec, depth + 1)
if self._contains(node, rec):
ret.append(node)
return ret
def _contains(self, node, rec):
for i in range(self.d):
if rec[i][1] < node.data[i]:
return False
if node.data[i] < rec[i][0]:
return False
return True
n = int(input())
data = []
for i in range(n):
x, y = list(map(int, input().split(" ")))
data.append({"id": i, "value": (x, y)})
q = int(input())
recs = []
for _ in range(q):
sx, tx, sy, ty = list(map(int, input().split(" ")))
recs.append(((sx, tx), (sy, ty)))
tree = KDTree()
tree.fit(data)
for i in range(q):
ret = tree.find(recs[i])
for node in ret:
print(node.nid)
print()
| Range Search (kD Tree)
The range search problem consists of a set of attributed records S to
determine which records from S intersect with a given range.
For n points on a plane, report a set of points which are within in a given
range. Note that you do not need to consider insert and delete operations for
the set. | [{"input": "6\n 2 1\n 2 2\n 4 2\n 6 2\n 3 3\n 5 4\n 2\n 2 4 0 4\n 4 10 2 5", "output": "0\n 1\n 2\n 4\n \n 2\n 3\n 5"}] |
For each query, report IDs of points such that sxi ≤ x ≤ txi and syi ≤ y ≤
tyi. The IDs should be reported in ascending order. Print an ID in a line, and
print a blank line at the end of output for the each query. | s940418566 | Runtime Error | p02347 | n
x0 y0
x1 y1
:
xn-1 yn-1
q
sx0 tx0 sy0 ty0
sx1 tx1 sy1 ty1
:
sxq-1 txq-1 syq-1 tyq-1
The first integer n is the number of points. In the following n lines, the
coordinate of the i-th point is given by two integers xi and yi.
The next integer q is the number of queries. In the following q lines, each
query is given by four integers, sxi, txi, syi, tyi. | n = int(input())
def memoize(f):
global n
memo = [-1] * n
def main(x):
result = memo[x]
if result == -1:
result = memo[x] = f(x)
return result
return main
class Bound:
def __init__(self, sx, tx, sy, ty):
self.sx = sx
self.tx = tx
self.sy = sy
self.ty = ty
def contains(self, point):
return self.sx <= point[1] <= self.tx and self.sy <= point[2] <= self.ty
def update_intersection(self, intersection, point, horizontal):
sx, tx, sy, ty = intersection
div = point[2 if horizontal else 1]
if horizontal:
return (sx, tx, sy, self.ty >= div) if self.sy <= div else None, (
(sx, tx, self.sy <= div, ty) if self.ty >= div else None
)
else:
return (sx, self.tx >= div, sy, ty) if self.sx <= div else None, (
(self.sx <= div, tx, sy, ty) if self.tx >= div else None
)
class Kdt:
LIMIT_TREE_NODES = 2**8 - 1
def __init__(self, n, points):
self.n = n
self.tree = [None] * n
self._build(0, points, n)
def _build(self, i, points, num):
depth = self.depth(i)
if num <= self.LIMIT_TREE_NODES:
self.tree[i] = (None, set(points) if depth >= 4 else None)
return
rnum = (num - 1) // 2
lnum = num - rnum - 1
xy_index = 2 if depth & 1 else 1
sorted_points = sorted(points, key=lambda p: p[xy_index])
self.tree[i] = (sorted_points[lnum], set(p[0] for p in points))
if lnum:
self._build(i * 2 + 1, sorted_points[:lnum], lnum)
if rnum:
self._build(i * 2 + 2, sorted_points[lnum + 1 :], rnum)
def search(self, i, bound, intersection):
node = self.tree[i]
point = node[0]
if point is None:
return set(p[0] for p in node[1] if bound.contains(p))
if all(intersection):
return node[1]
result = {point[0]} if bound.contains(point) else set()
li, ri = i * 2 + 1, i * 2 + 2
if li < self.n:
lis, ris = bound.update_intersection(intersection, point, self.depth(i) & 1)
if lis:
result |= self.search(li, bound, lis)
if ris and ri < self.n:
result |= self.search(ri, bound, ris)
return result
@staticmethod
@memoize
def depth(x):
"""x>=0"""
i, x = 0, (x + 1) // 2
while x:
x //= 2
i += 1
return i
point_list = [(i,) + tuple(map(int, input().split())) for i in range(n)]
kdt = Kdt(n, point_list)
q = int(input())
while q:
inside_points = kdt.search(0, Bound(*map(int, input().split())), tuple([False] * 4))
if inside_points:
print("\n".join(map(str, sorted(inside_points))))
print()
q -= 1
| Range Search (kD Tree)
The range search problem consists of a set of attributed records S to
determine which records from S intersect with a given range.
For n points on a plane, report a set of points which are within in a given
range. Note that you do not need to consider insert and delete operations for
the set. | [{"input": "6\n 2 1\n 2 2\n 4 2\n 6 2\n 3 3\n 5 4\n 2\n 2 4 0 4\n 4 10 2 5", "output": "0\n 1\n 2\n 4\n \n 2\n 3\n 5"}] |
For each query, report IDs of points such that sxi ≤ x ≤ txi and syi ≤ y ≤
tyi. The IDs should be reported in ascending order. Print an ID in a line, and
print a blank line at the end of output for the each query. | s693126703 | Runtime Error | p02347 | n
x0 y0
x1 y1
:
xn-1 yn-1
q
sx0 tx0 sy0 ty0
sx1 tx1 sy1 ty1
:
sxq-1 txq-1 syq-1 tyq-1
The first integer n is the number of points. In the following n lines, the
coordinate of the i-th point is given by two integers xi and yi.
The next integer q is the number of queries. In the following q lines, each
query is given by four integers, sxi, txi, syi, tyi. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import stdin
from operator import attrgetter
from collections import namedtuple
class Node(object):
__slots__ = ("location", "left", "right")
def __init__(self):
self.location = -1
self.left, self.right = None, None
def make2DTree(left, right, depth):
global np
if not left < right:
return None
mid = (left + right) // 2
cursor = np
np += 1
if depth % 2 == 0:
points_list[left:right] = sorted(points_list[left:right], key=attrgetter("x"))
else:
points_list[left:right] = sorted(points_list[left:right], key=attrgetter("y"))
node_list[cursor].location = mid
node_list[cursor].left = make2DTree(left, mid, depth + 1)
node_list[cursor].right = make2DTree(mid + 1, right, depth + 1)
return cursor
def find(v, sx, tx, sy, ty, depth):
_point = points_list[node_list[v].location]
x, y, p_index = _point.x, _point.y, _point.i
if (sx <= x <= tx) and (sy <= y <= ty):
ans.append(p_index)
if depth % 2 == 0:
if node_list[v].left is not None and sx <= x:
find(node_list[v].left, sx, tx, sy, ty, depth + 1)
if node_list[v].right is not None and x <= tx:
find(node_list[v].right, sx, tx, sy, ty, depth + 1)
else:
if node_list[v].left is not None and sy <= y:
find(node_list[v].left, sx, tx, sy, ty, depth + 1)
if node_list[v].right is not None and y <= ty:
find(node_list[v].right, sx, tx, sy, ty, depth + 1)
return None
def action():
global ans
for area in areas:
sx, tx, sy, ty = map(int, area)
find(root, sx, tx, sy, ty, 0)
print(*sorted(ans), sep="\n")
print("")
ans = []
return None
if __name__ == "__main__":
_input = stdin.readlines()
points_num = int(_input[0])
point = namedtuple("Point", "i x y")
points_list = [
point(i=index, x=int(each[0]), y=int(each[2]))
for index, each in enumerate(_input[1 : points_num + 1])
]
areas_num = int(_input[points_num + 1])
areas = map(lambda x: x.split(), _input[points_num + 2 :])
node_list = [Node() for _ in range(points_num)]
np = 0
ans = []
root = make2DTree(0, points_num, 0)
action()
| Range Search (kD Tree)
The range search problem consists of a set of attributed records S to
determine which records from S intersect with a given range.
For n points on a plane, report a set of points which are within in a given
range. Note that you do not need to consider insert and delete operations for
the set. | [{"input": "6\n 2 1\n 2 2\n 4 2\n 6 2\n 3 3\n 5 4\n 2\n 2 4 0 4\n 4 10 2 5", "output": "0\n 1\n 2\n 4\n \n 2\n 3\n 5"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s927509560 | Accepted | p03106 | Input is given from Standard Input in the following format:
A B K | A, B, C = list(map(int, input().split(" ")))
min_number = min(A, B)
listA = []
for i in range(1, min_number + 1):
if A % i == 0 and B % i == 0:
listA.append(i)
listA.sort(reverse=True)
print(listA[C - 1])
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s355498461 | Accepted | p03106 | Input is given from Standard Input in the following format:
A B K | a = list(map(int, input().split()))
kiroku = []
for i in range(min(a[0], a[1])):
if max(a[0], a[1]) % (i + 1) == 0 and min(a[0], a[1]) % (i + 1) == 0:
kiroku.append(i + 1)
print(kiroku[-a[2]])
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s989094237 | Wrong Answer | p03106 | Input is given from Standard Input in the following format:
A B K | A, B, K = [int(_) for _ in input().split()]
M = A * B
print(M * K)
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s092990673 | Accepted | p03106 | Input is given from Standard Input in the following format:
A B K | A, B, K = [int(i) for i in input().split()]
tmp = []
for j in range(1, 101):
if A % j == 0 and B % j == 0:
tmp.append(j)
tmp = tmp[::-1]
print(tmp[K - 1])
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s291396242 | Accepted | p03106 | Input is given from Standard Input in the following format:
A B K | line = input()
a, b, c = [int(n) for n in line.split()]
if a > b:
maior = a
menor = b
else:
maior = b
menor = a
v = []
for i in range(1, menor + 1, 1):
if menor % i == 0 and maior % i == 0:
v.append(i)
print(v[-c])
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s489117375 | Wrong Answer | p03106 | Input is given from Standard Input in the following format:
A B K | a = [0, 0]
s = []
a[0], a[1], k = map(int, input().split())
for i in range(1, max(a) + 1):
if a[0] % i == 0 and a[1] % i == 0:
s.append(i)
print(s[k - 1])
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s579986391 | Wrong Answer | p03106 | Input is given from Standard Input in the following format:
A B K | a, b, k = map(int, input().split())
ab = [i for i in range(1, 100) if a % i == 0 and a / i > 0] + [
i for i in range(1, 100) if b % i == 0 and b / i > 0
]
AB = [i for i in set(ab) if ab.count(i) > 1]
AB.sort(reverse=True)
print(AB[k - 1])
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the K-th largest positive integer that divides both A and B.
* * * | s301408957 | Wrong Answer | p03106 | Input is given from Standard Input in the following format:
A B K | # Common Division
Ai, Bi, K = map(int, input().strip().split())
A = max([Ai, Bi])
B = min([Ai, Bi])
if A % B == 0:
rnk = 1
else:
rnk = 0
S = B // 2
s = B
print("S is {}".format(S))
for s in range(1, S + 1)[::-1]:
print("s is {}".format(s))
if A % s == 0 and B % s == 0:
rnk += 1
if rnk == K:
break
print(s)
| Statement
You are given positive integers A and B.
Find the K-th largest positive integer that divides both A and B.
The input guarantees that there exists such a number. | [{"input": "8 12 2", "output": "2\n \n\nThree positive integers divides both 8 and 12: 1, 2 and 4. Among them, the\nsecond largest is 2.\n\n* * *"}, {"input": "100 50 4", "output": "5\n \n\n* * *"}, {"input": "1 1 1", "output": "1"}] |
Print the largest square number not exceeding N.
* * * | s624739954 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | print(int((pow(int(input()), 1 / 2) // 1) ** 2))
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s178224902 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | N = int(input())
heihousu = []
s = 0
t = 0
while t <= N:
s += 1
t = s**2
heihousu.append(t)
print(heihousu[-2])
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s244707448 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | print((pow(int(input()), 1 / 2) % 1) ** 2)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s733373290 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | print((pow(int(input()), 1 / 2) // 1) ** 2)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s752781686 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | import math
print(math.floor(math.sqrt(int(input())))
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s960136522 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | import math
x=int(input())
y= math.sqrt(x)
z= y//1
print(int(z) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s134944154 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | import math
N = int(input())
ans = 1
for i in range(10**5):
if i**2 =< N:
ans = i**2
if i**2 > N:
break
print(ans)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s096415024 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | N=int(input())
C=0
for i in range(1,N):
if i**2<N:
C=i**2
elif i**2=N:
C=i**2
break
elif i**2>N:
break
print(C) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s356919127 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | print(pow(int(pow(int(input()), 0.5)), 2))
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s923031343 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | n=int(input())
for i in range(1,40000):
if i*i>n:
print(i-1)
break
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s281076074 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | import sys
## io ##
def IS():
return sys.stdin.readline().rstrip()
def II():
return int(IS())
def MII():
return list(map(int, IS().split()))
def MIIZ():
return list(map(lambda x: x - 1, MII()))
## dp ##
def DD2(d1, d2, init=0):
return [[init] * d2 for _ in range(d1)]
def DD3(d1, d2, d3, init=0):
return [DD2(d2, d3, init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str:
return format(x, "b") # rev => int(res, 2)
def to_oct(x: int) -> str:
return format(x, "o") # rev => int(res, 8)
def to_hex(x: int) -> str:
return format(x, "x") # rev => int(res, 16)
MOD = 10**9 + 7
def divc(x, y) -> int:
return -(-x // y)
def divf(x, y) -> int:
return x // y
def gcd(x, y):
while y:
x, y = y, x % y
return x
def lcm(x, y):
return x * y // gcd(x, y)
def enumerate_divs(n):
"""Return a tuple list of divisor of n"""
return [(i, n // i) for i in range(1, int(n**0.5) + 1) if n % i == 0]
def get_primes(MAX_NUM=10**3):
"""Return a list of prime numbers n or less"""
is_prime = [True] * (MAX_NUM + 1)
is_prime[0] = is_prime[1] = False
for i in range(2, int(MAX_NUM**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, MAX_NUM + 1, i):
is_prime[j] = False
return [i for i in range(MAX_NUM + 1) if is_prime[i]]
def prime_factor(n):
"""Return a list of prime factorization numbers of n"""
res = []
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
res.append(i)
n //= i
if n != 1:
res.append(n)
return res
## libs ##
from itertools import (
accumulate as acc,
combinations as combi,
product,
combinations_with_replacement as combi_dup,
)
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
# ======================================================#
def main():
n = II()
print(int(n ** (1 / 2)) ** 2)
if __name__ == "__main__":
main()
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s441442857 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | A = int(input())
print(int((A ** (0.5) // 1) ** 2))
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s552518351 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | print(int(int(input()) * 0.5) ** 2)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s117463715 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | int(int(input()) ** 0.5)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s291004772 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | import math
print(int(math.sqrt(int(input()))) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s796544580 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | print(max([i * i for i in range(10001) if int(input()) >= i]))
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s743762565 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | print((lambda x: max([i * i for i in range(10001) if x >= i]))(int(input())))
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s187158434 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | # region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import (
accumulate,
groupby,
product,
permutations,
combinations,
combinations_with_replacement,
)
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float("inf")
MOD = 10**9 + 7
PI = math.pi
# endregion
N = ri()
print(floor(sqrt(N)) ** 2)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s457364258 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]
lcm = lambda x, y: (x * y) // math.gcd(x, y)
MOD = 10**9 + 7
MAX = float("inf")
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = ii()
ret = 0
for n in range(int(N**0.5) + 1):
if n * n <= N:
ret = max(ret, n * n)
print(ret)
if __name__ == "__main__":
main()
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s335367652 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | import math
n = int(input())
for i in the range(n+1):
ans= math.sqrt(i)
ans= str(ans)
if "." not in ans:
print(ans)
break
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s304418176 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | ###==================================================
### import
# import bisect
# from collections import Counter, deque, defaultdict
# from copy import deepcopy
# from functools import reduce, lru_cache
# from heapq import heappush, heappop
# import itertools
# import math
# import string
import sys
### stdin
def input():
return sys.stdin.readline().rstrip()
def iIn():
return int(input())
def iInM():
return map(int, input().split())
def iInM1():
return map(int1, input().split())
def iInLH():
return list(map(int, input().split()))
def iInLH1():
return list(map(int1, input().split()))
def iInLV(n):
return [iIn() for _ in range(n)]
def iInLV1(n):
return [iIn() - 1 for _ in range(n)]
def iInLD(n):
return [iInLH() for _ in range(n)]
def iInLD1(n):
return [iInLH1() for _ in range(n)]
def sInLH():
return list(input().split())
def sInLV(n):
return [input().rstrip("\n") for _ in range(n)]
def sInLD(n):
return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=" "):
print(deli.join(map(str, lst)))
def OutV(lst):
print("\n".join(map(str, lst)))
### setting
sys.setrecursionlimit(10**6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------
N = iIn()
n = 1
while n**2 > N:
n += 1
print(n)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s945059242 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | n = int(input())
s = [i**2 for i in range(1, 10**5)]
q = sorted(s, reverse=True)
w = 0
while q[w] >= n:
w += 1
print(q[w])
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s774566110 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | print(int((int(input()) ** 0.5)) ** 2)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s879514576 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | n = int(input())
print(int(n**.5) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s566875366 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | print(round(int(input()) ** 0.5) ** 2)
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s918003088 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | print(int(int(input()))**0.5)**2) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s174540427 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | X = int(input())
print(int(X**0.5)**2) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s675221056 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | n = int(input())
print(int((n**.5)**2) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s405420314 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | import math
print(int(math.sqrt(int(input()))) ** 2 | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s414936929 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | print(int(int(input()) ** 0.5 // 1))
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s833040705 | Wrong Answer | p03556 | Input is given from Standard Input in the following format:
N | print(str(int(input()) ** 0.5).split(".")[0])
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s828752237 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | N=int(input())
for i in range(N):
if (i**2)>N:
break:
print(max((i-1)**2,1)) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s238538958 | Accepted | p03556 | Input is given from Standard Input in the following format:
N | import math
def A():
a, b = [int(x) for x in input().split()]
print(math.ceil((a + b) / 2))
def B():
a = "".join(sorted(list(input()), key=lambda x: ord(x)))
b = "".join(sorted(list(input()), key=lambda x: -ord(x)))
if a < b:
print("Yes")
else:
print("No")
def C():
N = input()
A = [x for x in input().split()]
counter = {}
for a in A:
if a in counter:
counter[a] += 1
else:
counter[a] = 1
remove_count = 0
for key in counter:
if counter[key] - int(key) >= 0:
remove_count += counter[key] - int(key)
else:
remove_count += counter[key]
print(remove_count)
def E():
s1 = input()
s2 = input()
if s1 == s2[::-1]:
print("YES")
else:
print("NO")
def F():
a = int(input())
sqrt = math.floor(math.sqrt(a))
print(sqrt * sqrt)
F()
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s367472327 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | import math
N = int(input())
int ans = 0;
for i in range(1, math.sqrt(N+1)):
if(i == int(math.sqrt(i))*int(math.sqrt(i))):
ans = i
print(i) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s564843002 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | N = int(input().strip())
count = 0
while True:
if (count + 1) ** 2 > N:
print(coun ** 2t)
break
count += 1 | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s798126115 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | #include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
typedef long long ll;
using namespace std;
int main(){
int N; cin >> N;
int i=1;
while(N>=i*i){
i++;
}
cout << (i-1)*(i-1);
} | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s333668525 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | N=int(input())
while for i in range(1,N+1):
if i**2>N:
break
answer=i**2
print(answer) | Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print the largest square number not exceeding N.
* * * | s604186045 | Runtime Error | p03556 | Input is given from Standard Input in the following format:
N | N=gets.to_i
ans = 0
sq = (N**(0.5)).to_i
(sq..sq+10).each do |i|
ans = i*i if i*i <= N
end
puts ans
| Statement
Find the largest square number not exceeding N. Here, a _square number_ is an
integer that can be represented as the square of an integer. | [{"input": "10", "output": "9\n \n\n10 is not square, but 9 = 3 \u00d7 3 is. Thus, we print 9.\n\n* * *"}, {"input": "81", "output": "81\n \n\n* * *"}, {"input": "271828182", "output": "271821169"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s887719377 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print(("Yes", "No")[int(input()) < 30])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s238118302 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print("Yes" if int(input()) > 30 else "No")
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s725497921 | Runtime Error | p02594 | Input is given from Standard Input in the following format:
X | N = int(input())
c = list(input())
if c.count("R") == N:
print(0)
exit()
div = 0
addcnt = 0
if N % 2 == 1:
div = 1
Q = c[int(N / 2)]
# print(Q)
if Q == "W":
addcnt += 1
# print('QQQ!')
clist_L = c[: int(N / 2)]
clist_R = c[int(N / 2) + div :]
Lcnt = clist_L.count("W")
Rcnt = clist_R.count("R")
if Lcnt - Rcnt <= 0:
print(Rcnt - addcnt)
else:
print(Lcnt - Rcnt + addcnt)
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s241817480 | Runtime Error | p02594 | Input is given from Standard Input in the following format:
X | input()
s = input()
def find_cost(s):
counter, i, j = 0, 0, len(s) - 1
while i < j:
while i < len(s) and s[i] != "W":
i += 1
while j >= 0 and s[j] != "R":
j -= 1
if i < j:
s[i], s[j] = s[j], s[i]
counter += 1
i += 1
j -= 1
for i in range(0, len(s) - 2):
if s[i] == "W" and s[i + 1] == "R":
counter += 1
print(counter)
s = list(s)
find_cost(s)
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s301091405 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print("Hello World")
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s623547669 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print("YNeos"[input() < "3" :: 2])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s405282522 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print("YNeos"[input() < "30" :: 2])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s133898813 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print("Yes") if 30 <= int(input()) else print("No")
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s941824193 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | a = ["No", "Yes"]
print(a[int(input()) >= 30])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s760781358 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print("Yes" if int(input().strip()) >= 30 else "No")
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s871230563 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print("YNeos"[int(open(0).read()) < 30 :: 2])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s491328520 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print("Yes") if int(input()) >= 30 else print("No")
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s708111647 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print("NYoe s"[int(input()) >= 30 :: 2])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s243748022 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | x = int(input(()))
print(["No", "Yes"][x >= 30])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s850111013 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print(int(input()) >= 30)
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s992435248 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print("No" if int(input()) < 30 else "Yes")
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s124551986 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print("YNeos"[max(int(input()) // 30, 0) : 5 : 2])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s792743304 | Accepted | p02594 | Input is given from Standard Input in the following format:
X | print("Yes") if (int(input()) >= 30) else print("No")
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s309037245 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print("YNEOS"[int(input()) < 30 :: 2])
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s231438880 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | print(0)
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s025669608 | Wrong Answer | p02594 | Input is given from Standard Input in the following format:
X | import os
import sys
import numpy as np
def solve(inp):
def bit_add(arr, n, i, x):
while i <= n:
arr[i] += x
i += i & -i
def bit_sum(arr, i):
result = 0
while i > 0:
result += arr[i]
i ^= i & -i
return result
if inp[0] >= 30:
return "Yes"
else:
return "No"
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("my_module")
cc.export("solve", "(i8[:],)")(solve)
cc.compile()
exit()
if os.name == "posix":
# noinspection PyUnresolvedReferences
from my_module import solve
else:
from numba import njit
solve = njit("(i8[:],)", cache=True)(solve)
print("compiled", file=sys.stderr)
inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=" ")
ans = solve(inp)
print("\n".join(map(str, ans)))
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s492301531 | Runtime Error | p02594 | Input is given from Standard Input in the following format:
X | N, K = map(int, input().split())
A = sorted(map(int, input().split()))
start = 0
end = A[-1]
while end - start != 0:
l = (start + end) / 2
count = 0
for i in range(N):
count += (A[i] - 1) // l
if count > K:
start = int(l)
else:
end = int(l + 1)
print(int(l) + 1)
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s995230801 | Runtime Error | p02594 | Input is given from Standard Input in the following format:
X | n, q = map(int, input().split())
cn = list(map(int, input().split()))
s = [-1] * (n + 1)
t = [0] * n
for i in range(n):
j = cn[i]
if s[j] == -1:
t[i] = -1
s[j] = i
else:
t[i] = s[j]
s[j] = i
ans = [0] * q
for i in range(q):
count = 0
l, r = map(int, input().split())
for j in range(l - 1, r):
if t[j] >= l - 1:
count += 1
ans[i] = r - l + 1 - count
for i in ans:
print(i)
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
Print `Yes` if you will turn on the air conditioner; print `No` otherwise.
* * * | s046234153 | Runtime Error | p02594 | Input is given from Standard Input in the following format:
X | import sys
import numpy as np
# from numba import njit#,i8
# @njit(cache=True)
# @jit(返り値の型(引数1の型,引数2の型,...,引数nの型))
# @jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:]))
def main(N, Q, C, queries, orderByR, mostRightColorIndex, bitArray):
def add(itemCount, items, i, value):
while i <= itemCount:
items[i] += value
i += i & (-i)
def sumFromStart(items, end):
summary = 0
i = end
while i > 0:
summary += items[i]
i -= i & (-i)
return summary
def sum(items, start, end):
summary = sumFromStart(items, end) - sumFromStart(items, start - 1)
return summary
# 答え配列
ans = np.zeros(Q, dtype=np.int64)
# ans=[0]*Q
# 左からBITと現在色の更新をしながら、クエリのrightに到達したときにBITにクエリ発行する
qindex = 0
for n in range(N):
# 外側のループでは、全部の色をループ
if Q <= qindex:
break
if 0 < mostRightColorIndex[C[n]]:
# ループ中の場所の色のindexが既にある場合(=過去に、同じ色が登録されていた場合)
# 今回で、同じ色の一番右側の要素はループ中の要素になる
# 前登録したこの色の一番右のindexを一度BITから抜く(↓で再度登録される)
add(N, bitArray, mostRightColorIndex[C[n]], -1)
# この要素の色の一番右のindexを、BITに登録
mostRightColorIndex[C[n]] = n + 1
add(N, bitArray, n + 1, 1)
# while qindex < Q and n+1 == queries[qindex][2]:
while qindex < Q and n + 1 == queries[orderByR[qindex]][1]:
# 今のBITが次のクエリ発行するための状態(n==query.right)だったら、クエリ発行
tmpIndex = orderByR[qindex]
start = queries[tmpIndex][0]
end = queries[tmpIndex][1]
ans[tmpIndex] = sum(bitArray, start, end)
# print(tmpIndex,start,end,ans[tmpIndex])
qindex += 1
return ans
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
cc.export("main", "i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])")(main)
main = njit(main, cache=True)
cc.compile()
exit(0)
from my_module import main
# from numba import njit
# main=njit('i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])', cache=True)(main)
def input():
return sys.stdin.readline()
N, Q = map(int, input().split())
C = np.array(input().split(), int)
# Query取得-rightでソート
# dtypeQuery = [("index", int), ("start", int), ("end", int)]
queries = np.empty((Q, 2), int)
# #rights=[[] for _ in range(N+1)]
for q in range(Q):
l, r = map(int, input().split())
# queries[q] = (q,l,r)
queries[q][0] = l
queries[q][1] = r
# queries=np.sort(queries,order="end")
# queries=np.array(sys.stdin.buffer.read().split(),int).reshape(Q,2)
orderByR = np.argsort(queries[:, 1])
# 各色の現在の一番右のindex
mostRightColorIndex = np.zeros(N + 1, int)
# bit indexed tree
bitArray = np.zeros(N + 1, int)
for a in main(N, Q, C, queries, orderByR, mostRightColorIndex, bitArray):
print(a)
| Statement
You will turn on the air conditioner if, and only if, the temperature of the
room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the
air conditioner? | [{"input": "25", "output": "No\n \n\n* * *"}, {"input": "30", "output": "Yes"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s658321783 | Accepted | p03385 | Input is given from Standard Input in the following format:
S | print(["No", "Yes"][input() in "abcab bacba"])
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s110224171 | Accepted | p03385 | Input is given from Standard Input in the following format:
S | print("YNeos"[len(set(input())) < 3 :: 2])
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s878966124 | Accepted | p03385 | Input is given from Standard Input in the following format:
S | print("YNeos"[len(set(input())) != 3 :: 2])
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s589326244 | Accepted | p03385 | Input is given from Standard Input in the following format:
S | print(["No", "Yes"]["".join(sorted(input())) == "abc"])
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s986459183 | Accepted | p03385 | Input is given from Standard Input in the following format:
S | print("NYoe s"[sum([ord(i) for i in input()]) == 294 :: 2])
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s973977091 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | s = input()
print('Yes' if s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2] else 'No') | Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s699814535 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | a = input()
if .join(sorted(a))=="abc":
print("Yes")
else:
print("No") | Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s636390414 | Wrong Answer | p03385 | Input is given from Standard Input in the following format:
S | print("YNeos"[sorted(input()) != "abc" :: 2])
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s724252821 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | S = input()
if set(S) == {'a', 'b', 'c'}:
print('Yes')
else: | Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s181645778 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | s = input()
if s.count("a")*s.count("b")*s.count("c") == 1:
print("Yes)
else:
print("No") | Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s498934011 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | s = input()
s.sort()
if "".join(s) = "abc":
print("Yes")
else:
print("No") | Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s515457884 | Accepted | p03385 | Input is given from Standard Input in the following format:
S | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(map(list, sys.stdin.readline().split()))
def S():
return list(sys.stdin.readline())[:-1]
def IR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = I()
return l
def LIR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = LI()
return l
def SR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = S()
return l
def LSR(n):
l = [None for i in range(n)]
for i in range(n):
l[i] = SR()
return l
mod = 1000000007
sys.setrecursionlimit(1000000)
# A
def A():
s = S()
a = s.count("a")
b = s.count("b")
c = 3 - a - b
if a & b & c:
print("Yes")
else:
print("No")
# B
def B():
a, b, k = LI()
ans = []
for i in range(a, min(a + k, b + 1)):
ans.append(i)
for i in range(max(a, b - k + 1), b + 1):
ans.append(i)
ans = list(set(ans))
ans.sort()
for i in ans:
print(i)
# C
def C():
a, b, c = LI()
ans = 0
if a % 2:
if b % 2:
if not c % 2:
ans += 1
a += 1
b += 1
else:
ans += 1
if not c % 2:
b += 1
c += 1
else:
a += 1
c += 1
else:
if b % 2:
ans += 1
if not c % 2:
a += 1
c += 1
else:
b += 1
c += 1
else:
if c % 2:
ans += 1
a += 1
b += 1
ans += (3 * max(a, b, c) - a - b - c) // 2
print(ans)
# D
def D():
q = I()
for i in range(q):
a, b = LI()
x = int((a * b) ** 0.5)
y = math.ceil((a * b) / x) - 1
ans = x + y - 2
if a == b:
ans += 1
print(ans)
# E
def E():
s = S()
f = {"N": 0, "W": 0, "S": 0, "E": 0}
for i in s:
f[i] = 1
if f["N"] ^ f["S"]:
print("No")
elif f["W"] ^ f["E"]:
print("No")
else:
print("Yes")
# F
def F():
return
# G
def G():
return
# H
def H():
return
# Solve
if __name__ == "__main__":
A()
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s216835747 | Accepted | p03385 | Input is given from Standard Input in the following format:
S | from functools import reduce
import math
def main():
# 文字列の2進数を数値にする
# '101' → '5'
# 文字列の頭に'0b'をつけてint()にわたす
# binary = int('0b'+'101',0)
# 2進数で立っているbitを数える
# 101(0x5) → 2
# cnt_bit = bin(5).count('1')
# N! を求める
# f = math.factorial(N)
# N の逆元
# N_inv = pow(N,MOD-2,MOD)
# nCr
# Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
# 切り捨て
# 4 // 3
# 切り上げ
# -(-4 // 3)
# 初期値用:十分大きい数(100億)
INF = float("inf")
# 大きな素数
MOD = 10**9 + 7
# 1文字のみを読み込み
# 入力:2
# a = input().rstrip()
# 変数:a='2'
# スペース区切りで標準入力を配列として読み込み
# 入力:2 4 5 7
# a, b, c, d = (int(_) for _ in input().split())
# 変数:a=2 b=4 c=5 d =7
# 1文字ずつ標準入力を配列として読み込み
# 入力:2 4 5 7
# a = list(int(_) for _ in input().split())
# 変数:a = [2, 4, 5, 7]
# 1文字ずつ標準入力を配列として読み込み
# 入力:2457
# a = list(int(_) for _ in input())
# 変数:a = [2, 4, 5, 7]
S = list(_ for _ in input())
S.sort()
S = "".join(S)
if S == "abc":
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s838868517 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
S = input()
S = sorted(S)
if S = ['a','b','c']:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s252403237 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | import sys
input = sys.stdin.readline
s=input().strip()
a=[]
for i in range(3):
a.append(s[i])
a.sort()
if a[0]=="a" and a[1]=="b" and a[2]="c":
print("Yes")
else:
print("No")
| Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
* * * | s934544527 | Runtime Error | p03385 | Input is given from Standard Input in the following format:
S | lst1 = list(input())
iflen(lst1) != 3:
print("No")
exit()
for i in ["a","b","c"]:
if not i in lst1:
print("No")
exit()
print("Yes") | Statement
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine
if S can be obtained by permuting `abc`. | [{"input": "bac", "output": "Yes\n \n\nSwapping the first and second characters in `bac` results in `abc`.\n\n* * *"}, {"input": "bab", "output": "No\n \n\n* * *"}, {"input": "abc", "output": "Yes\n \n\n* * *"}, {"input": "aaa", "output": "No"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.