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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s285623623 | p00114 | u462831976 | 1494417081 | Python | Python3 | py | Runtime Error | 0 | 0 | 672 | # -*- coding: utf-8 -*-
import sys
import os
import math
def lcm(a, b):
return (a * b) // math.gcd(a, b)
for s in sys.stdin:
a1, m1, a2, m2, a3, m3 = map(int, s.split())
if a1 == m1 == a2 == m2 == a3 == m3 == 0:
break
x = 1
y = 1
z = 1
x_num = 0
while True:
x = (a1 *... |
s327677388 | p00114 | u462831976 | 1494417514 | Python | Python3 | py | Runtime Error | 0 | 0 | 529 | # -*- coding: utf-8 -*-
import sys
import os
import math
def lcm(a, b):
return (a * b) // math.gcd(a, b)
def interval(a, m):
cnt = 0
x = 1
while True:
x = (a * x) % m
cnt += 1
if x == 1:
return cnt
for s in sys.stdin:
a1, m1, a2, m2, a3, m3 = map(int, s.split(... |
s209755795 | p00114 | u960312159 | 1509522495 | Python | Python3 | py | Runtime Error | 0 | 0 | 458 | from math import gcd
while True:
a = list(map(int, input().split()))
if a.count(0) == 6:
break
x = a[0] % a[1]
ix = 1
while x != 1:
x = a[0] * x % a[1]
ix += 1
y = a[2] % a[3]
iy = 1
while y != 1:
y = a[2] * y % a[3]
iy += 1
z = a[4] % a[5]
... |
s358269672 | p00115 | u260980560 | 1437215843 | Python | Python | py | Runtime Error | 20 | 4356 | 927 | def solve(A, b):
for i in xrange(3):
if A[i][i] == 0.0:
for j in xrange(i+1, 3):
if A[j][i]!=0.0:
A[i], A[j] = A[j], A[i]
b[i], b[j] = b[j], b[i]
for j in xrange(3):
if i==j:
continue
a = A[j]... |
s406740749 | p00115 | u619785977 | 1471417408 | Python | Python3 | py | Runtime Error | 0 | 0 | 72 | hdhafsdlqshflahsfhjs
afjahflka
fhajkfaslkdfa
fjajkfhajkh
djhfjaseafaf
xz |
s246910115 | p00115 | u462831976 | 1494522912 | Python | Python3 | py | Runtime Error | 0 | 0 | 818 | # -*- coding: utf-8 -*-
import sys
import os
import math
import numpy as np
# refs
# https://shikousakugo.wordpress.com/2012/06/27/ray-intersection-2/
def length(v):
return math.sqrt(v[0] ** 2 + v[1] ** 2 + v[2] ** 2)
def dist(p0, p1):
return math.sqrt( (p0[0] - p1[0]) ** 2 + (p0[1] - p1[1]) ** 2 + (p0[2] -... |
s172363378 | p00115 | u462831976 | 1494525513 | Python | Python3 | py | Runtime Error | 20 | 7856 | 1045 | # -*- coding: utf-8 -*-
import sys
import os
import math
# refs
# https://shikousakugo.wordpress.com/2012/06/27/ray-intersection-2/
def det(a, b, c):
return + a[0] * b[1] * c[2] \
+ a[2] * b[0] * c[1] \
+ a[1] * b[2] * c[0] \
- a[2] * b[1] * c[0] \
- a[1] * b[0] * c[2]... |
s195147798 | p00115 | u462831976 | 1494525664 | Python | Python3 | py | Runtime Error | 20 | 7848 | 1033 | # -*- coding: utf-8 -*-
import sys
import os
import math
# refs
# https://shikousakugo.wordpress.com/2012/06/27/ray-intersection-2/
def det(a, b, c):
return + a[0] * b[1] * c[2] \
+ a[2] * b[0] * c[1] \
+ a[1] * b[2] * c[0] \
- a[2] * b[1] * c[0] \
- a[1] * b[0] * c[2]... |
s822302832 | p00115 | u462831976 | 1494530936 | Python | Python3 | py | Runtime Error | 20 | 7872 | 1224 | # -*- coding: utf-8 -*-
import sys
import os
import math
# refs
# https://shikousakugo.wordpress.com/2012/06/27/ray-intersection-2/
def det(a, b, c):
return + a[0] * b[1] * c[2] \
+ a[2] * b[0] * c[1] \
+ a[1] * b[2] * c[0] \
- a[2] * b[1] * c[0] \
- a[1] * b[0] * c[2]... |
s893059137 | p00115 | u566872786 | 1511090200 | Python | Python3 | py | Runtime Error | 0 | 0 | 798 | dot = lambda a,b:sum([a[i]*b[i] for i in range(3)])
cross = lambda a,b:[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]
m = lambda a,b:[a[i]-b[i] for i in range(3)]
l = lambda a:(a[0]**2+a[1]**2+a[2]**2)** 0.5
c = lambda a,b:[a*b[i] for i in range(3)]
def A():
L=[list(map(int,input().split())) for i in ... |
s944689187 | p00115 | u300645821 | 1401883826 | Python | Python3 | py | Runtime Error | 70 | 14776 | 939 | #!/usr/bin/python
from fractions import Fraction
import sys
if sys.version_info[0]>=3: raw_input=input
def gauss(a):
if not a or len(a)==0: return None
n=len(a)
for i in range(n):
if a[i][i]==0:
for j in range(i+1,n):
if a[j][i]!=0:
for k in range(i,n+1): a[i][k]+=a[j][k]
break
for j in range(n... |
s972625382 | p00116 | u912237403 | 1414939377 | Python | Python | py | Runtime Error | 0 | 0 | 410 | while 1:
h,w = map(int, raw_input().split())
if h==w==0: break
A = []
for i in range(h):
A.append(map(int,list(raw_input().replace(".", "1").replace("*", "0"))))
B = A[:]
C = []
for j in range(1,h):
m=[]
for i in range(j,h):
x=[e1&e2 for e1,e2 in zip(B[i-j],A[i])]
B[i-j]=x
m.... |
s499357334 | p00116 | u912237403 | 1414939661 | Python | Python | py | Runtime Error | 0 | 0 | 420 | while 1:
h,w = map(int, raw_input().split())
if h==w==0: break
A = []
for i in range(h):
A.append(map(int, list(raw_input().replace(".", "1").replace("*", "0"))))
B = A[:]
C = []
for j in range(1,h):
m=[]
for i in range(j,h):
x = [e1 & e2 for e1, e2 in zip(B[i-j], A[i])]
B[i-j] = x... |
s649028099 | p00116 | u912237403 | 1414941454 | Python | Python | py | Runtime Error | 0 | 0 | 428 | import sys
while 1:
h,w = map(int, raw_input().split())
if h==w==0: break
A = []
for _ in [0]*h:
A.append(map(int, list(raw_input().replace(".", "1").replace("*", "0"))))
B = A[:]
C = []
for j in range(1,h):
m=[]
for i in range(j,h):
x = [e1 & e2 for e1, e2 in zip(B[i-j], A[i])]
B[... |
s744981245 | p00116 | u912237403 | 1414966687 | Python | Python | py | Runtime Error | 0 | 0 | 446 | while 1:
h,w = map(int, raw_input().split())
if h==w==0: break
A = [0]*h
for i in range(h):
x = raw_input().replace(".", "1").replace("*", "0")
A[i] = map(int, list(x))
B = A[:]
C = []
for j in range(1,h):
M = []
for i in range(j,h):
x = [e1 & e2 for e1, e2 in zip(B[i-j], A[i])]
... |
s639828553 | p00116 | u912237403 | 1415008479 | Python | Python | py | Runtime Error | 0 | 0 | 592 | def f(j,k):
tmp=j-C[k]
if tmp>M[k]: M[k]
return
while 1:
h,w = map(int, raw_input().split())
if h==w==0: break
M = [0]*(h+1)
a=[0]*w
for i in range(h):
x = raw_input()
b=[0]*w
sp=-1
C = [-1]*(h+1)
for j in range(w):
if x[j]=="*": c=0
else: c=a[j]+1
b[j]=c
dw=... |
s184242834 | p00116 | u912237403 | 1415008537 | Python | Python | py | Runtime Error | 0 | 0 | 596 | def f(j,k):
tmp=j-C[k]
if tmp>M[k]: M[k]=tmp
return
while 1:
h,w = map(int, raw_input().split())
if h==w==0: break
M = [0]*(h+1)
a=[0]*w
for i in range(h):
x = raw_input()
b=[0]*w
sp=-1
C = [-1]*(h+1)
for j in range(w):
if x[j]=="*": c=0
else: c=a[j]+1
b[j]=c
... |
s365961694 | p00116 | u647766105 | 1381483573 | Python | Python | py | Runtime Error | 0 | 0 | 2559 | class Rect():
def __init__(self, x_range, y_range):
self.x_range = x_range
self.y_range = y_range
@property
def w(self):
return len(self.x_range)
@property
def h(self):
return len(self.y_range)
def __str__(self):
return "Rect({},{})".format... |
s398839556 | p00116 | u104911888 | 1390903526 | Python | Python | py | Runtime Error | 0 | 0 | 794 | def get_rectangle_area(table, w):
maxv = 0
stack = []
table.append(0)
for i, rect in enumerate(table):
if stack == []:
stack.append((rect, i))
elif stack[-1][0] < rect:
stack.append((rect, i))
elif stack[-1][0] == rect:
pass
elif stack[... |
s844438818 | p00116 | u300645821 | 1392386118 | Python | Python | py | Runtime Error | 0 | 0 | 541 | #!/usr/bin/python
#http://www.checkio.org/mission/spaceship-landing-strip/ verifier.
def checkio(data):
y=len(data)
x=len(data[0])
m=[[0]*x for i in range(y)]
for j in range(y):
r=0
for i in range(x):
if data[j][i]=='.': r+=1
else: r=0
m[j][i]=r
r=0
for i in range(x):
for j in range(y):
M=99999... |
s731962099 | p00116 | u300645821 | 1392386234 | Python | Python | py | Runtime Error | 0 | 0 | 607 | #!/usr/bin/python
#http://www.checkio.org/mission/spaceship-landing-strip/ verifier.
def checkio(data):
y=len(data)
x=len(data[0])
m=[[0]*x for i in range(y)]
for j in range(y):
r=0
for i in range(x):
if data[j][i]=='.': r+=1
else: r=0
m[j][i]=r
r=0
for i in range(x):
for j in range(y):
M=99999... |
s580455807 | p00117 | u844945939 | 1420528442 | Python | Python3 | py | Runtime Error | 0 | 0 | 712 | http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0117
INF = 1e12
def dijkstra(graph, source):
lg = len(graph)
unused = list(range(lg))
d = [INF] * (lg)
d[source] = 0
while unused:
v = min(unused, key=lambda u: d[u])
unused.remove(v)
for u in range(n + 1):
... |
s799111889 | p00117 | u873482706 | 1435475730 | Python | Python | py | Runtime Error | 0 | 0 | 1234 | import copy
def discomfort(dic, n):
global expenses
if expenses != None and sum(p_res) >= expenses:
return
if n == s_n and g_n in load:
expenses = sum(p_res)
Pirates.append(r-(sum(p_res)+p))
return
for v in dic[n]:
p_res.append(p_dic[(n,v)])
c_l_dic = cop... |
s344389669 | p00117 | u542962065 | 1511273971 | Python | Python3 | py | Runtime Error | 0 | 0 | 554 | import numpy as np
n = int(input())
m = int(input())
road = np.full((n, n), np.inf)
for i in range(m):
r_in = list(map(int, input().split(",")))
road[r_in[0]-1, r_in[1]-1] = r_in[2]
road[r_in[1]-1, r_in[0]-1] = r_in[3]
s, g, v, p = map(int, input().split(","))
for k in range(n):
for i in range(n):
... |
s711452755 | p00117 | u542962065 | 1511273979 | Python | Python | py | Runtime Error | 0 | 0 | 554 | import numpy as np
n = int(input())
m = int(input())
road = np.full((n, n), np.inf)
for i in range(m):
r_in = list(map(int, input().split(",")))
road[r_in[0]-1, r_in[1]-1] = r_in[2]
road[r_in[1]-1, r_in[0]-1] = r_in[3]
s, g, v, p = map(int, input().split(","))
for k in range(n):
for i in range(n):
... |
s347709244 | p00117 | u658913995 | 1512630085 | Python | Python | py | Runtime Error | 0 | 0 | 772 | # The question itself is not diffifult, but the website only
# tested my code with two cases, so I am not sure whether the
# "accepted" is trustworthy.
# Note: math.inf > math.inf -> False
import math
V = int(input())
E = int(input())
fees = [[math.inf] * V for i in range(V)]
for i in range(V):
fees[i][i] = 0
for... |
s737683851 | p00118 | u633068244 | 1414860442 | Python | Python | py | Runtime Error | 0 | 0 | 455 | def solve(c,h,w,count):
if 0 <= h < H and 0 <= w < W:
if c in "#@*" and c == A[h][w]:
A[h][w] = count
solve(c,h+1,w,count)
solve(c,h-1,w,count)
solve(c,h,w+1,count)
solve(c,h,w-1,count)
while 1:
H,W = map(int,raw_input().split())
if H == W == 0:
break
A = [list(raw_input()) for i in range(H)]
co... |
s762746192 | p00118 | u633068244 | 1414860765 | Python | Python | py | Runtime Error | 0 | 0 | 456 | def solve(c,h,w,count):
if 0 <= h < H and 0 <= w < W:
if c in "#@*" and c == A[h][w]:
A[h][w] = count
solve(c,h+1,w,count)
solve(c,h-1,w,count)
solve(c,h,w+1,count)
solve(c,h,w-1,count)
while 1:
H,W = map(int,raw_input().split())
if H == W == 0:
break
A = [list(raw_input()) for i in range(H)]
c... |
s052077037 | p00118 | u633068244 | 1414915602 | Python | Python | py | Runtime Error | 0 | 0 | 467 | def solve(c,h,w,count):
if 0 <= h < H and 0 <= w < W:
if type(c) is not int and c == A[h][w]:
A[h][w] = count
solve(c,h+1,w,count)
solve(c,h-1,w,count)
solve(c,h,w+1,count)
solve(c,h,w-1,count)
while 1:
H,W = map(int,raw_input().split())
if H == W == 0:
break
A = [list(raw_input()) for i in rang... |
s312140255 | p00118 | u633068244 | 1414920132 | Python | Python | py | Runtime Error | 0 | 0 | 447 | def solve(c,h,w,count):
if 0 <= h < H and 0 <= w < W:
if type(A[h][w]) is not int and c == A[h][w]:
A[h][w] = count
for dh,dw in [[1,0],[-1,0],[0,1],[0,-1]]:
solve(c,h+dh,w+dw,count)
while 1:
H,W = map(int,raw_input().split())
if H == W == 0:break
A = [list(raw_input()) for i in range(H)]
count = 0
fo... |
s764833390 | p00118 | u633068244 | 1414921929 | Python | Python | py | Runtime Error | 0 | 0 | 350 | def solve(c,h,w):
if A[h][w] == c:
A[h][w] = "X"
for dx,dy in zip((1,-1,0,0),(0,0,1,-1)):
if 0 <= h+dh < H and 0 <= w+dw < W:
solve(c,h+dh,w+dw)
while 1:
H,W = map(int,raw_input().split())
if H == W == 0: break
count = 0
for h in range(H):
for w in range(W):
if A[h][w] != "X":
solve(A[h][w],h,... |
s641889171 | p00118 | u912237403 | 1415028743 | Python | Python | py | Runtime Error | 0 | 0 | 467 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[]
for i in range(H+2):
if i==0 or i==H+1:
A.append(list(" "*(W+2... |
s945980272 | p00118 | u912237403 | 1415029593 | Python | Python | py | Runtime Error | 0 | 0 | 566 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[[[] for _ in range(W+2)] for _ in range(H+2)]
for i in range(H+2):
if ... |
s959930845 | p00118 | u912237403 | 1415029697 | Python | Python | py | Runtime Error | 0 | 0 | 574 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[[[] for _ in range(W+2)] for _ in range(H+2)]
for i in range(H+2):
if ... |
s984888231 | p00118 | u912237403 | 1415029762 | Python | Python | py | Runtime Error | 0 | 0 | 560 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[[[] for _ in range(W+2)] for _ in range(H+2)]
for i in range(H+2):
if ... |
s773201372 | p00118 | u912237403 | 1415029813 | Python | Python | py | Runtime Error | 0 | 0 | 569 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[[[] for _ in range(W+2)] for _ in range(H+2)]
for i in range(H+2):
if ... |
s172313361 | p00118 | u912237403 | 1415030147 | Python | Python | py | Runtime Error | 0 | 0 | 544 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[[[] for _ in range(W+2)] for _ in range(H+2)]
for i in range(H+2):
if ... |
s032894455 | p00118 | u912237403 | 1415030214 | Python | Python | py | Runtime Error | 0 | 0 | 537 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[[" " for _ in range(W+2)] for _ in range(H+2)]
for i in range(H+2):
if... |
s285175966 | p00118 | u912237403 | 1415030401 | Python | Python | py | Runtime Error | 0 | 0 | 461 | def f(y,x,c0):
global A
c=A[y][x]
if c==" " or c!=c0:
return 0
else:
A[y][x]=" "
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[[" " for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
s=ra... |
s307495629 | p00118 | u912237403 | 1415186687 | Python | Python | py | Runtime Error | 0 | 0 | 461 | def f(y,x,c0):
global A
c=A[y][x]
if c=="X" or c!=c0:
return 0
else:
A[y][x]="X"
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[["X" for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
s=ra... |
s286869468 | p00118 | u912237403 | 1415186727 | Python | Python | py | Runtime Error | 0 | 0 | 479 | def f(y,x,c0):
global A
c=A[y][x]
if c=="X" or c!=c0:
return 0
else:
A[y][x]="X"
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[["X" for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
s=ra... |
s345176250 | p00118 | u912237403 | 1415187694 | Python | Python | py | Runtime Error | 0 | 0 | 509 | def f(y,x,c0):
global A
c=A[y][x]
if x==0 or x==W+1 or y==0 or y==H+1: return 0
if c=="X" or c!=c0:
return 0
else:
A[y][x]="X"
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[["X" for _ in range(W+2)] fo... |
s865444531 | p00118 | u912237403 | 1415187764 | Python | Python | py | Runtime Error | 0 | 0 | 436 | if c=="X" or c!=c0:
return 0
else:
return 0
A[y][x]="X"
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[["X" for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
s=raw_input()
for j in ra... |
s658193095 | p00118 | u912237403 | 1415188300 | Python | Python | py | Runtime Error | 0 | 0 | 439 | def f(y,x,c0):
global A
c=A[y][x]
if c=='X' or c!=c0:
return 0
else:
A[y][x]='X'
for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
f(y+i,x+j,c0)
return 1
while 1:
H,W=map(int,raw_input().split())
if H==W==0: break
A=[['X' for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
A[i+... |
s533177826 | p00118 | u633068244 | 1417490356 | Python | Python | py | Runtime Error | 0 | 0 | 493 | def solve(h,w,count,c):
if 0 <= h < H and 0 <= w < W and A[h][w] == c:
A[h][w] = count
for dh,dw in zip([1,0,-1,0],[0,1,0,-1]):
solve(h+dh,w+dw,count,c)
while 1:
H,W = map(int,raw_input().split())
if H == W == 0: break
A = [list(raw_input()) for _ in range(H)]
count = 0
... |
s300217311 | p00118 | u507118101 | 1418524437 | Python | Python | py | Runtime Error | 0 | 0 | 686 | def dfs(x,y,ch):
field[x][y] = '.'
for i in range(4):
nx = x+moveY[i]
ny = y+moveX[i]
if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
dfs(nx,ny,field[nx][ny])
if __name__ == '__main__':
moveY = [-1,0,1,... |
s573123200 | p00118 | u507118101 | 1418524528 | Python | Python | py | Runtime Error | 0 | 0 | 686 | def dfs(x,y,ch):
field[x][y] = '.'
for i in range(4):
nx = x+moveY[i]
ny = y+moveX[i]
if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
dfs(nx,ny,field[nx][ny])
if __name__ == '__main__':
moveY = [-1,0,1,... |
s689092585 | p00118 | u507118101 | 1418525266 | Python | Python | py | Runtime Error | 0 | 0 | 686 | def dfs(x,y,ch):
field[x][y] = '.'
for i in range(4):
nx = x+moveY[i]
ny = y+moveX[i]
if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
dfs(nx,ny,field[nx][ny])
if __name__ == '__main__':
moveY = [-1,0,1,... |
s675314079 | p00118 | u507118101 | 1418525615 | Python | Python | py | Runtime Error | 0 | 0 | 641 | def dfs(x,y,ch):
field[x][y] = '.'
for i in range(4):
nx = x+moveY[i]
ny = y+moveX[i]
if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
dfs(nx,ny,field[nx][ny])
moveY = [-1,0,1,0]
moveX = [0,1,0,-1]
H,W = ... |
s622052543 | p00118 | u507118101 | 1418527795 | Python | Python | py | Runtime Error | 0 | 0 | 746 | def dfs(X,Y,ch):
stack.append([X,Y])
field[X][Y] = '.'
while len(stack) != 0:
x,y = stack.pop()
for i in range(4):
nx = x+moveY[i]
ny = y+moveX[i]
if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
... |
s548863796 | p00118 | u507118101 | 1418528360 | Python | Python | py | Runtime Error | 0 | 0 | 802 | def dfs(X,Y,ch):
stack.append([X,Y])
print stack
field[X][Y] = '.'
while len(stack) != 0:
x,y = stack.pop()
for i in range(4):
nx = x+moveY[i]
ny = y+moveX[i]
if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny]... |
s835013502 | p00118 | u507118101 | 1418529080 | Python | Python | py | Runtime Error | 0 | 0 | 629 | def dfs(X,Y,ch):
field[X][Y] = '.'
for i in range(4):
nx = X+moveY[i]
ny = Y+moveX[i]
if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
dfs(nx,ny,field[nx][ny])
moveY = [-1,0,1,0]
moveX = [0,1,0,-1]
while True:... |
s865913861 | p00118 | u873482706 | 1435549513 | Python | Python | py | Runtime Error | 0 | 0 | 779 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
#right
wa(h, w+1, f)
#up
wa(h-1, w, f)
#left
wa(h, w-1, f)
#down
wa(h+1, w, f)
while True:
H, W =... |
s001468684 | p00118 | u873482706 | 1435549707 | Python | Python | py | Runtime Error | 0 | 0 | 724 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0: break
... |
s991289936 | p00118 | u873482706 | 1435549778 | Python | Python | py | Runtime Error | 0 | 0 | 735 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0 and W =... |
s507746799 | p00118 | u873482706 | 1435550004 | Python | Python | py | Runtime Error | 0 | 0 | 762 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0 and W =... |
s921184437 | p00118 | u873482706 | 1435550878 | Python | Python | py | Runtime Error | 0 | 0 | 746 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0 and W =... |
s812869007 | p00118 | u873482706 | 1435551023 | Python | Python | py | Runtime Error | 0 | 0 | 803 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0 and W =... |
s083351160 | p00118 | u873482706 | 1435551211 | Python | Python | py | Runtime Error | 0 | 0 | 770 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0... |
s052637293 | p00118 | u873482706 | 1435551645 | Python | Python | py | Runtime Error | 0 | 0 | 735 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0 and W =... |
s231867700 | p00118 | u873482706 | 1435552218 | Python | Python | py | Runtime Error | 0 | 0 | 750 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0 and W =... |
s565115978 | p00118 | u873482706 | 1435553559 | Python | Python | py | Runtime Error | 0 | 0 | 750 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split(' '))
if H == 0 and W =... |
s698947183 | p00118 | u873482706 | 1435553811 | Python | Python | py | Runtime Error | 0 | 0 | 747 | def wa(h, w, f):
if not (0 <= h <= H-1 and 0 <= w <= W-1):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split())
if H == 0 and W == 0... |
s880935667 | p00118 | u873482706 | 1435553921 | Python | Python | py | Runtime Error | 0 | 0 | 741 | def wa(h, w, f):
if not (0 <= h < H and 0 <= w < W):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
H, W = map(int, raw_input().split())
if H == 0 and W == 0: brea... |
s424472831 | p00118 | u873482706 | 1435554042 | Python | Python | py | Runtime Error | 0 | 0 | 741 | def wa(h, w, f):
if not (0 <= h < H and 0 <= w < W):
return
elif mapp[h][w] != f:
return
else:
mapp[h][w] = '$'
wa(h, w+1, f)
wa(h-1, w, f)
wa(h, w-1, f)
wa(h+1, w, f)
while True:
W, H = map(int, raw_input().split())
if H == 0 and W == 0: brea... |
s207314498 | p00118 | u736039489 | 1436312494 | Python | Python | py | Runtime Error | 0 | 0 | 882 | #! -*- coding:utf-8 -*-
while True:
H, W = map(int, raw_input().split(' '))
if H==0 and W==0:
break
#print H, W
data = []
for i in range(H):
data.append(list(raw_input()))
flg = [[0 for j in range(W)] for i in range(H)]
def search(i,j,mark):
# if i<0 or i>=H or j<0 or j>=W:
# break
if i+1 < H a... |
s035595382 | p00118 | u736039489 | 1436313697 | Python | Python | py | Runtime Error | 0 | 0 | 889 | #! -*- coding:utf-8 -*-
while True:
H, W = map(int, raw_input().split(' '))
#print H, W
data = []
for i in range(H):
data.append(list(raw_input()))
flg = [[0 for j in range(W)] for i in range(H)]
def search(i,j,mark):
# if i<0 or i>=H or j<0 or j>=W:
# break
if i+1 < H and flg[i+1][j] == 0 and da... |
s850958551 | p00118 | u338932851 | 1440985807 | Python | Python | py | Runtime Error | 0 | 0 | 1349 | dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
def dfs(i, j):
if (area[i][j] == '#'):
area[i][j] = "."
for k in range(4):
nx = i + dx[k]
ny = j + dy[k]
if ((0 <= nx < W) and (0 <= ny < H) and (area[nx][ny] == '#')):
dfs(nx, ny)
elif (are... |
s074114633 | p00118 | u338932851 | 1440985893 | Python | Python | py | Runtime Error | 0 | 0 | 1349 | dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
def dfs(i, j):
if (area[i][j] == '#'):
area[i][j] = "."
for k in range(4):
nx = i + dx[k]
ny = j + dy[k]
if ((0 <= nx < W) and (0 <= ny < H) and (area[nx][ny] == '#')):
dfs(nx, ny)
elif (are... |
s873425394 | p00118 | u489809100 | 1448974867 | Python | Python | py | Runtime Error | 0 | 0 | 746 | def check(x, y, flag):
farm[x][y] = "$"
if farm[x + 1][y] != "$" and farm[x + 1][y] == flag : check(x + 1, y, flag)
if farm[x - 1][y] != "$" and farm[x - 1][y] == flag : check(x - 1, y, flag)
if farm[x][y + 1] != "$" and farm[x][y + 1] == flag : check(x, y + 1, flag)
if farm[x][y - 1] != "$" and farm[x][y - 1] == ... |
s319318407 | p00118 | u489809100 | 1448975059 | Python | Python | py | Runtime Error | 0 | 0 | 642 | def check(x, y, flag):
farm[x][y] = "$"
if farm[x + 1][y] == flag : check(x + 1, y, flag)
if farm[x - 1][y] == flag : check(x - 1, y, flag)
if farm[x][y + 1] == flag : check(x, y + 1, flag)
if farm[x][y - 1] == flag : check(x, y - 1, flag)
while True:
h,w = map(int, raw_input().split())
if h == 0 and w == 0 : b... |
s755442666 | p00118 | u489809100 | 1448975281 | Python | Python | py | Runtime Error | 0 | 0 | 642 | def check(x, y, flag):
farm[x][y] = "$"
if farm[x + 1][y] == flag : check(x + 1, y, flag)
if farm[x - 1][y] == flag : check(x - 1, y, flag)
if farm[x][y + 1] == flag : check(x, y + 1, flag)
if farm[x][y - 1] == flag : check(x, y - 1, flag)
while True:
h,w = map(int, raw_input().split())
if h == 0 and w == 0 : b... |
s924102865 | p00118 | u489809100 | 1448975480 | Python | Python | py | Runtime Error | 0 | 0 | 646 | def check(x, y, flag):
farm[x][y] = "$"
if farm[x + 1][y] == flag : check(x + 1, y, flag)
if farm[x - 1][y] == flag : check(x - 1, y, flag)
if farm[x][y + 1] == flag : check(x, y + 1, flag)
if farm[x][y - 1] == flag : check(x, y - 1, flag)
return 1
while True:
h,w = map(int, raw_input().split())
if h == 0 and ... |
s773344827 | p00118 | u489809100 | 1448975632 | Python | Python | py | Runtime Error | 0 | 0 | 687 | import sys
sys.setrecursionlimit(10000)
def check(x, y, flag):
farm[x][y] = "$"
if farm[x + 1][y] == flag : check(x + 1, y, flag)
if farm[x - 1][y] == flag : check(x - 1, y, flag)
if farm[x][y + 1] == flag : check(x, y + 1, flag)
if farm[x][y - 1] == flag : check(x, y - 1, flag)
return 1
while True:
h,w = map(... |
s548810327 | p00118 | u421925564 | 1461571868 | Python | Python3 | py | Runtime Error | 0 | 0 | 747 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s824789406 | p00118 | u421925564 | 1461571951 | Python | Python3 | py | Runtime Error | 0 | 0 | 747 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s432708699 | p00118 | u421925564 | 1461572070 | Python | Python3 | py | Runtime Error | 0 | 0 | 747 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s165281318 | p00118 | u421925564 | 1461572098 | Python | Python | py | Runtime Error | 0 | 0 | 747 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s499764544 | p00118 | u421925564 | 1461649461 | Python | Python3 | py | Runtime Error | 0 | 0 | 747 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s329196479 | p00118 | u421925564 | 1461653693 | Python | Python3 | py | Runtime Error | 0 | 0 | 1046 | h = w = 0
slist =[]
list1=[]
def dfs(f):
while True:
if len(slist) == 0:
return 1
coordinate= slist.pop()
#print(coordinate)
x = coordinate[0]
y = coordinate[1]
list1[y] = list1[y][:x] + '1' + list1[y][x + 1:]
if x + 1 < w:
if list1[y]... |
s159535702 | p00118 | u421925564 | 1461653734 | Python | Python3 | py | Runtime Error | 0 | 0 | 1046 | h = w = 0
slist =[]
list1=[]
def dfs(f):
while True:
if len(slist) == 0:
return 1
coordinate= slist.pop()
#print(coordinate)
x = coordinate[0]
y = coordinate[1]
list1[y] = list1[y][:x] + '1' + list1[y][x + 1:]
if x + 1 < w:
if list1[y]... |
s508481170 | p00118 | u421925564 | 1461653759 | Python | Python3 | py | Runtime Error | 0 | 0 | 1046 | h = w = 0
slist =[]
list1=[]
def dfs(f):
while True:
if len(slist) == 0:
return 1
coordinate= slist.pop()
#print(coordinate)
x = coordinate[0]
y = coordinate[1]
list1[y] = list1[y][:x] + '1' + list1[y][x + 1:]
if x + 1 < w:
if list1[y]... |
s142838702 | p00118 | u421925564 | 1461654033 | Python | Python3 | py | Runtime Error | 0 | 0 | 1046 | h = w = 0
slist =[]
list1=[]
def dfs(f):
while True:
if len(slist) == 0:
return 1
coordinate= slist.pop()
#print(coordinate)
x = coordinate[0]
y = coordinate[1]
list1[y] = list1[y][:x] + '1' + list1[y][x + 1:]
if x + 1 < w:
if list1[y]... |
s204894645 | p00118 | u421925564 | 1461654818 | Python | Python3 | py | Runtime Error | 0 | 0 | 760 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s086812647 | p00118 | u421925564 | 1461654979 | Python | Python3 | py | Runtime Error | 0 | 0 | 760 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s540132425 | p00118 | u421925564 | 1461655447 | Python | Python3 | py | Runtime Error | 0 | 0 | 774 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
d... |
s596529673 | p00118 | u884495090 | 1461750786 | Python | Python | py | Runtime Error | 0 | 0 | 657 | #!/usr/bin/env python
matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
def dfs(x,y,fruit):
visited.append((x,y))
for v in vec:
nx = x + v[0]
ny = y + v[1]
if not (nx,ny) in visited and nx in xrange(w) and ny in xrange(h):
if matrix[ny][nx] == fruit:
dfs(nx,ny,fruit)
while Tr... |
s974924382 | p00118 | u884495090 | 1461751088 | Python | Python | py | Runtime Error | 0 | 0 | 657 | #!/usr/bin/env python
matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
def dfs(x,y,fruit):
visited.append((x,y))
for v in vec:
nx = x + v[0]
ny = y + v[1]
if not (nx,ny) in visited and nx in xrange(w) and ny in xrange(h):
if matrix[ny][nx] == fruit:
dfs(nx,ny,fruit)
while Tr... |
s419661467 | p00118 | u884495090 | 1461751428 | Python | Python | py | Runtime Error | 0 | 0 | 698 | #!/usr/bin/env python
import sys
sys.setrecursionlimit(10000)
matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
def dfs(x,y,fruit):
visited.append((x,y))
for v in vec:
nx = x + v[0]
ny = y + v[1]
if not (nx,ny) in visited and nx in xrange(w) and ny in xrange(h):
if matrix[ny][nx] == fr... |
s804996133 | p00118 | u884495090 | 1461752357 | Python | Python | py | Runtime Error | 0 | 0 | 737 | #!/usr/bin/env python
import sys
sys.setrecursionlimit(10000)
matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
h = 0
w = 0
def dfs(x,y,fruit):
global visited
visited.append((x,y))
for v in vec:
nx = x + v[0]
ny = y + v[1]
if (not (nx,ny) in visited) and nx in xrange(w) and ny in xrange(h):
... |
s373504365 | p00118 | u884495090 | 1461755424 | Python | Python | py | Runtime Error | 0 | 0 | 753 | #!/usr/bin/env python
matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
h = 0
w = 0
def dfs(x,y,fruit):
#visited.append((x,y))
visited[y][x] = 1
for v in vec:
nx = x + v[0]
ny = y + v[1]
if nx in xrange(w) and ny in xrange(h):
if visited[ny][nx]==0 and matrix[ny][nx] == fruit:
... |
s952960747 | p00118 | u884495090 | 1461755480 | Python | Python | py | Runtime Error | 0 | 0 | 793 | #!/usr/bin/env python
import sys
sys.setrecursionlimit(10000)
matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
h = 0
w = 0
def dfs(x,y,fruit):
#visited.append((x,y))
visited[y][x] = 1
for v in vec:
nx = x + v[0]
ny = y + v[1]
if nx in xrange(w) and ny in xrange(h):
if visited[ny][nx]... |
s038087022 | p00118 | u685815919 | 1473650415 | Python | Python | py | Runtime Error | 0 | 0 | 635 | dxy = [[1, 0], [0, 1], [-1, 0], [0, -1]]
field = []
H, W = 0, 0
def solver(x, y, symbol):
global field, H, W
if x < 0 or y < 0 or x >= H or y >= W:
return
for dx, dy in dxy:
if x+dx < 0 or y+dy < 0 or x+dx >= H or y+dy >= W:
continue
if field[x+dx][y+dy] == symbol:
field[x+dx][y+dy] = '.'
... |
s820051097 | p00118 | u685815919 | 1473651135 | Python | Python | py | Runtime Error | 0 | 0 | 636 | dxy = [[1, 0], [0, 1], [-1, 0], [0, -1]]
field = []
H, W = 0, 0
def solver(x, y, symbol):
global field, H, W
if x < 0 or y < 0 or x >= H or y >= W:
return
for dx, dy in dxy:
if x+dx < 0 or y+dy < 0 or x+dx >= H or y+dy >= W:
continue
if field[x+dx][y+dy] == symbol:
field[x+dx][y+dy] = '.'... |
s276510888 | p00118 | u685815919 | 1473652992 | Python | Python | py | Runtime Error | 0 | 0 | 752 | dxy = [[1, 0], [0, 1], [-1, 0], [0, -1]]
field = []
H, W = 0, 0
q = queue.Queue()
def solver(x, y, symbol):
global q, field, H, W
while True:
if x < 0 or y < 0 or x >= H or y >= W:
continue
for dx, dy in dxy:
if x+dx < 0 or y+dy < 0 or x+dx >= H or y+dy >= W:
continue
if field[x+d... |
s235387219 | p00118 | u727466163 | 1473696383 | Python | Python | py | Runtime Error | 0 | 0 | 582 | count=0
a_0=[]
a_1=[]
mode=0
init_input=raw_input().split()
n=init_input[0]
m=init_input[1]
a_0=raw_input().split()
for i in range(m):
if i==0:
count+=1
else:
if a_0[i]!=a_0[i-1]:
count+=1
mode=1
n-=1
while n>0:
if mode==0:
a_0=raw_input().split()
for i in range(m):
if a_0[i]!=a_1[i]:
if i==0:
... |
s252762473 | p00118 | u393305246 | 1473696584 | Python | Python | py | Runtime Error | 0 | 0 | 582 | count=0
a_0=[]
a_1=[]
mode=0
init_input=raw_input().split()
n=init_input[0]
m=init_input[1]
a_0=raw_input().split()
for i in range(m):
if i==0:
count+=1
else:
if a_0[i]!=a_0[i-1]:
count+=1
mode=1
n-=1
while n>0:
if mode==0:
a_0=raw_input().split()
for i in range(m):
if a_0[i]!=a_1[i]:
if i==0:
... |
s308200377 | p00118 | u393305246 | 1473696927 | Python | Python | py | Runtime Error | 0 | 0 | 592 | count=0
a_0=[]
a_1=[]
mode=0
init_input=map(int, raw_input().split())
n=init_input[0]
m=init_input[1]
a_0=raw_input().split()
for i in range(m):
if i==0:
count+=1
else:
if a_0[i]!=a_0[i-1]:
count+=1
mode=1
n-=1
while n>0:
if mode==0:
a_0=raw_input().split()
for i in range(m):
if a_0[i]!=a_1[i]:
... |
s710827057 | p00118 | u393305246 | 1473697441 | Python | Python | py | Runtime Error | 0 | 0 | 592 | count=0
a_0=[]
a_1=[]
mode=0
init_input=map(int, raw_input().split())
n=init_input[0]
m=init_input[1]
line=input()
a_0=list(line)
for i in range(m):
if i==0:
count+=1
else:
if a_0[i]!=a_0[i-1]:
count+=1
mode=1
n-=1
while n>0:
line=input()
if mode==0:
a_0=list(line)
for i in range(m):
if a_0[i]!=a_1... |
s231035398 | p00118 | u350804311 | 1473921229 | Python | Python3 | py | Runtime Error | 0 | 0 | 713 | while True:
H, W = list(map(int, input().split()))
if H == 0 and W == 0:
break
field = []
for i in range(H):
field.append(list(input()))
ans = 0
def field_count(x, y):
fruit = field[x][y]
field[x][y] = "."
for dx in [-1, 0, 1]:
nx = x + dx
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.