s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s158579434 | p03725 | u766684188 | 1551929534 | Python | Python (3.4.3) | py | Runtime Error | 2111 | 105624 | 855 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil
def dist(h,w,x,y):
return min(x-1,h-x,y-1,w-y)
h,w,k=map(int,input().split())
MAP=[]
A=['#']*(w+2)
MAP.append(A)
for i in range(h):
s='#'+input().strip()+'#'
for j,t in enumerate(s):
... |
s013681693 | p03725 | u766684188 | 1551929151 | Python | Python (3.4.3) | py | Runtime Error | 270 | 14324 | 755 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil
h,w,k=map(int,input().split())
MAP=[]
for i in range(h):
s=list(input().strip())
for j,t in enumerate(s):
if t=='S':
sx,sy=i,j
MAP.append(s)
delta=[[1,0],[0,1],[-1,0],[0,... |
s433641599 | p03725 | u766684188 | 1551928740 | Python | Python (3.4.3) | py | Runtime Error | 266 | 14324 | 747 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil
h,w,k=map(int,input().split())
MAP=[]
for i in range(h):
s=list(input().strip())
for j,t in enumerate(s):
if t=='S':
sx,sy=i,j
MAP.append(s)
delta=[[1,0],[0,1],[-1,0],[0,... |
s097005097 | p03725 | u766684188 | 1551928110 | Python | Python (3.4.3) | py | Runtime Error | 2133 | 361268 | 725 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil
def dist(h,w,x,y):
return min(x-1,h-x,y-1,w-y)
h,w,k=map(int,input().split())
MAP=[]
A=['#']*(w+2)
MAP.append(A)
for i in range(h):
s='#'+input().strip()+'#'
for j,t in enumerate(s):
... |
s372562584 | p03725 | u766684188 | 1551927248 | Python | Python (3.4.3) | py | Runtime Error | 2111 | 105620 | 821 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil
def dist(h,w,x,y):
return min(x-1,h-x,y-1,w-y)
h,w,k=map(int,input().split())
delta=[[1,0],[0,1],[-1,0],[0,-1]]
MAP=[]
A=['#']*(w+2)
MAP.append(A)
for i in range(h):
s='#'+input().strip()+'#'
... |
s652705083 | p03725 | u766684188 | 1551926276 | Python | Python (3.4.3) | py | Runtime Error | 1086 | 60728 | 807 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil
def dist(h,w,x,y):
return min(x-1,h-x,y-1,w-y)
h,w,k=map(int,input().split())
delta=[[1,0],[0,1],[-1,0],[0,-1]]
MAP=[]
A=['#']*(w+2)
MAP.append(A)
for i in range(h):
s=input()
for j,t in en... |
s276759478 | p03725 | u064408584 | 1551504591 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38640 | 634 | #h,w,k=map(int, input().split())
#s=[list(input()) for i in range(h)]
p=[[-1]*w for i in range(h)]
for i in range(h):
for j in range(w):
if s[i][j]=='S':
sta=(i,j)
np=[(1,0),(-1,0),(0,1),(0,-1)]
q={sta}
p[sta[0]][sta[1]]=0
step=0
while step<k and q:
step+=1
now=q.pop()
for i,j in np:... |
s491066886 | p03725 | u562935282 | 1544920724 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1135 | # https://beta.atcoder.jp/contests/agc014/submissions/1268295
import sys
input = sys.stdin.readline().rstrip()
def solve():
H, W, K = map(int, input().split())
a = [[False for _ in range(W)] for _ in range(H)]
visited = [[False for _ in range(W)] for _ in range(H)]
sy, sx = -1, -1
for r in range... |
s318920338 | p03725 | u562935282 | 1544916346 | Python | Python (3.4.3) | py | Runtime Error | 247 | 42984 | 1023 | import sys
sys.setrecursionlimit(10 ** 9)
def start_pos():
for r in range(H):
for c in range(W):
if a[r][c] == 'S':
return r, c
return -1, -1
def shortest_len(y, x):
return min(y, H - 1 - y, x, W - 1 - x)
def dfs(y, x, k):
global need_len
if b[y][x]: return... |
s271207784 | p03725 | u562935282 | 1544915997 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4740 | 885 | def start_pos():
for r in range(H):
for c in range(W):
if a[r][c] == 'S':
return r, c
return -1, -1
def shortest_len(y, x):
return min(y, H - 1 - y, x, W - 1 - x)
def dfs(y, x, k):
global need_len
if not(0 <= y < H and 0 <= x < W): return
if a[y][x] == '#'... |
s962163875 | p03725 | u884982181 | 1544581887 | Python | PyPy3 (2.4.0) | py | Runtime Error | 437 | 105948 | 742 | h,w,k = map(int,input().split())
a = []
for i in range(h):
b = input()
tmp = []
for j in range(w):
tmp.append(b[j])
if b[j] == "S":
sx = i
sy = j
a.append(tmp)
ma = [[0]*w for i in range(h)]
def dfs(x,y):
if ma[x][y] == 1:
return
ma[x][y] = 1
if x > 0 and a[x-1][y]== ".":
dfs(x... |
s671664240 | p03725 | u729133443 | 1543386969 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38512 | 439 | from collections import deque;h,w,k=map(int,input().split());m=[input()for _ in[0]*h];v=[[-1]*w for _ in[0]*h];r=9**20
for i in range(h):
if'S'in m[i]:j=m[i].index('S');q=deque([[i,j]])v[i][j]=0
while q:
y,x=q.popleft()
r=min(r,y,x,h-1-y,w-1-x)
if v[y][x]==k:continue
for i,j in([1,0],[-1,0],[0,1],[0,-1]):
t,u=y+... |
s244122624 | p03725 | u284102701 | 1515211425 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1366 | #include <bits/stdc++.h>
//#include <math.h>
using namespace std;
#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(... |
s033316201 | p03725 | u035336908 | 1503114232 | Python | Python (3.4.3) | py | Runtime Error | 203 | 9644 | 628 | def Solve():
H, W, K = [int(i) for i in input().split()]
S = (0,0)
A = [[0] * W for i in range(H)]
for iy in range(H):
a = input()
for ix in range(W):
if a[ix] == "S":
S = (ix, iy)
A[iy][ix] = 0
elif a[ix] == "#":
A[iy][ix] = 1
elif a[ix] == ".":
A[iy][ix] = 0
def recursive(p):
for c... |
s811176417 | p03725 | u035336908 | 1503114156 | Python | Python (3.4.3) | py | Runtime Error | 203 | 9644 | 638 | def Solve():
H, W, K = [int(i) for i in input().split()]
S = (0,0)
A = [[0] * W for i in range(H)]
for iy in range(H):
a = input()
for ix in range(W):
if a[ix] == "S":
S = (ix, iy)
A[iy][ix] = 0
elif a[ix] == "#":
A[iy][ix] = 1
elif a[ix] == ".":
A[iy][ix] = 0
def recursive(p):
for c... |
s382278777 | p03725 | u057916330 | 1494141707 | Python | Python (3.4.3) | py | Runtime Error | 203 | 10360 | 2650 | H, W, K = map(int, input().split())
PAD = '_'
A = [PAD + input() + PAD for _ in range(H)]
A = [PAD * (W + 2)] + A + [PAD * (W + 2)]
V = [[False for _ in range(W + 2)] for _ in range(H + 2)]
for i in range(1, H + 1):
for j in range(1, W + 1):
if (A[i][j] == 'S'):
S = (i, j)
break
d... |
s291871828 | p03725 | u057916330 | 1494140304 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11764 | 2659 | H, W, K = map(int, input().split())
PAD = '_'
A = [PAD + input() + PAD for _ in range(H)]
A = [PAD * (W + 2)] + A + [PAD * (W + 2)]
V = [[False for _ in range(W + 2)] for _ in range(H + 2)]
for i in range(1, H + 1):
for j in range(1, W + 1):
if (A[i][j] == 'S'):
S = (i, j)
break
d... |
s265927263 | p03725 | u057916330 | 1494137545 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 10300 | 3045 | H, W, K = map(int, input().split())
PAD = '_'
A = [PAD + input() + PAD for _ in range(H)]
A = [PAD * (W + 2)] + A + [PAD * (W + 2)]
V = [[False for _ in range(W + 2)] for _ in range(H + 2)]
for i in range(1, H + 1):
for j in range(1, W + 1):
if (A[i][j] == 'S'):
S = (i, j)
break
d... |
s995681734 | p03725 | u057916330 | 1494136877 | Python | Python (3.4.3) | py | Runtime Error | 262 | 10344 | 3053 | H, W, K = map(int, input().split())
PAD = '_'
A = [PAD + input() + PAD for _ in range(H)]
A = [PAD * (W + 2)] + A + [PAD * (W + 2)]
V = [[False for _ in range(W + 2)] for _ in range(H + 2)]
for i in range(1, H + 1):
for j in range(1, W + 1):
if (A[i][j] == 'S'):
S = (i, j)
break
d... |
s835279983 | p03725 | u057916330 | 1494134990 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4844 | 2658 | H, W, K = map(int, input().split())
O = '_'
A = [O + input() + O for _ in range(H)]
A.insert(H, O * (W + 2))
A.insert(0, O * (W + 2))
for i in range(1, H + 1):
for j in range(1, W + 1):
if (A[i][j] == 'S'):
sta = (i, j)
break
def __opt_start(fro, pos, vec, k, A):
if k == 0:
... |
s074290456 | p03725 | u332385682 | 1494131486 | Python | Python (3.4.3) | py | Runtime Error | 1944 | 625596 | 1103 | import sys
sys.setrecursionlimit(10**8)
dx = (1, 0, -1, 0,)
dy = (0, 1, 0, -1,)
inf = 1<<60
def solve():
def dfs(i, j, depth, a, visited):
if depth > k:
return
nonlocal ans
ans = min(ans, h - 1 - i, i, w - 1 - j, j)
visited[i][j] = True
for l in range(len(dx... |
s926413449 | p03725 | u332385682 | 1494129944 | Python | Python (3.4.3) | py | Runtime Error | 1591 | 625608 | 1237 | import sys
sys.setrecursionlimit(10**8)
dx = (1, 0, -1, 0,)
dy = (0, 1, 0, -1,)
inf = 1<<60
def solve():
def dfs(i, j, depth, a, visited):
if depth > k:
return
visited[i][j] = True
for l in range(len(dx)):
ni = i + dy[l]
nj = j + dx[l]
i... |
s457669013 | p03725 | u332385682 | 1494129810 | Python | Python (3.4.3) | py | Runtime Error | 1687 | 625608 | 1215 | import sys
sys.setrecursionlimit(10**7)
dx = (1, 0, -1, 0,)
dy = (0, 1, 0, -1,)
inf = 1<<60
def solve():
def dfs(i, j, depth, a, visited):
if depth > k:
return
visited[i][j] = True
for l in range(len(dx)):
ni = i + dy[l]
nj = j + dx[l]
i... |
s820179654 | p03725 | u432042540 | 1494129715 | Python | Python (3.4.3) | py | Runtime Error | 294 | 10264 | 1380 | import math
h, w, k = [int(i) for i in input().split()]
tk = 0
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s570690039 | p03725 | u432042540 | 1494129567 | Python | Python (3.4.3) | py | Runtime Error | 297 | 11380 | 1378 | import math
h, w, k = [int(i) for i in input().split()]
tk = 0
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s417673925 | p03725 | u432042540 | 1494129441 | Python | Python (3.4.3) | py | Runtime Error | 296 | 11380 | 1337 | import math
h, w, k = [int(i) for i in input().split()]
tk = 0
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s755383674 | p03725 | u432042540 | 1494129257 | Python | Python (3.4.3) | py | Runtime Error | 159 | 9844 | 1202 | import math
h, w, k = [int(i) for i in input().split()]
tk = 0
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s696742001 | p03725 | u432042540 | 1494128841 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11384 | 1203 | import math
h, w, k = [int(i) for i in input().split()]
tk = 0
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s871926514 | p03725 | u107077660 | 1494128574 | Python | Python (3.4.3) | py | Runtime Error | 120 | 9068 | 746 | from collections import deque
H, W, K = map(int, input().split())
m = [input() for i in range(H)]
v = [[0]*W for i in range(H)]
f = 0
for i in range(H):
if f:
break
for j in range(W):
if m[i][j] == "S":
x = i
y = j
f = 1
break
dq = deque([[x,y,0]])
v[x][y] = 1
ans = (min(x, y, H-1-x, W-1-y)+K-1)//K
wh... |
s767837775 | p03725 | u432042540 | 1494128494 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11636 | 1348 | import math
h, w, k = [int(i) for i in input().split()]
tk = 0
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s646273811 | p03725 | u627417051 | 1494128378 | Python | Python (3.4.3) | py | Runtime Error | 147 | 8940 | 1604 | H, W, K = list(map(int, input().split()))
MAP = []
for i in range(H):
MAP.append(list(input()))
for i in range(H):
for j in range(W):
if MAP[i][j] == "S":
h = i
w = j
MAP[i][j] = ","
break
else:
pass
length = min([h, w, H - h - 1, W - w - 1])
abl = [[h, w]]
for j in range(K):
ln = len(abl)
abll =... |
s378488022 | p03725 | u432042540 | 1494128308 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 10272 | 1349 | import math
h, w, k = [int(i) for i in input().split()]
tk = k
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s026173190 | p03725 | u627417051 | 1494127794 | Python | Python (3.4.3) | py | Runtime Error | 151 | 9068 | 1605 | H, W, K = list(map(int, input().split()))
MAP = []
for i in range(H):
MAP.append(list(input()))
for i in range(H):
for j in range(W):
if MAP[i][j] == "S":
h = i
w = j
MAP[i][j] = "."
break
else:
pass
length = min([h, w, H - h - 1, W - w - 1])
abl = [[h, w]]
for j in range(K):
ln = len(abl)
abll =... |
s819591778 | p03725 | u402629484 | 1494125785 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11080 | 1029 | from math import ceil
H, W, K = map(int, input().split())
A = [None] * H
S = None
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y... |
s526221582 | p03725 | u402629484 | 1494125422 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11788 | 1011 | from math import ceil
H, W, K = map(int, input().split())
A = [None] * H
S = None
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y... |
s012528916 | p03725 | u332385682 | 1494125411 | Python | Python (3.4.3) | py | Runtime Error | 2118 | 594100 | 1081 | import sys
sys.setrecursionlimit(10**7)
dx = (1, 0, -1, 0,)
dy = (0, 1, 0, -1,)
inf = 1<<60
def solve():
def dfs(i, j, a, visited):
visited[i][j] = True
for k in range(len(dx)):
ni = i + dy[k]
nj = j + dx[k]
if 0 <= ni < h and 0 <= nj < w:
if... |
s622371668 | p03725 | u432688695 | 1494125015 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2824 | 1690 | # -*- coding: utf-8 -*-
import sys
import os
import math
H, W, K = map(int, input().split())
#print(H, W, K)
map = []
for s in sys.stdin:
s = s.strip()
map.append(list(s))
#print(map)
# search S
for i, row in enumerate(map):
if 'S' in row:
x = row.index('S')
y = i
# 初期値から行ける場所全てをPに列挙する
... |
s894293442 | p03725 | u402629484 | 1494124928 | Python | Python (3.4.3) | py | Runtime Error | 108 | 9240 | 942 | from math import ceil
H, W, K = map(int, input().split())
A = [None] * H
S = None
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y... |
s665814988 | p03725 | u432042540 | 1494124705 | Python | Python (3.4.3) | py | Runtime Error | 226 | 10268 | 1322 | import math
h, w, k = [int(i) for i in input().split()]
tk = k
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s283397831 | p03725 | u402629484 | 1494124659 | Python | Python (3.4.3) | py | Runtime Error | 97 | 9084 | 942 | from math import ceil
H, W, K = map(int, input().split())
A = [None] * H
S = None
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y... |
s594551048 | p03725 | u402629484 | 1494124512 | Python | Python (3.4.3) | py | Runtime Error | 97 | 9084 | 942 | from math import ceil
H, W, K = map(int, input().split())
A = [None] * H
S = None
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y... |
s943157865 | p03725 | u608297208 | 1494124497 | Python | Python (3.4.3) | py | Runtime Error | 1009 | 42448 | 698 | H,W,K = map(int,input().split())
HW = [list(input()) for i in range(H)]
for i,h in enumerate(HW):
if "S" in h:
y = i
x = h.index("S")
A = [(x,y)]
m = 800
def idou(a,b):
X = []
for i2 in range(4):
if i2 == 0:
t,k = a - 1, b
elif i2 == 1:
t,k = a, b - 1
elif i2 == 2:
t,k = a + 1, b
elif i2 == 3:
... |
s292783528 | p03725 | u432042540 | 1494124427 | Python | Python (3.4.3) | py | Runtime Error | 226 | 10348 | 1330 | import math
h, w, k = [int(i) for i in input().split()]
tk = k
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s238101138 | p03725 | u432042540 | 1494124341 | Python | Python (3.4.3) | py | Runtime Error | 216 | 12268 | 1290 | import math
h, w, k = [int(i) for i in input().split()]
tk = k
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s231011979 | p03725 | u972669913 | 1494124090 | Python | Python (2.7.6) | py | Runtime Error | 184 | 15420 | 609 | h,w,k = map(int, raw_input().split())
a = []
visited = {}
ans = []
for _ in range(h):
row = list(raw_input())
a.append(row)
s = 0
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
s = (i,j)
def visit(i,j,ki):
if ki < 0:
return
if i < 0 or h <= i:
return
if j < 0 or w <= j:
re... |
s082867288 | p03725 | u432042540 | 1494123989 | Python | Python (3.4.3) | py | Runtime Error | 219 | 10272 | 1197 | import math
h, w, k = [int(i) for i in input().split()]
tk = k
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-... |
s954848406 | p03725 | u402629484 | 1494123767 | Python | Python (3.4.3) | py | Runtime Error | 103 | 9060 | 937 | H, W, K = map(int, input().split())
A = [None] * H
S = None
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y == 0 or x == W - 1 or... |
s684651559 | p03725 | u432042540 | 1494123344 | Python | Python (3.4.3) | py | Runtime Error | 183 | 4704 | 1029 |
h, w, k = [int(i) for i in input().split()]
a = [None for j in range(h)]
for i in range(h):
a[i] = input()
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
si = i
sj = j
def distance(i,j):
mind = min([i, j, w-i, w-j])
# print(i, j, w-i, w-j)
# print(mind... |
s870403697 | p03725 | u402629484 | 1494123332 | Python | Python (3.4.3) | py | Runtime Error | 83 | 4980 | 875 | H, W, K = map(int, input().split())
A = [None] * H
S = []
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y == 0 or x == W - 1 or y... |
s792729633 | p03725 | u942697937 | 1494123319 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 934 | H, W, K = map(int, raw_input().split())
MAP = [raw_input() for _ in xrange(H)]
dist = [[10000 for _ in range(W)] for _ in xrange(H)]
for i in range(H):
x = MAP[i].find('S')
if x != -1:
sy = i
sx = MAP[i].find('S')
Q = []
q(sx, sy)]
visited[sy][sx] = 0
while len(Q) > 0:
x, y = Q.pop()
... |
s922656590 | p03725 | u972669913 | 1494123246 | Python | Python (2.7.6) | py | Runtime Error | 184 | 14908 | 631 | h,w,k = map(int, raw_input().split())
a = []
visited = {}
ans = float('inf')
for _ in range(h):
row = list(raw_input())
a.append(row)
s = 0
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
s = (i,j)
def visit(i,j,ki):
global ans
if ki < 0:
return
if i < 0 or h <= i:
return
if ... |
s935138056 | p03725 | u934019430 | 1494123245 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1346 | #include<cstdio>
#include<algorithm>
#include<iostream>
#define FOR(i,l,r) for(int i = l; i <= r; i++)
#define ROF(i,r,l) for(int i = r; i >= l; i--)
using namespace std;
const int MAXN = 810;
int s[MAXN][MAXN],map[MAXN][MAXN],n,m,k,l,r;
int qx[MAXN*MAXN],qy[MAXN*MAXN];
int ans = 9999999;
char getChar(){
char ch =... |
s065649754 | p03725 | u402629484 | 1494122696 | Python | Python (3.4.3) | py | Runtime Error | 83 | 4972 | 874 | from math import ceil
H, W, K = map(int, input().split())
A = [None] * H
S = []
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y ... |
s994173668 | p03725 | u402629484 | 1494122554 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 895 | from math import ceil
H, W, K = map(int, input().split())
A = [None] * H
S = []
for i in range(H):
A[i] = input()
#
if 'S' in A[i]:
for j in range(W):
if A[i][j] == 'S':
S = [i, j]
A[i] = A[i].replace('S', '.')
def is_edge(x, y):
return x == 0 or y =... |
s805101259 | p03725 | u972669913 | 1494122429 | Python | Python (2.7.6) | py | Runtime Error | 157 | 11584 | 632 | h,w,k = map(int, raw_input().split())
a = []
visited = {}
ans = float('inf')
for _ in range(h):
row = list(raw_input())
a.append(row)
s = 0
for i in range(h):
for j in range(w):
if a[i][j] == 'S':
s = (i,j)
def visit(i,j,ki):
global ans
if ki == 0:
return
if i < 0 or h <= i:
return
if... |
s710489319 | p03726 | u832039789 | 1594311955 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9088 | 64 | n = int(input())
if n % 2 == 1:
print('First')
else:
exit(1) |
s564019769 | p03726 | u532966492 | 1591396505 | Python | Python (3.4.3) | py | Runtime Error | 855 | 72864 | 2005 | def main():
n = int(input())
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [[] for _ in [0]*n]
[g[a-1].append(b-1) for a, b in ab]
[g[b-1].append(a-1) for a, b in ab]
for root in range(n):
if len(g[root]) > 2:
break
else:
if n % 2:
pri... |
s530170313 | p03726 | u532966492 | 1591334789 | Python | Python (3.4.3) | py | Runtime Error | 662 | 62884 | 1219 | def main():
n = int(input())
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [[] for _ in [0]*n]
[g[a-1].append(b-1) for a, b in ab]
[g[b-1].append(a-1) for a, b in ab]
for root in range(n):
if len(g[root]) > 2:
break
else:
if n % 2:
prin... |
s544589971 | p03726 | u532966492 | 1591332704 | Python | Python (3.4.3) | py | Runtime Error | 539 | 44604 | 464 | def main():
n = int(input())
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [[] for _ in [0]*n]
[g[a-1].append(b-1) for a, b in ab]
[g[b-1].append(a-1) for a, b in ab]
for i in range(n):
if len(g[i]) > 1:
cnt = 0
for j in g[i]:
if le... |
s225088357 | p03726 | u677523557 | 1589578267 | Python | Python (3.4.3) | py | Runtime Error | 271 | 24244 | 1239 | import sys
input = sys.stdin.readline
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N-1):
a, b = map(int, input().split())
graph[a-1].append(b-1)
graph[b-1].append(a-1)
q = []
checked = [-1]*N
for n in range(N):
if len(graph[n]) == 1:
q.append(n)
checked[n] = 0
ok = F... |
s898151492 | p03726 | u217836256 | 1588135444 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 13 | print('First) |
s876929770 | p03726 | u828766688 | 1588133004 | Python | Python (3.4.3) | py | Runtime Error | 438 | 21300 | 1293 |
"""
Writer: SPD_9X2
https://atcoder.jp/contests/agc014/tasks/agc014_d
白にしか隣接しない白を作れれば勝ちである
黒は、直前に置かれた白に対して対策するような動きをする羽目になる
距離2の葉の対があったら100%可能
ある時点での残りの森を考える(残りのどの点も黒が隣接していないとする)
葉に白を置く→葉において阻止
葉に隣接する点にしろを置く→葉において阻止
それ以外の点は、置いたら横に置くだけ(葉ではないので、隣接頂点が存在する)
なので、十分性もおk?
距離2の葉が存在するかだけを判定すればよさそう
"""
N = int(input())
l... |
s370417441 | p03726 | u905582793 | 1585436566 | Python | PyPy3 (2.4.0) | py | Runtime Error | 396 | 71132 | 491 | import sys
import random
input = sys.stdin.readline
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
deg = [0]*(n+1)
for a,b in ab:
graph[a].append(b)
graph[b].append(a)
color = [0]*(n+1)
color[1] = 1
stack = [1]
while stack:
x = stack.pop()
for y in gr... |
s339239241 | p03726 | u905582793 | 1585431819 | Python | PyPy3 (2.4.0) | py | Runtime Error | 540 | 89820 | 1155 | import sys
import random
input = sys.stdin.readline
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
deg = [0]*(n+1)
for a,b in ab:
graph[a].append(b)
graph[b].append(a)
deg[a] += 1
deg[b] += 1
if n == 2:
print("Second")
exit()
stack = []
root = 0
f... |
s044647716 | p03726 | u905582793 | 1585380100 | Python | PyPy3 (2.4.0) | py | Runtime Error | 449 | 82908 | 1250 | import sys
import random
input = sys.stdin.readline
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
degorigin = [0]*(n+1)
for a,b in ab:
graph[a].append(b)
graph[b].append(a)
degorigin[a] += 1
degorigin[b] += 1
if n == 2:
print("Second")
exit()
sta... |
s967435106 | p03726 | u905582793 | 1585379837 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1274 | 136072 | 1201 | import sys
import random
input = sys.stdin.readline
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
degorigin = [0]*(n+1)
for a,b in ab:
graph[a].append(b)
graph[b].append(a)
degorigin[a] += 1
degorigin[b] += 1
stackorigin = []
root = 0
candidate = []... |
s892589769 | p03726 | u905582793 | 1585379293 | Python | PyPy3 (2.4.0) | py | Runtime Error | 485 | 85340 | 1134 | import sys
input = sys.stdin.readline
from collections import deque
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
deg = [0]*(n+1)
for a,b in ab:
graph[a].append(b)
graph[b].append(a)
deg[a] += 1
deg[b] += 1
key = [0]*(n+1)
stack = deque()
root = 0
fo... |
s379529613 | p03726 | u467736898 | 1573091506 | Python | Python (3.4.3) | py | Runtime Error | 589 | 47396 | 866 | N = int(input())
if N%2==1:
print("First")
exit()
elif N==2:
print("Second")
exit()
E = [[] for _ in range(N+1)]
for _ in range(N-1):
a, b = map(int, input().split())
E[a].append(b)
E[b].append(a)
E_dim = [len(e) for e in E]
E_set = [set(e) for e in E]
q = []
for v, (dim, e) in enumerate(... |
s317457909 | p03726 | u368780724 | 1558463271 | Python | PyPy3 (2.4.0) | py | Runtime Error | 740 | 72476 | 856 | from collections import deque
from sys import exit
def Fi():
print('First')
exit()
N = int(input())
dim = [0]*N
Edge = [[] for _ in range(N)]
for _ in range(N-1):
a, b = map(int, input().split())
dim[a-1] += 1
dim[b-1] += 1
Edge[a-1].append(b-1)
Edge[b-1].append(a-1)
par = [None] + [0]*(N-1... |
s856437814 | p03726 | u368780724 | 1558463139 | Python | PyPy3 (2.4.0) | py | Runtime Error | 737 | 72348 | 824 | from collections import deque
from sys import exit
def Fi():
print('First')
exit()
N = int(input())
dim = [0]*N
Edge = [[] for _ in range(N)]
for _ in range(N-1):
a, b = map(int, input().split())
dim[a-1] += 1
dim[b-1] += 1
Edge[a-1].append(b-1)
Edge[b-1].append(a-1)
par = [None] + [0]*(N-1... |
s910711634 | p03726 | u854685751 | 1494126482 | Python | Python (3.4.3) | py | Runtime Error | 473 | 22964 | 551 | N = int(input())
l = [0 for i in range(N)]
ad = [[] for i in range(N)]
de1 = [0 for i in range(N)]
for i in range(N-1):
a,b = map(int,input().split())
l[a-1] += 1
l[b-1] += 1
ad[a-1].append(b-1)
ad[b-1].append(a-1)
def foo(uo):
if l[ad[uo][0]] == 2:
ad[ad[uo][0]].remove(uo)
ji = ad[ad[uo][0]][0]
if l[ji]... |
s241974980 | p03726 | u854685751 | 1494126268 | Python | Python (3.4.3) | py | Runtime Error | 508 | 24872 | 529 | N = int(input())
l = [0 for i in range(N)]
ad = [[] for i in range(N)]
de1 = [0 for i in range(N)]
for i in range(N-1):
a,b = map(int,input().split())
l[a-1] += 1
l[b-1] += 1
ad[a-1].append(b-1)
ad[b-1].append(a-1)
def foo(uo):
if l[uo] == 2:
ad[uo].remove(i)
ji = ad[uo][0]
if l[ji] == 2:
ad[ji].remov... |
s831979592 | p03726 | u637175065 | 1494125366 | Python | Python (3.4.3) | py | Runtime Error | 1770 | 55248 | 1324 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s715284326 | p03726 | u637175065 | 1494125315 | Python | Python (3.4.3) | py | Runtime Error | 1681 | 55244 | 1284 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s957417194 | p03726 | u637175065 | 1494124971 | Python | Python (3.4.3) | py | Runtime Error | 840 | 53924 | 1720 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s096640626 | p03726 | u637175065 | 1494124820 | Python | Python (3.4.3) | py | Runtime Error | 402 | 44100 | 1681 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s438208237 | p03726 | u637175065 | 1494124767 | Python | Python (3.4.3) | py | Runtime Error | 386 | 43076 | 1679 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s262072553 | p03726 | u637175065 | 1494124642 | Python | Python (3.4.3) | py | Runtime Error | 403 | 44220 | 1674 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s550720004 | p03726 | u637175065 | 1494124571 | Python | Python (3.4.3) | py | Runtime Error | 370 | 41812 | 1677 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s732767514 | p03726 | u637175065 | 1494124416 | Python | Python (3.4.3) | py | Runtime Error | 1118 | 53936 | 1647 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s385102884 | p03728 | u472065247 | 1567224768 | Python | Python (3.4.3) | py | Runtime Error | 311 | 34756 | 780 | N = int(input())
P = list(map(int, input().split()))
Pi = [0] * (N + 1)
for i, n in enumerate(P, 1):
Pi[n] = i
T = [0] * N
f = [0] * N
if Pi[N] > Pi[N - 1]:
T[N - 1] = 0
f[N - 1] = N - 1
else:
T[N - 1] = 1
f[N - 1] = N
for i in range(N - 2, 0, -1):
if T[i + 1] == 0:
i_i = Pi[i]
... |
s553240425 | p03728 | u330205771 | 1494126567 | Python | Python (2.7.6) | py | Runtime Error | 165 | 19964 | 378 | N = int(raw_input())
p = map(int, raw_input().split())
count = 0
while True:
flagEnd = True
high = [p[0]]
low = []
for i in range(len(p) - 1):
if p[i+1] < p[i]:
low.append(p[i+1])
flagEnd = False
else:
high.append(p[i+1])
if flagEnd:
bre... |
s337529749 | p03729 | u498575211 | 1601480170 | Python | PyPy3 (7.3.0) | py | Runtime Error | 78 | 68200 | 95 | a,b,c=list(input().split())
if a[-1]==b[1] and b[-1]==c[1]:
print("Yes")
else:
print("No")
|
s528270345 | p03729 | u498575211 | 1601480121 | Python | PyPy3 (7.3.0) | py | Runtime Error | 71 | 68824 | 88 | a,b,c=input().split()
if a[-1]==b[1] and b[-1]==c[1]:
print("Yes")
else:
print("No") |
s863971849 | p03729 | u018679195 | 1600998270 | Python | Python (3.8.2) | py | Runtime Error | 31 | 8936 | 323 | #include <stdio.h>
#include <string.h>
int main(){
char a[15], b[15], c[15];
scanf("%s", a);
scanf("%s", b);
scanf("%s", c);
int lena = strlen(a);
int lenb = strlen(b);
int lenc = strlen(c);
if(a[lena-1] == b[0] && b[lenb-1] == c[0]){
printf("YES\n");
}
else{
printf("NO\n");
}
return 0... |
s808449531 | p03729 | u893297141 | 1600970782 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8900 | 107 | a,b,c = map(string,input().split())
if a[-1] == b[0] and b[-1] == c[0]:
print('YES')
else :
print('NO') |
s761064094 | p03729 | u332331919 | 1600376918 | Python | Python (3.8.2) | py | Runtime Error | 30 | 8928 | 296 | # 060_a
A, B, C = input().split()
if (1<=len(A) and len(A)<=10 and A.islower()) and (1<=len(B) and len(B)<=10 and B.islower())\
and (1<=len(C) and len(C)<=10 and C.islower()):
if (A[len(A) - 1] == B[0]) and (B[0] == C[len(B) - 1]):
print('YES')
else:
print('NO')
|
s369978121 | p03729 | u197956883 | 1600059391 | Python | PyPy3 (7.3.0) | py | Runtime Error | 154 | 77132 | 1182 | import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
... |
s299265030 | p03729 | u886902015 | 1599852725 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9148 | 101 | a,b,c=map(int,input().split())
if a[-1]==b[0] and b[-1]==c[0]:
print("YES")
else:
print("NO") |
s846946733 | p03729 | u038021590 | 1599677809 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74716 | 110 | A, B, C = map(int, input().split())
if A[-1] == B[0] and B[-1] == C[0]:
print('YES')
else:
print('NO') |
s131405684 | p03729 | u960570220 | 1599605194 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8880 | 110 | a, b, c = input().split()
if a[len(a)-1] == b[0] and b[(b)-1] == c[0]:
print('YES')
else:
print('NO') |
s977086366 | p03729 | u960570220 | 1599604997 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9000 | 112 | A = str(input())
B = str(input())
C = str(input())
if A == B and B == C:
print('YES')
else:
print('NO') |
s586902391 | p03729 | u634046173 | 1599209030 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 74812 | 138 | A, B, C = map(int,input().split())
for i in range(1,B):
a = A*i
if a % B == C:
print('YES')
exit()
print('NO')
|
s844746323 | p03729 | u261103969 | 1599197960 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74824 | 299 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
A, B, C = map(int, readline().split())
if A[-1] == B[0] and B[-1] == C[0]:
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
|
s709716538 | p03729 | u076363290 | 1599182186 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8988 | 112 | A = input()
B = input()
C = input()
if A[-1] == B[0] and B[-1] == C[0]:
print('Yes')
else:
print('No')
|
s376270635 | p03729 | u347397127 | 1598832821 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9104 | 101 | a,b,c=map(int,input().split())
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO") |
s153970909 | p03729 | u536017058 | 1598413491 | Python | PyPy3 (7.3.0) | py | Runtime Error | 95 | 74804 | 113 | A, B, C = map(int, input().split())
for k in range(B):
if (k * A) % B == C: print("YES"); exit()
print("NO")
|
s913565979 | p03729 | u353919145 | 1597974931 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9076 | 819 | A = input()
B = input()
C = input()
if 1 <= len(A):
if len(A) <= 10:
if 1 <= len(B):
if len(B) <= 10:
if 1 <= len(C):
if len(C) <= 10:
if A >= 'a':
if A <= 'z':
if B >= 'a':
... |
s115771056 | p03729 | u714104087 | 1596581137 | Python | PyPy3 (7.3.0) | py | Runtime Error | 514 | 94704 | 74 | a,b,c=input().split
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO") |
s239166890 | p03729 | u714104087 | 1596581062 | Python | PyPy3 (7.3.0) | py | Runtime Error | 93 | 74356 | 72 | a,b,c=input().split
print("YES" if a[0]==b[0] and b[0]==c[0] else "NO") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.