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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s222666787 | p03804 | u270681687 | 1546430393 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 380 | n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
for i in range(n-m+1):
for j in range(n-m)+1:
flag = 0
for k in range(m):
for l in range(m):
if a[i + k][j + l] != b[k][l]:
flag = 1
if flag == 0... |
s947098894 | p03804 | u371467115 | 1546001208 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 206 | N,M=map(int,input().strip().split(" "))
a=[input() for i in range(N)
b=[input() for i in range(M)]
N=0
if b[i] in a[i]:
N+=1
if(N==M):
print("Yes")
else:
print("No")
#コピペです。
|
s424809420 | p03804 | u853900545 | 1545084271 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 348 | n,m = map(int,input().split())
a = []
b = []
for i in range(n):
a.append(input())
for i in range(m):
b.append(input())
i = 0
k = 0
ans = 'No'
for k in range(n-m):
while i + m <= n:
if a[k][i:i+m:] == b[k]:
for j in range(m):
if all()
ans = 'Yes'
... |
s583462687 | p03804 | u026155812 | 1544249662 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 518 | n, m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n)]
B = [[int(i) for i in input().split()] for j in range(m)]
a = 0
for i in range(n-m+1):
for j in range(n-m+1):
if A[0][0] == B[i][j]:
for k in range(m):
for l in range(m):
... |
s788793387 | p03804 | u371763408 | 1544132731 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 378 | n,m=map(int,input().split())
A=[input() for i in range(n)]
B=[input() for i in range(m)]
for i in range(n):
for j in range(n):
k=j+m
if k <= n:
if A[i][j:k]== B[0]:
o=1
for l in range(i+1,i+m):
if A[l][j:k]!=B[o]:
break
else:
o+=1
if o... |
s980783965 | p03804 | u386819480 | 1541127598 | Python | Python (3.4.3) | py | Runtime Error | 151 | 12472 | 349 | ## ABC 054 b
import sys
import numpy as np
n,m = (int(_) for _ in input().split())
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]
aa = np.array(a)
bb = np.array(b)
for i in range(n-m+1):
for j in range(n-m+1):
if (bb[:, :] == aa[i:i+m, j:j+m]):
print('Yes')
... |
s250237858 | p03804 | u386819480 | 1541004312 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 692 | ## ABC 054 B
import sys
n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for j in range(m)]
if(n == m and a == b):
print('Yes')
sys.exit(0)
elif(m == 1):
for i in range(n):
if(b[0] in a[i]):
print('Yes')
sys.exit(0)
print('No')
sys.exit(... |
s850259764 | p03804 | u595353654 | 1539537031 | Python | Python (3.4.3) | py | Runtime Error | 148 | 12408 | 302 | # -*- coding: utf-8 -*-
from sys import stdin
import numpy as np
stdin = open("sample.txt")
n,m = [int(x) for x in stdin.readline().rstrip().split()]
A = []
for i in range(n):
s = stdin.readline().rstrip()
A.append(s)
B = []
for i in range(m):
s = stdin.readline().rstrip()
B.append(s) |
s097273242 | p03804 | u099918199 | 1538108821 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 565 | phase = 0
if list_a != list_b:
for i in range(0, n-m):
for j in range(0, n-m):
for k in range(0,m):
if list_a[i+k][j:j+m] == list_b[k]:
if k != m-1:
continue
else:
pass
else:
... |
s634270622 | p03804 | u474270503 | 1536438368 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 253 | N,M=map(int, input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
for i in range(N-M+1):
for j in range(N-M+1):
t=[k[j:j+m] for k in a[i:i+m]]
if t==B:
print('Yes')
exit()
print('No')
|
s405652405 | p03804 | u474270503 | 1536438342 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 253 | N,M=map(int, input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
for i in range(N-M+1):
for j in range(N-M+1):
t=[k[j:j*m] for k in a[i:i+m]]
if t==B:
print('Yes')
exit()
print('No')
|
s093275757 | p03804 | u474270503 | 1536437464 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 248 | N,M=map(int, input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
for i in range(N):
if B[0] in A[i]:
if all(B[j] in A[i+j] for j in range(1,min(M,N-i)):
print('Yes')
exit(0)
print('No')
|
s192114300 | p03804 | u474270503 | 1536437340 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 240 | N,M=map(int, input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
for i in range(N):
if B[0] in A[i]:
if all(B[j] in A[i+j] for j in range(1,M)):
print('Yes')
exit(0)
print('No')
|
s094703278 | p03804 | u017810624 | 1536430240 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 304 | n,m=map(int,input().split())
a=[list(input()) for a in range(n)]
b=[list(input()) for a in range(m)]
c=0
for p in range(n-m+1):
for q in range(n-m+1):
if b[0]==a[p][q:q+m]:
for r in range(1,m):
if b[r]!=a[p+r][q:q+m]:break
c=1
break
if c==0:print('No')
else:print('Yes') |
s770331623 | p03804 | u017810624 | 1536426303 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 314 | n,m=map(int,input().split())
a=[list(input()) for a in range(n)]
b=[list(input()) for a in range(m)]
c=0
for p in range(n-m+1):
for q in range(n-m+1):
if b[0]==a[p][q:q+m]:
for r in range(n-m+1):
if b[r]!=a[p+r][q-m+1:q]:pass
else:break
c=1
if c==1:print('Yes')
else:print('No') |
s140342026 | p03804 | u362560965 | 1535165374 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 443 | N, M = (int(i) for i in input().split())
A = []
B = []
for i in range(N):
A.append(input())
for i in range(M):
B.append(input())
for i in range(N-M+1):
if B[0] in A[i]:
pos = A[i].find(B[j])
flag = 0
for j in range(M):
if A[i+j][pos:pos+M] == B[j]:
pass
... |
s260405479 | p03804 | u690536347 | 1533230385 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 337 | def f():
n,m=map(int,input().split())
o=[input() for _ in range(n)]
p=[input() for _ in range(m)]
for i in range(n-m+1):
for j in range(n-m+1):
for k in range(i,n-m+1):
for l in range(j,n-m+1):
if p[k-i][l-j]!=o[k][l]:
return False
return True
if f():
print("Yes")
el... |
s112525938 | p03804 | u690536347 | 1533230328 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 337 | def f():
n,m=map(int,input().split())
o=[input() for _ in range(n)]
p=[input() for _ in range(m)]
for i in range(n-m+1):
for j in range(n-m+1):
for k in range(i,n-m+1):
for l in range(j,n-m+1):
if p[k-i][l-i]!=o[k][l]:
return False
return True
if f():
print("Yes")
el... |
s859658775 | p03804 | u690536347 | 1533229942 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 333 | def f():
n,m=map(int,input().split())
o=[input() for _ in range(n)]
p=[input() for _ in range(m)]
for i in range(n-m+1):
for j in range(n-m+1):
for k in range(i,n-1):
for l in range(j,n-1):
if p[k-i][l-i]!=o[k][l]:
return False
return True
if f():
print("Yes")
else:
... |
s870817189 | p03804 | u612721349 | 1532092384 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 301 | n, m = map(int, input().split())
np = [input() for _ in range(n)]
mp = [input() for _ in range(m)]
for i in range(n-m-1):
for j in range(n-m-1):
f = True
for k in range(m):
if np[i+k][j:j+m] != mp[i+k]:
f = False
if f:
print("Yes")
exit(0)
else:
print("No") |
s435100232 | p03804 | u612721349 | 1532092270 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 297 | n, m = map(int, input().split())
np = [input() for _ in range(n)]
mp = [input() for _ in range(m)]
for i in range(n-m):
for j in range(n-m):
f = True
for k in range(m):
if np[i+k][j:j+m] != mp[i+k]:
f = False
if f:
print("Yes")
exit(0)
else:
print("No") |
s366631930 | p03804 | u140251125 | 1532013460 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 515 | # input
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
for i in range(N - M + 1):
for j in range(N - M + 1):
for k in range(M):
for l in range(M):
if B[k][l] == A[i + k][j + l]:
ans += 1
... |
s392490048 | p03804 | u820351940 | 1530994154 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 263 | n, m = map(int, input().split())
img = [input() for i in range(n)]
template = [input() for i in range(m)]
for i in range(n - m + 1):
if len({v.index(t) for v, t in zip(img[i:i + m], template)}) == 1:
print("Yes")
break
else:
print("No")
|
s910926431 | p03804 | u333139319 | 1530283742 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 460 | [n,m]=[int(i) for i in input().split()]
a=[]
b=""
c=[]
d=""
e=1
#a箱,c箱にそれぞれの画像を用意
for i in range(n):
b=b+str(input().split())
a.append(b)
for i in range(m):
d=d+str(input().split())
c.append(d)
print(c)
print(d)
#照合
for i in range(n):
for j in range(m):
f=c[j].find(a[i])
if f!=-1:
... |
s379012168 | p03804 | u459283268 | 1528585492 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 566 | n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False
for i in range(n-m+1):
for j in range(n-m+1):
for k in range(n):
match = False
if a[i][k: k+m] == b[j] and not exits:
for l in range(1, m):
... |
s040760174 | p03804 | u459283268 | 1528585422 | Python | Python (3.4.3) | py | Runtime Error | 54 | 3064 | 558 | n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False
for i in range(n):
for j in range(m):
for k in range(n):
match = False
if a[i][k: k+m] == b[j] and not exits:
for l in range(1, m):
if a... |
s456910412 | p03804 | u459283268 | 1528585349 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 558 | n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False
for i in range(n):
for j in range(n):
for k in range(n):
match = False
if a[i][k: k+m] == b[j] and not exits:
for l in range(1, m):
if a... |
s941001942 | p03804 | u459283268 | 1528585192 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 564 | n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False
for i in range(n-m+1):
for j in range(n-m+1):
for k in range(n):
match = False
if a[i][k: k+m] == b[j] and not exits:
for l in range(1, m):
... |
s983733132 | p03804 | u214617707 | 1527433652 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 601 | n, m = map(int, input().split())
T1 = [[] for i in range(n)]
T2 = [[] for i in range(m)]
for i in range(n):
a = list(input())
T1[i] = a
for i in range(m):
a = list(input())
T2[i] = a
flag = False
for i in range(n - m + 1):
for j in range(n - m + 1):
if T1[i][j: j + m] == T2[0]:
... |
s900416461 | p03804 | u214617707 | 1527433532 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 597 | n, m = map(int, input().split())
T1 = [[] for i in range(n)]
T2 = [[] for i in range(m)]
for i in range(n):
a = list(input())
T1[i] = a
for i in range(m):
a = list(input())
T2[i] = a
flag = False
for i in range(n - m):
for j in range(n - m):
if T1[i][j: j + m] == T2[0]:
k = i
... |
s700498340 | p03804 | u040380068 | 1524597882 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 398 | def judge(a, b, y, x, m):
for i in range(0, m):
for j in range(0, m):
if a[y+i][x+j] != b[y][x]: return False
return True
N, M = map(int, raw_input().split())
A = []
B = []
for i in range(0, N):
A.append(raw_input())
for i in range(0, M):
B.append(raw_input())
ans = 'No'
for i in range(0, N-M+1):
for j in r... |
s892027948 | p03804 | u040380068 | 1524597786 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 402 | def judge(a, b, y, x, m):
for i in range(0, m):
for j in range(0, m):
if a[y+i][x+j] != b[y+i][x+j]: return False
return True
N, M = map(int, raw_input().split())
A = []
B = []
for i in range(0, N):
A.append(raw_input())
for i in range(0, M):
B.append(raw_input())
ans = 'No'
for i in range(0, N-M+1):
for j ... |
s677065292 | p03804 | u803647747 | 1524427932 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 646 | N, M = map(int, input().split())
A_list = []
B_list = []
for _ in range(N):
A_list.append(list(input()))
for _ in range(M):
B_list.append(list(input()))
match_list =[]
for i in range(N-M+1):
for j in range(N-M+1):
if B_list[0] == A_list[i][j:(j+M)]:
match_list.append([i, j])
... |
s825857234 | p03804 | u803647747 | 1524427600 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 634 | N, M = map(int, input().split())
A_list = []
B_list = []
for _ in range(N):
A_list.append(list(input()))
for _ in range(M):
B_list.append(list(input()))
match_list =[]
for i in range(N-M+1):
for j in range(N-M+1):
if B_list[0] == A_list[i][j:(j+M)]:
match_list.append([i, j])
... |
s144589650 | p03804 | u803647747 | 1524427362 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 658 | N, M = map(int, input().split())
A_list = []
B_list = []
for _ in range(N):
A_list.append(list(input()))
for _ in range(M):
B_list.append(list(input()))
match_list =[]
for i in range(N-M+1):
for j in range(N-M+1):
if B_list[0] == A_list[i][j:(j+M)]:
match_list.append([i, j])
... |
s436250357 | p03804 | u557171945 | 1522792243 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38640 | 646 | n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
i,j = 0,0
start = []
while i<=n-m:
if b[0] in a[i]:
start.append(a[i].index(b[0]))
j += 1
for k in range(1,m):
if b[k] in a[i+j]:
start.append(a[i+j].index(b[k]))
... |
s589668578 | p03804 | u557171945 | 1522791737 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38640 | 634 | n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
i,j = 0,0
start = []
while i<=n-m:
if b[0] in a[i]:
start.append(a[i].index(b[0]))
j += 1
for k in range(1,m):
if b[k] in a[i+j]:
start.append(a[i+j].index(b[k]))
... |
s267372767 | p03804 | u557171945 | 1522769497 | Python | PyPy3 (2.4.0) | py | Runtime Error | 166 | 38640 | 598 | n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
i,j = 0,0
start = []
while i<n-m:
if b[0] in a[i]:
start.append(a[i].index(b[0]))
j += 1
for k in range(1,m):
if b[k] in a[i+j]:
start.append(a[i+j].index(b[k]))
... |
s992920173 | p03804 | u030726788 | 1519272940 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 460 | import sys
N,M=map(int,input().split())
Ai=[]
Bi=[]
for i in range(N):
Ai.append(input())
for i in range(M):
Bi.append(input())
roop=N-M+1
for i in range(roop):
for j in range(roop):
#print("")
flag=1
for k in range(roop):
#print(Ai[i+k][j:j+M])
if(Ai[i+k][j:j... |
s721520865 | p03804 | u103539599 | 1517112584 | Python | Python (3.4.3) | py | Runtime Error | 377 | 18604 | 366 | import numpy as np
N,M=map(int, input().split())
A=[]
for i in range(N):
a=list(input())
A.append(a)
B=[]
for i in range(M):
b=list(input())
B.append(b)
An=np.array(A)
Bn=np.array(B)
t=0
for i in range(N):
for j in range(N):
if Bn in An[i:i+M,j:j+M]:
t=1
break
if... |
s737834903 | p03804 | u010110540 | 1506708142 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 471 | N = int(input())
M = int(input())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
for i in range(N-M+1):
for j in range(N-M+1):
flag = True
for k in range(M):
for l in range(M):
if A[i+k][j+l] != B[k][l]:
flag = False
... |
s076571041 | p03804 | u665415433 | 1506565457 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 661 | def solve(n, m, NUM):
for i in range(len(m)):
if n[NUM + i] is not m[i]:
return -1
return 1
N, M = [int(i) for i in input().split()]
n_pic = [input() for i in range(N)]
m_pic = [input() for i in range(M)]
num = 0
if M is 1:
for n in n_pic:
if -1 is not n.find(m_pic[0]):
... |
s692592268 | p03804 | u665415433 | 1506564612 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3064 | 607 | def solve(n, m, NUM):
for i in range(len(m)):
if n[NUM + i] is not m[i]:
return -1
return 1
N, M = [int(i) for i in input().split()]
n_pic = [input() for i in range(N)]
m_pic = [input() for i in range(M)]
num = 0
if M is 1:
for n in n_pic:
if -1 is not n.find(m_pic[0]):
... |
s060513174 | p03804 | u075012704 | 1492049602 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 389 | N , M = map(int , input().split())
A = []
B = []
flg=True
for i in range(N):
A.append([j for j in input()])
for i in range(M):
B.append([j for j in input()])
for i in range((N-M-1)*(N-M-1)):
for j in range(M):
for l in range(M):
if B[j][l] != A[j+i][l+i]:
flg = False
... |
s285931094 | p03804 | u107077660 | 1491342622 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 371 |
N, M = map(int, input().split())
A = []
for i in range(N):
A.append(input())
B = []
for i in range(M):
B.append(input())
t = 0
for i in range(N):
for j in range(N-M):
t = 0
for k in range(M):
if t:
break
for l in range(M):
if A[i+k][j+l] != B[k][l]:
t = 1
break
else:
if A[i+k][j+l] ... |
s152276666 | p03804 | u622568141 | 1489554886 | Python | Python (3.4.3) | py | Runtime Error | 282 | 20656 | 661 | # -*- coding: utf-8 -*-
import sys
import math
import numpy as np
def main():
# 入力処理
# M = int(input())
N, M = map(int, input().split())
sA = ''.join([input() for i in range(N)])
sB = ''.join([input() for i in range(M)])
A = np.array([s for s in sA]).reshape(N,N)
B = np.array([s for s in s... |
s348580005 | p03804 | u466826467 | 1489125296 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3316 | 794 | import re
first_line = input().split()
n = int(first_line[0])
m = int(first_line[1])
n_list = []
for i in range(n):
n_list.append(input())
m_list = []
for i in range(m):
m_list.append(input())
if m == n:
if n_list == m_list:
print("Yes")
else:
print("No")
else:
match_flg = False
... |
s121067134 | p03804 | u848877025 | 1488686694 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2692 | 805 | def main():
nm = map(int, raw_input().split())
A = []
B = []
flag = False
for i in range(nm[0]):
A.append(raw_input())
for i in range(nm[1]):
B.append(raw_input())
for i in range(nm[0]):
for j in range(nm[0]):
if j + nm[1] <= nm[0]:
for k ... |
s673294446 | p03804 | u848877025 | 1488686648 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2696 | 805 | def main():
nm = map(int, raw_input().split())
A = []
B = []
flag = False
for i in range(nm[0]):
A.append(raw_input())
for i in range(nm[1]):
B.append(raw_input())
for i in range(nm[0]):
for j in range(nm[0]):
if j + nm[1] <= nm[0]:
for k ... |
s774181104 | p03804 | u848877025 | 1488686589 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2696 | 805 | def main():
nm = map(int, raw_input().split())
A = []
B = []
flag = False
for i in range(nm[0]):
A.append(raw_input())
for i in range(nm[1]):
B.append(raw_input())
for i in range(nm[0]):
for j in range(nm[0]):
if j + nm[1] <= nm[0]:
for k ... |
s187061516 | p03804 | u916127336 | 1488093016 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 308 | N, M = map(int, raw_input().split())
imgA = []
imgB = []
for i in range(N):
imgA += raw_input().split()
for i in range(M):
imgB += raw_input().split()
for i in range(N - M):
for j in range(M):
for k in range(M):
if (imgA[(i + k) * N + j] != imgB[k * M + j]): return 'No'
return 'Yes'
|
s920278968 | p03804 | u805887876 | 1487798561 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 327 | for i in xrange(0,n-m+1):
for j in xrange(0, n-m+1):
flag = True
for x in xrange(0, m):
for y in xrange(0, m):
if mp[x][y] != np[i+x][j+y]:
flag = False
break
if flag == False:
break
if flag:
print "Yes"
break
if flag: break
if flag==False: pri... |
s846546076 | p03804 | u805887876 | 1487798385 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 440 | n,m = map(int, raw_input().split())
np=[]
mp=[]
for i in xrange(0, n):
np.append(raw_input())
for i in xrange(0, m):
mp.append(raw_input())
for i in xrange(0,n-m+1):
for j in xrange(0, n-m+1):
flag = True
for x in xrange(0, m):
for y in xrange(0, m):
if mp[x][y] != np[i+x][j+y]:
f... |
s357992703 | p03804 | u805887876 | 1487797747 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 376 | np=[]
mp=[]
for i in xrange(0, n):
np.append(raw_input())
for i in xrange(0, m):
mp.append(raw_input())
for i in xrange(0,n-m):
for j in xrange(0, n-m):
flag = True
for l in xrange(0, m):
for m in xrange(0, n):
if mp[l][m] != np[i][j]:
flag = False
break
if !flag:
... |
s104330711 | p03804 | u098572984 | 1487127977 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 499 | N, M = input().split()
A=[]
for i in range(0,N):
A.append(input())
B=[]
for j in range(0,M):
B.append(input())
ref_tuple = zip(range(0,N-M+1),range(0,N-M+1))
t=False
for ref_row_a, ref_col_a in ref_tuple:
for row_b, col_b in zip(range(0,M),range(0,M)):
if not A[ref_row_a+row_b][ref_col_a+col_b]==B[... |
s750503407 | p03804 | u249895018 | 1486922608 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 723 | #include <string>
#include <iostream>
using namespace std;
const int nmax = 50;
const int mmax = 50;
char N_sq[nmax][nmax], M_sq[mmax][mmax];
bool judge_match(int x, int y, int M){
for(int i=0;i<M;i++){
for(int j=0;j<M;j++){
if(N_sq[y+i][x+j] != M_sq[y+i][x+j]) return false;
}
}
return true;
}
int main(... |
s201086430 | p03804 | u889075007 | 1486881786 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 631 | # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
checker = True
n, m = map(int, raw_input().split())
N = []
M = []
counter = 0
ans = "No"
flag = 0
while checker:
tmp = raw_input()
if counter < n:
N.append(tmp)
else:
M.append(tmp)
counter += 1
if counter == n + m:
break
if M[0].find(... |
s593564565 | p03804 | u598167418 | 1486868768 | Python | Python (2.7.6) | py | Runtime Error | 42 | 2696 | 724 | import sys
n,m = map(int,raw_input().split())
a = [[0 for i in range(n)] for j in range(n)]
b = [[0 for i in range(m)] for j in range(m)]
z = []
for i in range(n):
at = list(raw_input())
a[i] = at
for i in range(m):
at = list(raw_input())
b[i] = at
if n == m:
if a == b:
print "Yes"
... |
s687871371 | p03804 | u106342872 | 1486867311 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 442 | n,m = map(int,input().split())
a = []
for i in range(n):
a.append(str(input()))
b = []
for i in range(m):
b.append(str(input()))
f = [0]*m
count = 0
for j in range(m):
f[j] = a[j].find(b[j])
while -1 in f: f.remove(-1)
if len(f) == 0:
print('No')
else:
flag = 1
for i in range(len(f)):
... |
s646773390 | p03804 | u714779404 | 1486867283 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2696 | 1260 | n,m = map(int, raw_input().split())
n_list = [] #row major format
m_list = []
for i in range(0, n):
n_list.append(raw_input())
for x in range(0, m):
m_list.append(raw_input())
def match_first_rows(n_start):
result = (-1,-1)
first_m = m_list[0] # first row
for x in range(n_start, n):
n_row = n_list[x]
if firs... |
s697519693 | p03804 | u713023102 | 1486867179 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2692 | 453 | data = raw_input()
n,m = map(int,data.split(" "))
data = []
for x in range(n):
data.append(raw_input())
temp = []
for x in range(m):
temp.append(raw_input())
for x in range(n):
for y in range(n):
if temp[0] == data[x][y:y+m]:
flag = 1
pos = y
for xx in range(x+1,x+m):
if temp[x... |
s635198612 | p03804 | u106342872 | 1486867144 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 463 | n,m = map(int,input().split())
a = []
for i in range(n):
a.append(str(input()))
b = []
for i in range(m):
b.append(str(input()))
f = [0]*m
count = 0
for j in range(m):
f[j] = a[j].find(b[j])
while -1 in f: f.remove(-1)
if len(f) == 0:
print('No')
else:
flag = 1
for i in range(len(f)):
... |
s646013440 | p03804 | u668253056 | 1486867133 | Python | Python (3.4.3) | py | Runtime Error | 1555 | 16800 | 538 | import numpy as np
import sys
temp = input().split()
N = int(temp[0])
M = int(temp[1])
A = []
B = []
check = False
def change(n):
if(n=='#'):
return True;
return False;
for i in range(N):
temp = input()
A.append(list(map(change, temp)))
for i in range(M):
temp = input()
B.append(list(map(change, temp))... |
s243926733 | p03804 | u553070003 | 1486867076 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 587 | n, m = map(int, input().split())
A, B = [], []
for i in range(n):
A.append(input())
for i in range(m):
B.append(input())
def is_contain(i, b_pos):
containing = True
for a_i in range(i+1, i+m):
if A[a_i][b_pos:(b_pos+len(B))] != B[a_i]:
containing = False
return containing
if ... |
s170732204 | p03804 | u668253056 | 1486867041 | Python | Python (3.4.3) | py | Runtime Error | 282 | 20744 | 474 | import numpy as np
import sys
temp = input().split()
N = int(temp[0])
M = int(temp[1])
A = []
B = []
def change(n):
if(n=='#'):
return True;
return False;
for i in range(N):
temp = input()
A.append(list(map(change, temp)))
for i in range(M):
temp = input()
B.append(list(map(change, temp)))
A = np.array... |
s041461362 | p03804 | u714779404 | 1486866817 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1262 | n,m = map(int, raw_input().split())
n_list = [] #row major format
m_list = []
for i in range(0, n):
n_list.append(raw_input())
for x in range(0, m):
m_list.append(raw_input())
def match_first_rows(n_start):
result = (-1,-1)
first_m = m_list[0] # first row
for x in range(n_start, n):
n_row = n_list[x]
if firs... |
s549996123 | p03804 | u668253056 | 1486866684 | Python | Python (3.4.3) | py | Runtime Error | 299 | 12756 | 451 | import numpy as np
import sys
N = int(input())
M = int(input())
A = []
B = []
def change(n):
if(n=='#'):
return True;
return False;
for i in range(N):
temp = input()
A.append(list(map(change, temp)))
for i in range(M):
temp = input()
B.append(list(map(change, temp)))
A = np.array(A)
B = np.array(B)
fo... |
s283069002 | p03804 | u102113963 | 1486866548 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 476 | N,M = map(int, input().split())
A = []
B = []
for i in range(N):
A.append(input())
for i in range(M):
B.append(input())
for i in range(N-M):
x = A[i].find(B[0])
if x != -1:
result = True
break
result = False
for j in range(1,M):
if (j >= M or j >= N ):
result = False
... |
s833950404 | p03804 | u102113963 | 1486866419 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 411 | N,M = map(int, input().split())
A = []
B = []
for i in range(N):
A.append(input())
for i in range(M):
B.append(input())
for i in range(N-M):
x = A[i].find(B[0])
if x != -1:
result = True
break
result = False
for j in range(1,M):
idx = A[j][x:].find(B[j])
if idx != x:
... |
s137378914 | p03804 | u272028993 | 1486865447 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 493 | def check(y,x):
if 0<=y<=n-1 and 0<=x<=n-1:
return True
return False
n,m=map(int,raw_input().split())
a=[raw_input() for _ in xrange(n)]
b=[raw_input() for _ in xrange(m)]
for i in xrange(m):
for j in xrange(m):
cnt=0
for k in range(i,i+m):
for l in xrange(j,j+m):
... |
s944746041 | p03805 | u521323621 | 1600990215 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9580 | 381 | import queue
n,m = map(int, input().split())
ma = [[] for i in range(n+1)]
for i in range(n):
a,b = map(int, input().split())
ma[a].append(b)
ma[b].append(a)
ans = 0
def dfs(i):
global ans
if all(reach[1:]):
ans += 1
for j in ma[i]:
if reach[j] == 1:
continue
reach[j] = 1
dfs(j)
... |
s414476205 | p03805 | u682467216 | 1600902495 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 75004 | 1664 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s614395127 | p03805 | u682467216 | 1600901928 | Python | PyPy3 (7.3.0) | py | Runtime Error | 84 | 74992 | 1854 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s031388351 | p03805 | u682467216 | 1600901763 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9648 | 1814 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s995240667 | p03805 | u682467216 | 1600901681 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 69044 | 1814 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s200072422 | p03805 | u682467216 | 1600901661 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 74948 | 1814 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s563546010 | p03805 | u682467216 | 1600901598 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 74868 | 1815 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s045431895 | p03805 | u682467216 | 1600901563 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74772 | 1806 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s522019958 | p03805 | u682467216 | 1600901364 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 75032 | 1814 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s044719905 | p03805 | u682467216 | 1600901086 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 74900 | 1814 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s726346477 | p03805 | u682467216 | 1600900760 | Python | PyPy3 (7.3.0) | py | Runtime Error | 97 | 75128 | 1810 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s213590428 | p03805 | u682467216 | 1600900580 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 85368 | 1825 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s570101249 | p03805 | u682467216 | 1600900452 | Python | PyPy3 (7.3.0) | py | Runtime Error | 83 | 74808 | 1813 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s382214926 | p03805 | u682467216 | 1600900128 | Python | PyPy3 (7.3.0) | py | Runtime Error | 83 | 74860 | 1822 | # coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, ... |
s536862909 | p03805 | u339199690 | 1600696002 | Python | PyPy3 (7.3.0) | py | Runtime Error | 84 | 68452 | 414 | from itertools import permutations
N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N):
a, b = map(int, input().split())
a, b = a - 1, b - 1
G[a].append(b)
G[b].append(a)
res = 0
for P in permutations(range(N), N):
if P[0] != 0:
continue
for i in range(N - 1):... |
s569519923 | p03805 | u339199690 | 1600695995 | Python | Python (3.8.2) | py | Runtime Error | 36 | 9152 | 414 | from itertools import permutations
N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N):
a, b = map(int, input().split())
a, b = a - 1, b - 1
G[a].append(b)
G[b].append(a)
res = 0
for P in permutations(range(N), N):
if P[0] != 0:
continue
for i in range(N - 1):... |
s473376682 | p03805 | u745561510 | 1600555047 | Python | PyPy3 (7.3.0) | py | Runtime Error | 119 | 74116 | 481 | import itertools
N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
a, b = map(lambda x: int(x) - 1, input().split())
G[a].append(b)
G[b].append(a)
pattern = [i for i in range(N)]
ans = 0
for i in itertools.permutations(pattern):
flag = True
now = i[j]
to = i[j+1]
... |
s852504653 | p03805 | u745561510 | 1600555022 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 74708 | 485 | import itertools
N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
a, b = map(lambda x: int(x) - 1, input().split())
G[a].append(b)
G[b].append(a)
pattern = [i for i in range(N)]
ans = 0
for i in itertools.permutations(pattern):
flag = True
now = i[j]
next = i[j+1... |
s524134344 | p03805 | u806976856 | 1600209808 | Python | PyPy3 (7.3.0) | py | Runtime Error | 102 | 74420 | 360 | n,m=map(int,input().split())
road=[[] for _ in range(n+1)]
for i in range(m):
a,b=map(int,input().split())
road[a].append(b)
road[b].append(a)
dp=[[0]*(n+1) for _ in range(2**n)]
dp[1][1]=1
for i in range(1,2**n):
for j in range(1,n+1):
for k in road[j]:
dp[i+2**(k-1... |
s774041025 | p03805 | u637289184 | 1599663753 | Python | PyPy3 (7.3.0) | py | Runtime Error | 94 | 74564 | 408 | import itertools
N, M = map(int, input().split())
p=[[0]*N for i in range(N)]
for i in range(M):
a,b=map(int,input().split())
p[a-1][b-1]=1
p[b-1][a-1]=1
cnt=0
a=[i for i in range(N)]
for i in itertools.permutations(a):
flag=0
if i[0]==0:
for j in range(1,M):
if p[i[j]][i[j-1]]!... |
s625726331 | p03805 | u552738814 | 1599623188 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9148 | 861 | N,M = map(int,input.split())
#iから進める場所をリストにして保管
edges = {i:[] for i in range(1,N+1)}
for i in range(M):
a,b = [int(a) for a in input().split()]
edges[a].append(b)
edges[b].append(a)
#深さ優先探索
def dfs(list):
#lst(通過点)の数がN(頂点数)と等しくなったら探索終了(成功)
if len(list) == N:
return 1
else:
a = list[-1]
#ls... |
s319398602 | p03805 | u552738814 | 1599622913 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9096 | 832 | N,M = map(int,input().split())
edges = {i:[] for i in range(1,M+1)}
for i in range(M):
a,b = map(int,input().split())
edges[a].append(b)
edges[b].append(a)
#深さ優先探索
def dfs(list):
#lst(通過点)の数がN(頂点数)と等しくなったら探索終了(成功)
if len(list) == N:
return 1
else:
x = list[-1]
#lstの最後尾(現... |
s209328469 | p03805 | u637289184 | 1599620667 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74616 | 353 | import itertools
N, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(N)]
cnt=0
for l in range(1,N+1):
for i in itertools.combinations(A,l):
a=[0]*N
for j,k in i:
a[j-1]+=1
a[k-1]+=1
if a[0]==1 and a.count(1)==2 and a.count(2)==N-2:
... |
s679940020 | p03805 | u314825579 | 1598161969 | Python | Python (3.8.2) | py | Runtime Error | 88 | 9096 | 460 | #一度だけ頂点を通る⇒辺の数=頂点-1
import itertools
Mlist=[]
N,M=map(int,input().split(' '))
for i in range(N):
Mlist.append(list(map(int,input().split(" "))))
all_parterns=itertools.permutations(range(M),r=N-1)
#all_parterns=[(0,2,3,5,6,1)]
ans=0
for partern in all_parterns:
x=1
IsOk=True
for i in partern:
a,b=Mlist[... |
s602129097 | p03805 | u200916944 | 1597975372 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9100 | 492 | from itertools import permutations
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
m = [set() for _ in range(1, 9)]
for a, b in AB:
m[a].add(b)
m[b].add(a)
def main():
ans = []
def traverse(n, visits):
visits = visits | set([n])
if len(visits) ... |
s109328626 | p03805 | u106971015 | 1597805754 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9188 | 528 | N,M = map(int,input().split())
line = [[] for _ in range(M)]
for _ in range(N):
a,b = map(int,input().split())
line[a-1].append(b-1)
line[b-1].append(a-1)
check = [False] * N
def dfs(now):
global cnt
global ans
if cnt == N:
ans += 1
else:
for i in line[now]:
if... |
s269078733 | p03805 | u106971015 | 1597805537 | Python | Python (3.8.2) | py | Runtime Error | 33 | 9140 | 528 | N,M = map(int,input().split())
line = [[] for _ in range(M)]
for _ in range(M):
a,b = map(int,input().split())
line[a-1].append(b-1)
line[b-1].append(a-1)
check = [False] * N
def dfs(now):
global cnt
global ans
if cnt == N:
ans += 1
else:
for i in line[now]:
if... |
s796149391 | p03805 | u648881683 | 1597606963 | Python | Python (3.8.2) | py | Runtime Error | 824 | 502068 | 965 | import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [... |
s845322609 | p03805 | u035210736 | 1597366662 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9152 | 355 | n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
c = [i for i in range(2, n + 1)]
b = []
for x in itertools.permutations(c):
b.append([1] + list(x))
cnt = 0
for x in b:
exist = True
for i in range(n-1):
if not sorted(x[i:i+2]) in a:
exist = False
break
... |
s255803966 | p03805 | u338597441 | 1597246733 | Python | Python (3.8.2) | py | Runtime Error | 36 | 9116 | 435 | import itertools as it
n,m=map(int,input().split())
ans=[]
for i in range(n):
a,b=map(int,input().split())
ans.append([a,b])
ans.append([b,a])
a=0
for e in it.permutations(range(n)):
#print(e)
count=1
if e[0]!=0:
break
for i in range(n-1):
if [e[i]+1,e[i+1]+1] in ans... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.