problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03804
u594956556
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(N)]\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n \n for k in range(M):\n if A[i+k][j:j+M] != B[k]:\n break\n else:\n print('Yes')\n exit()\n \n break\n\nprint('No')", "N, M = ...
['Runtime Error', 'Accepted']
['s395446636', 's585396521']
[3064.0, 3060.0]
[18.0, 18.0]
[291, 275]
p03804
u601913978
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["import sys\nn, m = map(int, input().split())\nn_list = [list(input()) for i in range(n)]\nm_list = [list(input()) for i in range(m)]\n\ndef bunkatu(x, y):\n global n_list\n lis = []\n for i in range(y, y + m):\n lis.append(n_list[i][x: x + m])\n return lis\n\nfor j in range(n - m + 1):\n for i i...
['Wrong Answer', 'Accepted']
['s900186956', 's211540978']
[3064.0, 3064.0]
[23.0, 25.0]
[439, 439]
p03804
u609738635
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['# -*- coding: utf-8 -*-\n\ndef solve(N, M, A, B):\n \n include = False\n for h in range(N-M+1):\n for w in range(N-M+1):\n match = True\n for i in range(M):\n for j in range(M):\n if(A[h+i][w+j] != B[i][j]):\n match = False...
['Runtime Error', 'Accepted']
['s150193123', 's877926689']
[3064.0, 3064.0]
[17.0, 93.0]
[616, 599]
p03804
u612721349
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n, m = map(int, input().split())\nnp = [input() for _ in range(n)]\nmp = [input() for _ in range(m)]\nfor i in range(n-m-1):\n for j in range(n-m-1):\n f = True\n for k in range(m):\n if np[i+k][j:j+m] != mp[i+k]:\n f = False\n if f:\n print("Yes")\n exit(0)\nelse:\n print("No")', '...
['Runtime Error', 'Accepted']
['s870817189', 's732413865']
[3064.0, 3060.0]
[18.0, 24.0]
[301, 299]
p03804
u619197965
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m=[int(i) for i in input().split()]\na=[input() for i in range(n)]\nb=[input() for i in range(m)]\nfor i in range(m):\n for j in range(len(b[i])):\n if b[i][j]!=a[i][j]:\n result=True\n break\nprint("No" if result else "Yes")', 'n,m=[int(i) for i in input().split()]\na=[input() for i...
['Runtime Error', 'Accepted']
['s367430668', 's000239008']
[3060.0, 3188.0]
[17.0, 19.0]
[251, 226]
p03804
u622568141
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["# -*- coding: utf-8 -*-\nimport sys\nimport math\nimport numpy as np\n\n\ndef main():\n \n # M = int(input())\n N, M = map(int, input().split())\n sA = ''.join([input() for i in range(N)])\n sB = ''.join([input() for i in range(M)])\n A = np.array([s for s in sA]).reshape(N,N)\n B = np.array([s f...
['Runtime Error', 'Accepted']
['s152276666', 's014625030']
[20656.0, 20668.0]
[282.0, 289.0]
[661, 665]
p03804
u626468554
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['#n = int(input())\n#n,k = map(int,input().split())\n#x = list(map(int,input().split()))\n\n\nN,M = map(int,input().split())\nA = [list(input()) for _ in range(N)]\nB = [list(input()) for _ in range(M)]\n\nflg1 = 1\nflg2 = 0\nfor i in range(N-M):\n if flg2:\n break\n for j in range(N-M):\n if flg2:...
['Wrong Answer', 'Accepted']
['s811088494', 's989724774']
[3064.0, 3064.0]
[22.0, 23.0]
[685, 711]
p03804
u637175065
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\ndef LI(): return list(map(int, input().split()))\ndef II(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\n\ndef main():\n n,...
['Wrong Answer', 'Accepted']
['s735299481', 's280187648']
[6924.0, 5536.0]
[74.0, 53.0]
[968, 968]
p03804
u637824361
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\nA = [input() for i in range(N)]\nB = [input() for i in range(M)]\ni = 0\nwhile(i <= N - M):\n x = A[i].find(B[0])\n while(N - M >= x >= 0):\n for j in range(1,M):\n if A[i+j][x-1:x-1+M] != B[j]:\n x = A[i].find(B[0], x+1)\n break\...
['Wrong Answer', 'Accepted']
['s204885735', 's470646754']
[3064.0, 3064.0]
[18.0, 18.0]
[389, 391]
p03804
u655975843
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n, m = list(map(int, input().split()))\nA = []\nB = []\nfor i in range(n):\n A.append([input()])\nfor i in range(m):\n B.append([input()])\nif m > n:\n print('No')\n exit(0)\nfor j in range(n - m + 2):\n for i in range(n - m + 2):\n if A[j][i: i + m] == B[0][:]:\n for k in range(m):\n...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s086849101', 's208740452', 's237263336', 's335879799', 's469999370', 's510637486', 's581997407', 's668418536', 's678479610', 's816728423', 's822278895', 's162005067']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3188.0, 3064.0, 3064.0, 3188.0, 3064.0]
[19.0, 19.0, 18.0, 19.0, 19.0, 19.0, 19.0, 20.0, 20.0, 19.0, 18.0, 18.0]
[550, 473, 550, 448, 538, 556, 610, 442, 476, 454, 546, 483]
p03804
u665415433
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["def solve(n, m, NUM):\n for i in range(len(m)):\n if n[NUM + i] is not m[i]:\n return -1\n return 1\n\n\nN, M = [int(i) for i in input().split()]\nn_pic = [input() for i in range(N)]\nm_pic = [input() for i in range(M)]\nnum = 0\nif M is 1:\n for n in n_pic:\n if -1 is not n.find(m_p...
['Runtime Error', 'Accepted']
['s076571041', 's659651102']
[3064.0, 3064.0]
[19.0, 19.0]
[661, 639]
p03804
u668253056
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import numpy as np\nimport sys\nN = int(input())\nM = int(input())\nA = []\nB = []\ndef change(n):\n if(n==\'#\'):\n return True;\n return False;\n\nfor i in range(N):\n temp = input()\n A.append(list(map(change, temp)))\nfor i in range(M):\n temp = input()\n B.append(list(map(change, temp)))\nA = np.array(A...
['Runtime Error', 'Accepted']
['s549996123', 's739075849']
[12756.0, 18596.0]
[299.0, 1093.0]
[451, 538]
p03804
u668503853
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N,M=map(int,input().split())\nA=[input() for _ in range(N)]\nB=[input() for _ in range(M)]\nans="No"\nfor i in range(N-M+1):\n for j in range(len(A[0])-len(B[0])+1):\n t = 0\n for k in range(len(B[0])):\n for l in range(M):\n if A[k+q][l+p] == B[q][p]:\n t += 1\n if t==len(B[0])*M:\n ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s518237596', 's522816441', 's988687865', 's201892790']
[3064.0, 3064.0, 3064.0, 3060.0]
[17.0, 17.0, 161.0, 20.0]
[342, 341, 343, 216]
p03804
u670180528
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["t,*a=open(0);n,m=map(int,t.split());r=range(n-m+1)\nprint('YNeos'[all(a[n:]!=[t[j:j+m]for t in a[i:i+m]]for i in r for j in r)::2])", 'x,*c=open(0);n,m=map(int,x.split());o=n-m+1;print("YNeos"[all(any(c[p//o+q//m][p%o+q%m]!=c[n+q//m][q%m]for q in range(m*m))for p in range(o*o))::2])']
['Wrong Answer', 'Accepted']
['s750393609', 's702709904']
[3060.0, 3060.0]
[21.0, 19.0]
[130, 148]
p03804
u672475305
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n,m = map(int,input().split())\nA = [list(input()) for _ in range(n)]\nB = [list(input()) for _ in range(m)]\nans = False\nfor i in range(n-m+1):\n for j in range(n-m+1):\n flg = True\n for e, k in enumerate(range(m)):\n if A[i+e][j:j+m+1] != B[k]:\n flg = False\n if ...
['Wrong Answer', 'Accepted']
['s975345927', 's704440911']
[3064.0, 3060.0]
[26.0, 26.0]
[383, 382]
p03804
u681917640
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\n\nA = [ input() for _ in range(N) ]\nB = [ input() for _ in range(M) ]\n\nfor i in range(N-M+1):\n for _ in range(A[i].count(B[0])):\n l = A[i].index(B[0], l)\n result = True\n for k in range(1, M):\n if B[k] != A[i+k][l:l+len(B[k])]:\n result = False\n b...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s194162671', 's806652412', 's834486627']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[387, 376, 395]
p03804
u682997551
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["import sys\n\nN, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nfor i in range(N - M + 1):\n if i >= M:\n break\n\n matched = True\n for j in range(N - M + 1):\n if A[i][j:j+M] == B[i][j:j+M]:\n continue\n else:\n ...
['Wrong Answer', 'Accepted']
['s351034887', 's888970410']
[3064.0, 3064.0]
[17.0, 18.0]
[405, 439]
p03804
u686036872
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\na = []\nb = []\nfor i in range(N):\n a.append(input())\nc = 0\nfor i in range(M):\n b.append(input())\nfor i in range(N-M+1):\n for j in range(N-M+1):\n for k in range(M):\n s1 = a[i][j:j+M] \n s2 = b[k]\n if s1 != s2:\n ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s097145246', 's428445024', 's657875249', 's141714994']
[3064.0, 2940.0, 3064.0, 3064.0]
[19.0, 17.0, 22.0, 23.0]
[361, 216, 346, 369]
p03804
u688375653
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import numpy as np\n\nN,M = map(int, input().split())\n\nA=[]\nfor i in range(N):\n A.append(list(input()))\n\nB=[]\nfor j in range(M):\n B.append(list(input()))\n\nA=np.asarray(A)\nB=np.asarray(B)\nflg=False\nif (A == B).all():\n flg=True\n \nfor x in range(N-M):\n for y in range(N-M):\n if (A[x:...
['Runtime Error', 'Accepted']
['s311809134', 's582002346']
[12500.0, 13044.0]
[152.0, 170.0]
[389, 473]
p03804
u690536347
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['def f():\n n,m=map(int,input().split())\n o=[input() for _ in range(n)]\n p=[input() for _ in range(m)]\n for i in range(n-m+1):\n for j in range(n-m+1):\n for k in range(i,n-m+1):\n for l in range(j,n-m+1):\n if p[k-i][l-j]!=o[k][l]:\n return False\n return True\n\nif f():\n ...
['Runtime Error', 'Accepted']
['s260405479', 's074200236']
[3064.0, 3064.0]
[17.0, 95.0]
[337, 375]
p03804
u696444274
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n = int(input())\n\na = list(map(int, input().split()))\ncheck = False\nfor i in range(n):\n if a[i] % 2 != 0:\n check = True\n break\ncount = 0\nwhile check == False:\n for i in range(n):\n a[i] /= 2\n if a[i] % 2 != 0:\n check = True\n break\n count += 1\np...
['Runtime Error', 'Accepted']
['s396294996', 's988623669']
[3060.0, 3064.0]
[17.0, 18.0]
[354, 543]
p03804
u697658632
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["import sys\nn, m = map(int, input().split())\na = []\nfor i in range(n):\n a.append(list(input()))\nb = []\nfor i in range(m):\n b.append(list(input()))\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n if a[i:i+m][j:j+m] == b:\n print('Yes')\n sys.exit()\nprint('No')\n", "import sys\nn, m = ...
['Wrong Answer', 'Accepted']
['s907156941', 's930872343']
[3060.0, 3064.0]
[18.0, 22.0]
[281, 294]
p03804
u702786238
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import numpy as np\n\nN, M = map(int, input().split())\n\nAs = np.array([["." for n in range(N)] for nn in range(N)])\nfor n in range(N):\n As[n,:] = np.array(list(input()))\n \nBs = np.array([["." for n in range(M)] for nn in range(M)])\nfor m in range(M):\n Bs[m,:] = np.array(list(input()))\n \nok = False\nfor ...
['Wrong Answer', 'Accepted']
['s292145240', 's458518964']
[14180.0, 13020.0]
[853.0, 177.0]
[496, 457]
p03804
u704563784
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nif n == m:\n if a == b:\n print('Yes')\n else:\n print('No')\n exit()\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n c = [l[j:j+m] for l in a[i:i+m]]\n print(c)\n ...
['Wrong Answer', 'Accepted']
['s510869223', 's167637057']
[3444.0, 3060.0]
[25.0, 20.0]
[370, 355]
p03804
u728483880
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int,input().split())\nA = [str(input()) for _ in range(N)]\nB = [str(input()) for _ in range(M)]\n \nres = "No"\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n for k in range(M):\n if(A[i+k][j:j+M] != B[k]):\n break\n if(k==M-1):\n res="yes"\n \nprint(res)', 'N, M ...
['Wrong Answer', 'Accepted']
['s908674472', 's774107191']
[3064.0, 3064.0]
[19.0, 19.0]
[295, 295]
p03804
u728498511
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['from sys import exit\nn, m = map(int, input().split())\ns1 = " ".join([input() for _ in range(n)])\ns2 = [input() for _ in range(m)]\nflag = True\n\ni = 0\nwhile i < m:\n try:\n if s1.count(s2[i]) == 0:\n print("No")\n exit()\n ind = s1.index(s2[i])\n s1 = list(s1)\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s125317860', 's823279128', 's086288132']
[3064.0, 3064.0, 3064.0]
[20.0, 20.0, 20.0]
[468, 476, 367]
p03804
u729133443
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["t,*a=open(0);n,m=map(int,t.split());r=range(n-m+1);print('YNeos'[all(a[n:]!=[t[j:j+m]for t in a[i:i+m]]for i in r for j in r)::2])", "t,*a=open(0);n,m=map(int,t.split());r=range(n-m+1);print('YNeos'[all(a[n:-1]!=[t[j:j+m]for t in a[i:i+m]]for i in r for j in r)::2])", "n,m,*a=open(0).read().split();n,m=int(n),int(m);...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s952359924', 's972821018', 's195237251']
[3060.0, 3060.0, 2940.0]
[20.0, 20.0, 20.0]
[130, 132, 142]
p03804
u732870425
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nfor y in range(N-M+1):\n for x in range(N-M+1):\n for k in range(M):\n if A[y+k][x:x+M] != B[y]:\n break\n else:\n print("Yes")\n exit()\nprint("No")',...
['Runtime Error', 'Accepted']
['s730365893', 's162691805']
[3060.0, 3064.0]
[17.0, 18.0]
[304, 320]
p03804
u734876600
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m = map(int,input().split())\na = []\nb = []\nfl = False\nfor i in range(n):\n a.append(list(input()))\nfor i in range(m):\n b.append(list(input()))\nfor i in range(n - m + 1):\n if b[0] in a[i]:\n tmp = a[i].find(b[0])\n if m == 1:\n fl = True\n for j in range(1,m):\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s047192937', 's295325465', 's761663300']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[489, 481, 437]
p03804
u735069283
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["import numpy as np\nN,M = map(int,input().split())\nA = np.array([list(input()) for _ in range(N)])\nB = np.array([list(input()) for _ in range(M)])\n\nhantei = False\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n if (A[i:M+i,j:M+j] == B).all:\n hantei = True\n print(A[i:M+i,j:M+j])\nprint('Yes' i...
['Wrong Answer', 'Accepted']
['s777552449', 's579989623']
[15104.0, 12432.0]
[846.0, 176.0]
[324, 315]
p03804
u736729525
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = [int(x) for x in input().split()]\n\nA = [None]*N\nfor i in range(N):\n A[i] = input()\n\nB = [None]*M\nfor i in range(M):\n B[i] = input()\n\ndef check():\n for x in range(N-M+1):\n for y in range(N-M+1):\n if all(all(A[r+x][c+y] == B[r][c] for c in range(M)) for r range(M))\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s195289111', 's312831739', 's870423773']
[2940.0, 3064.0, 3064.0]
[17.0, 18.0, 19.0]
[359, 379, 487]
p03804
u748311048
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n, m = map(int, input().split())\na = list()\nfor _ in range(n):\n a.append(str(input()))\nb = list()\nfor _ in range(m):\n b.append(str(input()))\n\nfor H in range(n if m == 1 else n-m+1):\n for W in range(n if m == 1 else n-m+1):\n for M in range(m):\n cnt = 0\n if a[H+M][0+W:m...
['Wrong Answer', 'Accepted']
['s898631226', 's213173314']
[3064.0, 3064.0]
[23.0, 23.0]
[418, 414]
p03804
u757030836
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m = map(int,input().split())\na = [[str(i) for i in input()]for _ in range(n)]\nb = [[str(i) for i in input()]for _ in range(m)]\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n c =0\n for k in range(m):\n for l in range(m):\n if a[i+k][j+l] == b[k][l]:\n c +=1\n print(c)\n ...
['Wrong Answer', 'Accepted']
['s450540513', 's741608373']
[4240.0, 3064.0]
[284.0, 151.0]
[411, 397]
p03804
u757117214
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N,M=map(int,input().split())\na=[]\nfor i in range(N):\n a.append([i for i in input()])\nb=[]\nfor i in range(M):\n b.append([i for i in input()]) \nflg=True\nfor iS in range(0,N-M+1):\n for ie in range(iS,M):\n flg=True \n for js in range(0,N-M+1):\n for je in range(js,M):\n print(a[ie][je],b[ie...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s281371328', 's294469653', 's867525858']
[3824.0, 3064.0, 3064.0]
[40.0, 17.0, 18.0]
[397, 537, 537]
p03804
u757274384
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m = map(int, input().split())\n\nA = [input() for i in range(n)]\nB = [intpu() for j in range(m)]\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if A[i][j:j+m] == B[0]:\n if all(A[i+k][j:j+m] == B[k] for k in range(1,M)):\n print("Yes")\n exit()\nprint("No")', 'n,m = map(int, input().sp...
['Runtime Error', 'Runtime Error', 'Accepted']
['s052707846', 's409589723', 's300232125']
[3064.0, 3064.0, 3060.0]
[18.0, 18.0, 18.0]
[278, 279, 279]
p03804
u759412327
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import numpy as np\n\nN,M = map(int,input().split())\nA = np.array([list(input()) for i in range(N)])\nB = np.array([list(input()) for i in range(M)])\nf = 0\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n if (A[i:i+M,j:j+M]==B).all():\n f = 1\n\nif f:\n print("Yes"):\nelse:\n print("No")', 'import nu...
['Runtime Error', 'Accepted']
['s750719488', 's785246803']
[2940.0, 27088.0]
[17.0, 122.0]
[290, 263]
p03804
u759482921
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import sys\n\ninput_num = input().split()\nN = int(input_num[0])\nM = int(input_num[1])\n\nAB = [input() for i in range(0, N + M)]\nA = AB[0: N]\nB = AB[N:]\n\ndiff = N - M\nmatches = []\nfor i in range(0, diff+1):\n l = 0\n while N - l > diff:\n index = A[i][l:].find(B[0])\n if index != -1 and i ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s605086818', 's949129795', 's671320294']
[3064.0, 3064.0, 3064.0]
[19.0, 17.0, 18.0]
[657, 449, 641]
p03804
u761320129
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N,M = map(int,input().split())\nA = [input() for i in range(N)]\nB = [input() for i in range(M)]\n\ndef match(ofs_x, ofs_y):\n for ar,br in zip(A[ofs_y:], B):\n if ar[ofs_x:] != br:\n return False\n return True\n\nfor y in range(N-M+1):\n for x in range(N-M+1):\n if match(x,y):\n ...
['Wrong Answer', 'Accepted']
['s263500234', 's813281005']
[3064.0, 3064.0]
[19.0, 18.0]
[356, 367]
p03804
u762420987
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\nAlist = [list(input()) for _ in range(N)]\nBlist = [list(input()) for _ in range(M)]\nfrom sys import exit\nfor i in range(N - M):\n for j in range(N - M):\n if Alist[i:i + M][j:j + M] == Blist:\n print("Yes")\n exit()\nprint("No")\n', 'N, M = map(int,...
['Wrong Answer', 'Accepted']
['s804145904', 's263906365']
[3060.0, 3064.0]
[18.0, 80.0]
[289, 428]
p03804
u766407523
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N, M = map(int, input().split())\nA, B = [], []\nfor i in range(N):\n A.append(input())\nfor i in range(M):\n B.append(input())\nans = 'No'\nend = 0\nfor i in range(N-M+1):\n for j in range(N-M+1):\n temp = []\n for k in range(1, M):\n temp.append(A[i+k][j:])\n if temp == B:\n...
['Wrong Answer', 'Accepted']
['s329482483', 's527097522']
[3064.0, 3064.0]
[22.0, 23.0]
[407, 407]
p03804
u766646838
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N,M = map(int,input().split())\na = []\nc = []\nfor i in range(N):\n b = list(input())\n a+=b\nfor i in range(M):\n b = list(input())\n c+=b\nf = False\nfor i in range(N*N):\n if f == True:\n break\n count=0\n if N*N-(i)<M*M:\n break\n flag = True\n if c[0] == a[i]:\n if N-((i+1)%N)>M:\n co...
['Wrong Answer', 'Accepted']
['s325616967', 's078203819']
[9176.0, 9296.0]
[23.0, 30.0]
[735, 818]
p03804
u777923818
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['# -*- coding: utf-8 -*-\nA = []\nB = []\nN, M = list(map(int, input().split()))\n\nfor n in range(N):\n A.append(input())\nfor n in range(M):\n B.append(input())\n\ndef match(r, c):\n for i, row in enumerate(range(r, r+M)):\n if A[row][c:c+M] != B[i]:\n return False\n return True\n\nok =...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s774742212', 's998427160', 's511187640']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0]
[495, 620, 620]
p03804
u778814286
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N, M = map(int,input().split())\n\ntg = [list(map(int,input().split())) for _ in range(N)]\n\n\ntmpl = [list(map(int,input().split())) for _ in range(M)]\n\n\nfor i in range(0,N-M+1):\n for j in range(0,N-M+1):\n if tmpl[0] == tg[i][j:j+M]:\n for k in range(i+1,i+M):\n if tmpl[k] != tg[i+k][j:j+M]: br...
['Runtime Error', 'Accepted']
['s994638011', 's260751137']
[3064.0, 3064.0]
[17.0, 18.0]
[468, 472]
p03804
u779455925
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['4 1\n....\n....\n....\n....\n#\n', 'N,M=map(int,input().split())\nA=[input() for i in range(N)]\nB=[input() for i in range(M)]\n\nfor X in range(N-M+1):\n for Y in range(N-M+1):\n flag=1\n for x in range(M):\n for y in range(M):\n if B[x][y]!=A[x+X][y+Y]:\n ...
['Runtime Error', 'Accepted']
['s850708566', 's957535220']
[2940.0, 3060.0]
[18.0, 18.0]
[26, 427]
p03804
u787562674
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\n\n\n\nA = [input() for j in range(N)]\nB = [input() for j in range(M)]\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n for k in range(M):\n if A[i+k][j:j+k] != B[k]:\n break\n else:\n print("Yes")\n exit()\nelse:\n...
['Wrong Answer', 'Accepted']
['s343325885', 's441926970']
[3064.0, 3060.0]
[18.0, 18.0]
[429, 429]
p03804
u790710233
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n, m = map(int, input().split())\n\nclass Image:\n def __init__(self, n):\n self.matrix = [list(input()) for _ in range(n)]\n self.n = n\n\n def isIncluded(self, a):\n for i in range(a.n):\n for j in range(a.n):\n if a.matrix[i][j] == self.matrix[0][0]:\n ...
['Wrong Answer', 'Accepted']
['s607972061', 's117384538']
[4084.0, 3064.0]
[37.0, 22.0]
[703, 504]
p03804
u798260206
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["A=[input() for _ in range(N)]\nB=[input() for _ in range(M)]\nans='No'\n \nfor i in range(N-M+1):\n for j in range(N-M+1):\n cnt=0\n if A[i][j:j+M] ==B[0]:\n for k in range(1,M):\n if A[i+k][j:j+M] == B[k]:\n cnt+=1\n if cnt==M-1:\n ...
['Runtime Error', 'Accepted']
['s493082000', 's988583140']
[3064.0, 3064.0]
[17.0, 18.0]
[346, 375]
p03804
u798818115
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['# coding: utf-8\n# Your code here!\nN,M=map(int,input().split())\n\nAN=[]\nfor _ in range(N):\n AN.append(list(input()))\n \nprint(AN)\n\nAM=[]\nfor _ in range(M):\n AM.append(list(input()))\n\nprint(AM)\n', '# coding: utf-8\n# Your code here!\nN,M=map(int,input().split())\n\nAN=[]\nfor _ in range(N):\n A...
['Wrong Answer', 'Accepted']
['s032213968', 's410740735']
[3060.0, 3064.0]
[18.0, 26.0]
[199, 507]
p03804
u803647747
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\nA_list = []\nB_list = []\n\nfor _ in range(N):\n A_list.append(list(input()))\nfor _ in range(M):\n B_list.append(list(input()))\n \nmatch_list =[]\nfor i in range(N-M+1):\n for j in range(N-M+1):\n if B_list[0] == A_list[i][j:(j+M)]:\n match_list.append([...
['Runtime Error', 'Accepted']
['s144589650', 's845623792']
[3064.0, 3060.0]
[18.0, 23.0]
[658, 426]
p03804
u814986259
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N,M=map(int,input.split())\nA=[""]*N\nB=[""]*M\nfor i in range(N):\n A[i]=input()\nfor i in range(M):\n B[i]=input()\nflag=False\nfor i in range(N-M)\n if B[0] in A[i]:\n for j in range(1,M):\n if B[j] in A[i+j]:\n if j = M - 1:\n print("Yes")\n exit(0)\n else:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s023063773', 's061072848', 's621025177']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 23.0]
[377, 370, 293]
p03804
u820357030
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = (int(i) for i in input().split())\na = []\nb = []\nfor i in range(N):\n data = list(input())\n a.append(data)\nfor i in range(M):\n data = list(input())\n b.append(data)\n\nprint(a[0])\n \nL = N-M\n\ndef check(i,j):\n ans=True\n for line in range(L+1):\n for row in range(L+1):\n ...
['Wrong Answer', 'Accepted']
['s836623719', 's399170606']
[3064.0, 3064.0]
[23.0, 25.0]
[491, 809]
p03804
u841623074
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N,M=map(int,input().split())\nA=[input()for i in range(N)]\nB=[input()for i in range(M)]\nb=\'\'\na=\'no\'\nfor i in range(M):\n b+=B[i]\nfor i in range(N-M+2):\n if B[0]in A[0] and B[1] in A[1]:\n for j in range(N-M+2):\n a=\'\'\n for k in range(M):\n a+=A[i+k][j:j+M...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s071990011', 's577030329', 's689738827', 's522810004']
[3064.0, 3064.0, 3064.0, 3064.0]
[20.0, 18.0, 21.0, 19.0]
[362, 399, 364, 372]
p03804
u842388336
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import numpy as np\n\nn,m=map(int,input().split())\na=np.zeros([n,n])\nb=np.zeros([m,m])\nmap_ = {".":1,"#":-1}\n\nfor i in range(n):\n temp = list(input())\n temp = [map_[c] for c in temp]\n a[i,:] = np.array(temp)\n \nfor i in range(m):\n temp = list(input())\n temp = [map_[c] for c in temp]\n b[i,:] = np.ar...
['Wrong Answer', 'Accepted']
['s497398109', 's835409319']
[12756.0, 12516.0]
[2110.0, 202.0]
[612, 577]
p03804
u845937249
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["import sys\nif sys.platform == 'ios':\n\tsys.stdin = open('input_file.txt')\n\t\n\nn,m = map(int,input().split())\n\na = [str(input()) for i in range(n)]\nb = [str(input()) for i in range(m)]\n\ns = [ [0]*m for i in range(m) ]\n\nans = 0\n\nfor i in range(n-m+1):\n\tfor j in range(n-m+1):\n\t\tfor k in range(m):\n\t\...
['Wrong Answer', 'Accepted']
['s515712568', 's511142054']
[3064.0, 3064.0]
[23.0, 23.0]
[435, 436]
p03804
u853900545
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n,m = map(int,input().split())\n\na = []\nb = []\n\nfor i in range(n):\n a.append(input())\nfor i in range(m):\n b.append(input())\n\ni = 0\nk = 0\nans = 'No'\nfor k in range(n-m):\n while i + m <= n:\n if a[k][i:i+m:] == b[k]:\n for j in range(m):\n if all()\n ans...
['Runtime Error', 'Accepted']
['s424809420', 's315773377']
[2940.0, 3064.0]
[18.0, 19.0]
[348, 556]
p03804
u856169020
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N, M = map(int, input().split())\nn = []\nm = []\nfor i in range(N):\n s = str(input())\n row = []\n for j in range(N):\n if s[i] == "#":\n row.append(1)\n else:\n row.append(0)\n n.append(row)\nfor i in range(M):\n s = str(input())\n row = []\n for j in range(M):\n if s[i] == "#":\n ro...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s532439885', 's644709083', 's533760069']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 19.0]
[704, 714, 714]
p03804
u861141787
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n, m = map(int, input().split())\na = [list(input()) for _ in range(n)]\nb = [list(input()) for _ in range(m)]\n\nsi, sj = 0, 0\nc = 0\nwhile si < n - m:\n ni, nj = si, sj\n rest = m ** 2\n for i in range(m):\n nj = sj\n for j in range(m):\n print(ni, nj, i, j)\n if a[ni][...
['Wrong Answer', 'Accepted']
['s209241282', 's812178727']
[4060.0, 3064.0]
[96.0, 34.0]
[549, 554]
p03804
u863841238
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m = map(int,input().split())\na=[]\nfor _ in [0]*n:\n a += [list(input())]\nb=[]\nfor _ in [0]*m:\n b += [list(input())]\n\nprint(a,b)\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if [k[j:m+1] for k in a[i:m+1]] == b:\n print("Yes")\n exit()\nprint("No")', 'n,m = map(int,input().split())\na=...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s505450295', 's955037671', 's426362717']
[3064.0, 3060.0, 3064.0]
[20.0, 19.0, 22.0]
[265, 262, 287]
p03804
u875600867
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import re\nN,M=map(int, input().split())\n\nA=[]\nB=[]\n\nfor n in range(N):\n A.append(input())\n\nfor m in range(M):\n B.append(input())\n \n\nfor m in range(M):\n for n in range(N):\n \n \n span =[m.span() for m in re.finditer(B[m], A[n])]\n print(span)\n if span=...
['Wrong Answer', 'Accepted']
['s793751644', 's060175288']
[3700.0, 3188.0]
[34.0, 19.0]
[876, 880]
p03804
u878372089
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m = map(int,input().strip().split())\nns,ms = [],[]\nfor _ in range(n):\n ns.append(input().strip())\nfor _ in range(m):\n ms.append(input().strip())\n\nallFlag = 0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if ns[i][j:j+m] == ms[0]:\n Flag = 1\n for k in range(m):\n ...
['Wrong Answer', 'Accepted']
['s074879283', 's808291014']
[3064.0, 3064.0]
[18.0, 18.0]
[482, 498]
p03804
u883232818
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N, M = map(int, input().split())\n\nA = []\nB = []\n\nfor i in range(N):\n A.append(list(input()))\n\nfor i in range(M):\n B.append(list(input()))\n\nans = True\n\nfor i in range(M):\n if A[i] not in B[i]:\n ans = False\n break\n\nprint('Yes' if ans == True else 'No')", "\nN, M = map(int, input...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s409075570', 's416021147', 's790112829']
[3064.0, 3064.0, 3064.0]
[19.0, 17.0, 17.0]
[273, 274, 261]
p03804
u884323674
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import numpy as np\n\nN, M = map(int, input().split())\nA = np.array([[i for i in input()] for j in range(N)])\nB = np.array([[i for i in input()] for j in range(M)])\n\nfound = False\nfor i in range(N-M+1):\n for j in range(N-M+1):\n P = A[i:i+M,j:j+M]\n if (P == B).all():\n print("Yes")\...
['Wrong Answer', 'Accepted']
['s759614863', 's286497522']
[12416.0, 12416.0]
[174.0, 166.0]
[379, 399]
p03804
u886655280
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["\n\nN, M = map(int, input().split())\nA_list = []\nfor n in range(N):\n a = input()\n A_list.append(a)\n\nB_list = []\nfor m in range(M):\n b = input()\n B_list.append(b)\n\ndiff = N - m\n\nfor i in range(diff):\n is_same = False\n for j in range(diff):\n for b in range(M):\n if B_...
['Wrong Answer', 'Accepted']
['s792227559', 's339053076']
[3064.0, 3064.0]
[17.0, 18.0]
[694, 661]
p03804
u888337853
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import sys\n\n# import re\nimport math\nimport collections\n\nimport bisect\nimport itertools\nimport fractions\n# import functools\nimport copy\nimport heapq\nimport decimal\n# import statistics\nimport queue\nimport numpy as np\n\nsys.setrecursionlimit(10000001)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n\nni = lambda: in...
['Wrong Answer', 'Accepted']
['s416731770', 's234877488']
[22448.0, 13580.0]
[285.0, 174.0]
[857, 855]
p03804
u888512581
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N, M = map(int, input().split())\nA = list()\nB = list()\nans = 'No'\nfor i in range(N):\n A.append(input())\n\nfor i in range(M):\n B.append(input())\n\nfor i in range(N - M +1):\n for j in range(N - M +1):\n count = 0\n for row in range(M):\n for col in range(M):\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s121640274', 's203222477', 's338871291', 's562213377', 's090478306']
[3444.0, 3064.0, 3064.0, 3064.0, 3064.0]
[176.0, 168.0, 170.0, 166.0, 148.0]
[459, 442, 433, 435, 406]
p03804
u896741788
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m=map(int,input().split())\nl=[input() for i in range(n)]\nml=[input() for i in range(m)]\nfor i in range(n-m+1):\n for j in range(n-m+1):\n for h in range(m):\n if ml[h]!=l[i][j:j+m]:break\n else:print("Yes");exit()\nprint("No")', 'n,m=map(int,input().split())\nl=[input() for i in range(n)]\nml=[input(...
['Wrong Answer', 'Accepted']
['s643836369', 's881671154']
[3064.0, 3064.0]
[19.0, 18.0]
[235, 237]
p03804
u905582793
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N,M = map(int,input())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(N)]\nans = 0\nfor i in range(N-M+1):\n for j in range(N-M+1):\n for k in range(i,i+M):\n for l in range(j,j+M):\n if A[k][l] != B[k][l]:\n break\n if A[k][l] == B[k][l] and k == i+M-1 and l == j+M-1:\n...
['Runtime Error', 'Accepted']
['s502446534', 's367966823']
[3064.0, 3064.0]
[17.0, 21.0]
[407, 430]
p03804
u911575040
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n,m=map(int,input().split())\na=[input() for _ in range(n)]\nb=[input() for _ in range(m)]\nr=any(a[i:i+m][j:j+m]==b for i in range(n-m+1) for j in range(n-m+1))\nprint('Yes' if r else 'No')", "n,m=map(int,input().split())\nA=[input() for _ in range(n)]\nB=[input() for _ in range(m)]\n \nans='No'\n \nfor i in range(n...
['Wrong Answer', 'Accepted']
['s556912080', 's173989641']
[3060.0, 3064.0]
[18.0, 21.0]
[186, 254]
p03804
u914797917
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["N,M=map(int, input().split())\nA = [input() for i in range(N)]\nB = [input() for i in range(M)]\n\nflag=0\nfor i in range(N-M+1):\n for j in range(N-M+1):\n for k in range(M):\n if A[i+k][j:j+M]!=B[k]:\n break\n \n else:\n flag=1\n print('!')\nprint('Yes' if flag==1 else 'No')", "N,M...
['Wrong Answer', 'Accepted']
['s673861230', 's092740614']
[3064.0, 3188.0]
[19.0, 19.0]
[337, 320]
p03804
u927534107
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m=map(int,input().split())\na=[str(input()) for _ in range(n)]\nb=[str(input()) for _ in range(m)]\nfor i in range(n-m+1):\n for j in range(n-m+1):\n tmp=[]\n for k in range(m):\n tmp.append(a[j+k][i:i+m])\n if tmp==b:\n print("YES")\n exit()\nprint("NO")', '...
['Wrong Answer', 'Accepted']
['s934411472', 's798719686']
[3064.0, 3060.0]
[22.0, 24.0]
[303, 303]
p03804
u929569377
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['\n#include <string>\nusing namespace std;\n\nint main()\n{\n\tint N, M;\n\tcin >> N >> M;\n\t\n\tstring A[55];\n\tstring B[55];\n\t\n\tfor(int i = 0; i < N; i++){\n\t\tcin >> A[i];\n\t}\n\tfor(int j = 0; j < M; j++){\n\t\tcin >> B[j];\n\t}\n\t\n\tbool judge = false;\n\t\n\tfor(int i = 0; i < N - M + 1; i++){\n\t\tfor...
['Runtime Error', 'Accepted']
['s871058625', 's154868926']
[2940.0, 3064.0]
[17.0, 19.0]
[533, 349]
p03804
u940342887
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['print(A)\n\ndef is_match(a, b):\n return (a==b).all()\nflag = False\nfor i in range(N):\n for j in range(N):\n x_left = i\n x_right = i + M\n y_up = j\n y_under = j + M\n if x_right >= N or y_under >= N:\n continue\n if is_match(B, A[x_left:x_right, y_up:y_un...
['Runtime Error', 'Runtime Error', 'Accepted']
['s064586091', 's341772206', 's354410271']
[3064.0, 3064.0, 21656.0]
[17.0, 18.0, 298.0]
[412, 629, 646]
p03804
u945418216
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n,m = map(int, input().split())\naa = [input() for _ in range(n)]\nbb = [input() for _ in range(m)]\n\nans = 0\nfor a in aa:\n for b in bb:\n if a.count(b)>0:\n ans +=1\n break\n# print(ans)\nprint('Yes' if ans==len(bb) else 'No')", "n,m = map(int, input().split())\naa = [input() for _...
['Wrong Answer', 'Accepted']
['s602958807', 's787132183']
[3060.0, 3060.0]
[20.0, 33.0]
[251, 320]
p03804
u947193699
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['import numpy as np\nn,m =map(int,input().split())\n\n\nA = np.array([list(input()) for i in range(n)])\nB = np.array([list(input()) for i in range(m)])\nP = np.zeros(B.shape,str)\na = 0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n P= A[i:i+m,j:j+m]\n # print(P)\n if np.all(B==P):\n prin...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s202842495', 's211198674', 's883019595']
[22196.0, 13668.0, 12404.0]
[342.0, 865.0, 177.0]
[369, 370, 352]
p03804
u948524308
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['N,M = map(int,input().split())\n\nA = []\nB = []\n\nfor i in range(N):\n A.append(input())\nfor j in range(M):\n B.append(input())\n\n\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n l = 0\n for l in range(M):\n if A[i].find(B[l],j) != j:\n break \n ...
['Wrong Answer', 'Accepted']
['s797421760', 's818364334']
[3064.0, 9204.0]
[19.0, 26.0]
[396, 392]
p03804
u957957759
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n,m=map(int,input().split())\ns=[input() for i in range(n)]\nt=[input() for i in range(m)]\n\nz=0\nc=0\n\nfor i in range(n-m+1):\n for j in range(n-m+1): \n \n for x in range(m):\n for y in range(m):\n if s[i+x][j+y]==t[x][y]:\n z+=1\n if z==m**2:\n...
['Wrong Answer', 'Accepted']
['s830865022', 's838808687']
[3064.0, 3064.0]
[163.0, 161.0]
[396, 396]
p03804
u958506960
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\ns = 0\ncnt = 0\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n for x in range(m):\n for y in range(m):\n if a[i+x][j+y] == b[x][y]:\n s += 1\n if s...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s088108104', 's693888393', 's598168184']
[3064.0, 3064.0, 3064.0]
[179.0, 172.0, 166.0]
[431, 433, 417]
p03804
u961674365
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m=map(int,input().split())\na=[input() for i in range(n)]\nb=[input() for i in range(m)]\n#print(a,b)\nans=0\ncnt=0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n cnt=0\n for k in range(m):\n if b[k]!=a[i+k][j:j+m]:\n break\n cnt+=1\n \n if cnt==m:\n ans+=1\n if ans>0:\n ...
['Wrong Answer', 'Accepted']
['s398003947', 's287782507']
[3064.0, 3064.0]
[18.0, 19.0]
[425, 421]
p03804
u970809473
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n,m=map(int,input().split())\ns1=[input() for _ in range(n)]\ns2=[input() for _ in range(m)]\nans='No'\nfor i in range(n-m+1):\n for j in range(n-m+1):\n flg=0\n print(i,j)\n for k in range(m):\n if s1[j+k][i:i+m]==s2[k]:\n flg+=1\n if flg==m:\n ans='Yes'\nprint(ans)", "n,m=map(int,input...
['Wrong Answer', 'Accepted']
['s305062663', 's543137255']
[9348.0, 9188.0]
[28.0, 31.0]
[284, 269]
p03804
u977389981
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
["n, m = map(int, input().split())\nA = [list(input()) for i in range(n)]\nB = [list(input()) for i in range(m)]\n\nfor i in range(n - m + 1):\n flag = 0\n for j in range(m):\n if flag:\n break\n else:\n for k in range(m):\n if A[i + j][k] != B[j][k]:\n ...
['Wrong Answer', 'Accepted']
['s152523537', 's370579465']
[3064.0, 3064.0]
[18.0, 23.0]
[480, 317]
p03804
u980783809
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n, m = map(int, input().split())\nnl=[]\nml=[]\nfor i in range(n):\n nl.append(input())\nfor i in range(m):\n ml.append(input())\n\ncnt=0\nYes=False\nfor i in nl:\n if(ml[0] in i):\n print(str(ml[0])+" in "+ str(i))\n idx = i.find(ml[0])\n cnt2=cnt+1\n for j in range(1,m):\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s287070020', 's716911083', 's275746305']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 18.0]
[594, 604, 611]
p03804
u989345508
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n,m=input().split()\nn,m=int(n),int(m)\na=[]\nfor i in range(n):\n a.append(input())\n\nb=[]\nfor i in range(m):\n b.append(input())\n\n\nfor i in range(n-m):\n for j in range(n-m):\n c=0\n for k in range(m):\n if b[k] == a[i+k][j:j+m]:\n c+=1\n else:\n ...
['Wrong Answer', 'Accepted']
['s314371480', 's852288478']
[3064.0, 3064.0]
[18.0, 18.0]
[404, 459]
p03804
u991567869
2,000
262,144
You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1. Also, the given images are binary images, and the color of each pixel is either white o...
['n, m = map(int, input().split())\n\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nans = "No"\n\nfor i in range(n - m + 1): \n for j in range(n - m + 1): \n for k in range(m): \n print(b[k], a[i + k][j:j + m])\n if b[k] != a[i + k][j:j + m]:\n break\n ...
['Wrong Answer', 'Accepted']
['s487163383', 's186932495']
[3444.0, 3064.0]
[23.0, 18.0]
[453, 410]
p03805
u001024152
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['import sys\nsys.setrecursionlimit(100000)\nN,M = map(int, input().split())\npath = []\nfor _ in range(M):\n ai, bi = map(int, input().split())\n path.append((ai, bi))\n path.append((bi, ai))\n \nans = 0\ndef dfs(v, visited):\n # v: now here\n # visited: set\n global ans\n print(visited)\n i...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s757776654', 's951515059', 's950752553']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 23.0]
[721, 723, 650]
p03805
u013408661
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['import sys\nn,m=map(int,input().split())\nnumber=[[int(i) for i in l.split()] for l in sys.stdin]\nvisit=[0]*(n+1)\nvisit[1]=1\nnode=[[] for i in range(n+1)]\nfor i in number:\n node[i[0]].append(i[1])\n node[i[1]].appedn(i[0])\nans=0\ndef dfs(x):\n global ans\n if visit.count(1)==n:\n ans+=1\n return 0\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s136257552', 's199904692', 's593578534', 's693316443', 's376827668']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0, 19.0, 26.0]
[416, 743, 406, 405, 416]
p03805
u013956357
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['[n,m] = [int(x) for x in input().split()]\ndata = [[int(x) for x in input().split()] for _ in range(m)]\n\ntotal = 0\nfor x in itertools.permutations(range(2,n+1)):\n \n route = [1,]+list(x)\n \n for x in range(len(route)-1):\n flg = False\n \n for y in data:\n if {route[x]...
['Runtime Error', 'Accepted']
['s825364282', 's646128267']
[3064.0, 3064.0]
[17.0, 317.0]
[511, 529]
p03805
u017050982
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['def kaijyo(n):\n ans = 1\n for i in range(n):\n ans *= i + 1\n return ans\n\nN,M = map(int,input().rstrip().split(" "))\nhen = []\nans = 0\nfor i in range(M):\n a,b = map(int,input().rstrip().split(" "))\n hen.append([a,b])\nprint(hen)\nfor i in range(kaijyo(N-1)):\n lis = [i+2 for i in range...
['Wrong Answer', 'Accepted']
['s671430771', 's739306321']
[9200.0, 9260.0]
[95.0, 91.0]
[739, 723]
p03805
u035210736
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['n, m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(m)]\n\nc = [i for i in range(2, n + 1)]\nb = []\nfor x in itertools.permutations(c):\n b.append([1] + list(x))\n \ncnt = 0\nfor x in b:\n exist = True\n for i in range(n-1):\n if not sorted(x[i:i+2]) in a:\n exist = Fals...
['Runtime Error', 'Accepted']
['s845322609', 's036208921']
[9152.0, 53328.0]
[26.0, 363.0]
[355, 242]
p03805
u047178225
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['nmax = 8\ngraph = [[0]*nmax for i in range(nmax)]\nvisited = [0] * nmax\n\ndef dfs(v, N, visitied):\n all_visited = True\n for i in range(N):\n if visitied[i] == 0:\n all_visited = False\n if all_visited:\n return 1\n \n ret = 0\n for i in range(N):\n if graph[v][i] == 0:\n continue\n ...
['Runtime Error', 'Accepted']
['s987955988', 's437213396']
[3060.0, 3064.0]
[17.0, 38.0]
[615, 668]
p03805
u051842502
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['N,M=map(int,input().split())\noriginal_paths={}\npaths={}\nfor n in range(1,N+1):\n original_paths[n]=[]\nfor m in range(1,M+1):\n s,e=map(int,input().split())\n original_paths[s].append(e)\n original_paths[e].append(s)\n \nvisited=[1]\ncurrent_point=1\nanswer=0\nimport copy\npaths=copy.deepcopy(origin...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s720225274', 's772925951', 's712939905']
[19060.0, 18676.0, 3064.0]
[795.0, 815.0, 93.0]
[2099, 2105, 2071]
p03805
u057109575
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['N, M = map(int, input().split())\nedges = [list(map(int, input().split())) for _ in range(M)]\n\ngraph = [[None] * N for _ in range(N)]\nfor x, y in edges:\n graph[x - 1][y - 1] = True\n graph[y - 1][x - 1] = True\n \ndef dfs(v):\n global ans\n visited[v] = True\n \n if all(visited):\n ans...
['Wrong Answer', 'Accepted']
['s828608525', 's112983310']
[3064.0, 3064.0]
[17.0, 27.0]
[576, 527]
p03805
u059210959
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['# encoding:utf-8\nimport copy\nimport random\nimport bisect \nimport fractions \nimport math\nimport sys\n\nmod = 10**9+7\nsys.setrecursionlimit(mod) \n\nN,M = map(int,input().split())\ntree = [[] for i in range(N)]\nfor i in range(M):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n tree[a] += [b]\n ...
['Wrong Answer', 'Accepted']
['s612309546', 's032035541']
[5700.0, 5460.0]
[42.0, 139.0]
[773, 855]
p03805
u063052907
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['ans = 0\ndef dfs(v, visitedNode, graph):\n visitedNode[v] = 1 \n if all(visitedNode):\n global ans\n ans += 1\n return\n for node in graph[v]: \n if visitedNode[node]:\n \n continue\n else:\n \n dfs(node, visitedNode, graph)\n\...
['Wrong Answer', 'Accepted']
['s241436932', 's441327316']
[3316.0, 3064.0]
[19.0, 25.0]
[825, 704]
p03805
u075595666
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['import itertools\n\nn,m = [int(i) for i in input().split()]\n\nchk = [[0]*8 for i in range(8)]\nfor i in range(m):\n a,b = [int(i) for i in input().split()]\n chk[a-1][b-1] = 1\n chk[b-1][a-1] = 1\n\nans = 0\n\nfor i in itertools.permutations(range(n),n):\n if i[0] == 1:\n for j in range(n):\n if j == n-1...
['Wrong Answer', 'Accepted']
['s696917164', 's450693857']
[3064.0, 3064.0]
[34.0, 34.0]
[382, 393]
p03805
u077898957
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['import itertools\nN,M=map(int,input().split())\nedges={tuple(sorted(map(int,input().split()))) for i in range(M)}\nans=0\nfor i in itertools.permutations(range(2,N+1),N-1):\n l=[1]+list(i)\n ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1\nprint(0)', 'import itertools\nN,M=map(int,inpu...
['Wrong Answer', 'Accepted']
['s366430305', 's656409151']
[3060.0, 3064.0]
[44.0, 44.0]
[273, 275]
p03805
u085910248
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['n, m = map(int, input().split())\ncolor = [0] * n \npath = [[] for _ in range(m)]\n\nfor i in range(m):\n a, b = map(int, input().split())\n path[a-1].append(b)\n path[b-1].append(a)\n\nprint(path)\ndef rec(c, p, crnt, d):\n d += 1\n if c[crnt] == 1:\n if len(list(filter(lambda x: x == 1, c))) =...
['Runtime Error', 'Accepted']
['s038320816', 's909355246']
[3064.0, 3064.0]
[17.0, 46.0]
[575, 359]
p03805
u089032001
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['import itertools\n\nn, m = map(int, input().split())\npath = [set()] * n\nfor _ in range(m):\n a, b = map(int, input().split())\n path[a-1].add(b-1)\n path[b-1].add(a-1)\nexample = [i for i in range(n)]\n\nans = 0\nfor ex in itertools.permutations(example):\n for a, b in zip(ex, ex[1:]):\n if b not in path[a]:...
['Wrong Answer', 'Accepted']
['s572137957', 's511656028']
[3064.0, 3064.0]
[81.0, 27.0]
[349, 460]
p03805
u094999522
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['import itertools\n(n,_),*a= [[*map(int,i.split())] for i in open(0)]\np=itertools.permutations(range(1,n+1),n)\nc = 0\nfor i in p:\n for j in range(n-1):\n if sorted([i[j],i[j+1]]) not in a:\n break\n else:\n c+=1\nprint(c)', 'import itertools\n(n,_),*a= [[*map(int,i.split())] for i in ...
['Wrong Answer', 'Accepted']
['s180448815', 's352232323']
[9068.0, 9504.0]
[229.0, 56.0]
[244, 271]
p03805
u096616343
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['import itertools\nN,M = map(int,input().split())\nr = []\nfor _ in range(M):\n add = list(map(int,input().split()))\n r.append(add)\n r.append(add[::-1])\nA = [i for i in range(2,N + 1)]\nA = list(itertools.permutations(A,N - 1))\nans = 0\nfor check in A:\n q = 0\n p = [1] + list(check)\n for c in r...
['Wrong Answer', 'Accepted']
['s238921217', 's893020814']
[4340.0, 3572.0]
[69.0, 64.0]
[424, 411]
p03805
u098572984
2,000
262,144
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ...
['_N,_M=input().split()\nN = int(_N)\nM = int(_M)\nl = []\nfor i in range(0,M):\n _p, _q = input().split\n l.append((int(_p),int(_q)))\n_A,_B=zip(l)\n\nA=_A+_B\nB=_B+_A\n\n\ndef gen_get_to(_fr):\n global A\n global B\n global nodes\n global step\n for itr in range(0,len(A)):\n if A[itr]==_fr...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s071346904', 's242354167', 's916056972', 's974104621', 's687333354']
[3444.0, 3064.0, 3064.0, 3444.0, 3444.0]
[21.0, 17.0, 18.0, 20.0, 103.0]
[1393, 1330, 1292, 1395, 1396]