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 | u033606236 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = map(int,input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nprint(a,b)\nflag = 0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if a[i][j:j+m] == b[0] and a[i+1][j:j+m] == b[1]:\n flag = 1\nprint("Yes" if flag == 1 else "No")', '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 flag = [False for _ in range(m)]\n for j in range(m):\n if a[y+j][x:m+x] == b[j]:\n flag[j] = True\n if all(flag):\n print("Yes")\n exit()\nprint("No")'] | ['Runtime Error', 'Accepted'] | ['s435434839', 's867040054'] | [3064.0, 3064.0] | [18.0, 24.0] | [280, 361] |
p03804 | u037430802 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['\nimport sys\nn,m = map(int, input().split())\na = []\nb = []\nfor i in range(n):\n a.append(list(input()))\n \nfor i in range(m):\n b.append(list(input()))\n\n\n#\nprint(a)\nprint(b)\n \n \nfor i in range(n-m+1):\n for j in range(n-m+1):\n flag = True\n for x in range(m):\n for y in range(m):\n if b[x][y] != a[i+x][j+y]:\n flag = False\n break\n if not flag:\n break\n else:\n print("Yes")\n sys.exit()\n \n \n\nprint("No")\n ', '\nimport sys\nn,m = map(int, input().split())\na = []\nb = []\nfor i in range(n):\n a.append(list(input()))\n \nfor i in range(m):\n b.append(list(input()))\n\n\n#\n\n \n \nfor i in range(n-m+1):\n for j in range(n-m+1):\n flag = True\n for x in range(m):\n for y in range(m):\n if b[x][y] != a[i+x][j+y]:\n flag = False\n break\n if not flag:\n break\n else:\n print("Yes")\n sys.exit()\n \n \n\nprint("No")\n '] | ['Wrong Answer', 'Accepted'] | ['s182736875', 's768524603'] | [3064.0, 3064.0] | [18.0, 18.0] | [479, 458] |
p03804 | u044964932 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['import numpy as np\n\n\ndef main():\n n, m = map(int, input().split())\n As = [list(input()) for _ in range(n)]\n Bs = [list(input()) for _ in range(m)]\n\n As_arr = np.array(As)\n Bs_arr = np.array(Bs)\n ans = 0\n for i in range(n-m+1):\n for j in range(n-m+1):\n xs, xe = i, i+m\n ys, ye = j, j+m\n if np.all(As_arr[ys:ye, xs:xe] == Bs_arr):\n ans += 1\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'import numpy as np\n\n\ndef main():\n n, m = map(int, input().split())\n As = [list(input()) for _ in range(n)]\n Bs = [list(input()) for _ in range(m)]\n\n As_arr = np.array(As)\n Bs_arr = np.array(Bs)\n for i in range(n-m+1):\n for j in range(n-m+1):\n xs, xe = i, i+m\n ys, ye = j, j+m\n if np.all(As_arr[ys:ye, xs:xe] == Bs_arr):\n print(\'Yes\')\n exit()\n print(\'No\')\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s006443478', 's083034039'] | [12172.0, 21220.0] | [181.0, 303.0] | [470, 486] |
p03804 | u055687574 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = map(int, input().split())\n\nA = [input() for n in range(N)]\nB = [input() for m in range(M)]\n\nans = "Yes"\nfor a in A:\n for b in B:\n print(a, b)\n if b not in a:\n ans = "No"\nprint(ans)\n', 'N, M = map(int, input().split())\n\nA = [input() for n in range(N)]\nB = [input() for m in range(M)]\n\nans = "Yes"\nfor a in A:\n for b in B:\n if b not in a:\n ans = "No"\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s298139734', 's211770448'] | [3188.0, 2940.0] | [20.0, 19.0] | [216, 196] |
p03804 | u062484507 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = map(int, input().split())\nA = [input() for i in range(N)]\nB = [input() for j in range(M)]\n\nans = True\nfor k in range(len(B)):\n print(B[k])\n print(A[k])\n if B[k] not in A[k]:\n ans = False\n break\nprint("Yes" if ans == True else "No")', 'N, M = map(int, input().split())\nA = [input() for i in range(N)]\nB = [input() for j in range(M)]\n\nans = True\nfor k in range(len(B)):\n if B[k] not in A[k]:\n ans = False\n break\nprint("Yes" if ans == True else "No")\n'] | ['Wrong Answer', 'Accepted'] | ['s479135431', 's933953125'] | [3060.0, 3060.0] | [18.0, 18.0] | [261, 230] |
p03804 | u063073794 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["yandy\nN, M = map(int, input().split())\nA = [''] * N\nB = [''] * M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n NO = False\n for x in range(M):\n a = A[i+x][j:j+M]\n if a != B[x]:\n NO = True\n break\n if not NO:\n print('Yes')\n exit()\n\nprint('No')\n", 'n, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\nfor k in range(n-m+1):\n for j in range(n-m+1):\n h="true"\n for i in range(m):\n if a[k+i][j:j+m]!=b[i]:\n h="false" \n if h=="true":\n print("Yes")\n exit()\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s089599141', 's851945662'] | [3064.0, 3060.0] | [17.0, 22.0] | [419, 303] |
p03804 | u072717685 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int,input().split())\na = [None]*n\nb = [None]*m\nfor i in range(n):\n a[i] = input()\nfor j in range(m):\n b[j] = input()\nr = 'No'\nfor i in range(n - m):\n end_yoko = i + m + 1\n a_t = [s[i:end_yoko] for s in a]\n for j in range(n - m):\n end_tate = j + m + 1\n if a_t[j:end_tate] == b:\n r = 'Yes'\nprint(r)", "n, m = map(int,input().split())\na = [None]*n\nb = [None]*m\nfor i in range(n):\n a[i] = input()\nfor j in range(m):\n b[j] = input()\nr = 'No'\nfor i in range(n - m + 1):\n end_yoko = i + m\n a_t = [s[i:end_yoko] for s in a]\n for j in range(n - m + 1):\n end_tate = j + m\n if a_t[j:end_tate] == b:\n r = 'Yes'\nprint(r)"] | ['Wrong Answer', 'Accepted'] | ['s414521745', 's573111493'] | [3064.0, 3316.0] | [18.0, 22.0] | [323, 323] |
p03804 | u075595666 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N,M = [int(i) for i in input().split()]\na = []\nfor i in range(N):\n\tarray = input()\n\ta.append(array)\nb = []\nfor i in range(M):\n\tline = input()\n\tb.append(line)\nfor i in range(N-M):\n\tfor j in range(N-M):\n\t\tans = 'Yes'\n\t\tfor n in range(M):\n\t\t\tfor m in range(M):\n\t\t\t\tif a[i+n][j+m] == b[n][m]:\n\t\t\t\t\tpass\n\t\t\t\t\tprint(i,j,n,m)\n\t\t\t\telse:\n\t\t\t\t\tans = 'No'\nprint(ans)", "n,m = [int(i) for i in input().split()]\na = []\nfor i in range(n):\n\tarray = input()\n\ta.append(array)\nb = []\nfor i in range(m):\n\tline = input()\n\tb.append(line)\nans 'No'\nfor i in range (n-m+1):\n\tfor j in range(n-m+1):\n\t\tAns = ans\n\t\tif a[i][j:j+m] == b[0]:\n\t\t\tprint(i,j)\n\t\t\tfor k in range(m):\n\t\t\t\tif not a[i+k][j:j+m] == b[k]:\n\t\t\t\t\tans = Ans\n\t\t\t\t\tcontinue\n\t\t\t\telse:\n\t\t\t\t\tans = 'Yes'\n\t\t\t\t\tprint(ans)\n\t\t\t\t\tbreak\nprint(ans)", "n,m = [int(i) for i in input().split()]\na = []\nfor i in range(n):\n\tarray = input()\n\ta.append(array)\nb = []\nfor i in range(m):\n\tline = input()\n\tb.append(line)\nans = 'No'\nfor i in range (n-m+1):\n\tfor j in range(n-m+1):\n\t\tAns = ans\n\t\tif a[i][j:j+m] == b[0]:\n\t\t\t#print(i,j)\n\t\t\tfor k in range(m):\n\t\t\t\tif not a[i+k][j:j+m] == b[k]:\n\t\t\t\t\tans = Ans\n\t\t\t\t\tbreak\n\t\t\t\telse:\n\t\t\t\t\tans = 'Yes'\n\t\t\t\t\t#print(ans)\nprint(ans)"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s050947535', 's176727543', 's480529206'] | [5656.0, 2940.0, 3064.0] | [494.0, 18.0, 18.0] | [355, 416, 406] |
p03804 | u077898957 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n,m = map(int,input().split())\n\nA = [[input()] for i in range(n)]\nB = [[input()] for i in range(m)]\nans = 0\nfor i in range(n-m):\n for j in range(n-m):\n temp=0\n for k in range(m):\n for l in range(m):\n if B[k][l]==A[i+k][j+l]:\n temp+=1\n ans = max(ans,temp)\n \nprint('Yes' if ans==m*m else 'No')", "\nn,m = map(int,input().split())\n\nA = [[input()] for i in range(n)]\nB = [[input()] for i in range(m)]\nans = 0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n temp=0\n for k in range(m):\n for l in range(m):\n if B[k][l]==A[i+k][j+l]:\n temp+=1\n ans = max(ans,temp)\n \nprint('Yes' if ans==m*m else 'No')", "n,m = map(int,input().split())\n\nA = [list(input()) for i in range(n)]\nB = [list(input()) for i in range(m)]\nans = 0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n temp=0\n for k in range(m):\n for l in range(m):\n if B[k][l]==A[i+k][j+l]:\n temp+=1\n ans = max(ans,temp)\n \nprint('Yes' if ans==m*m else 'No')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s060032241', 's748560030', 's816524624'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 187.0] | [407, 412, 419] |
p03804 | u088974156 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['m,n =map(int,input().split())\na=[input() for _ in range(m)]\nb=[input() for _ in range(m)]\nr=any([r[j:j+m] for r in a[i:i+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)]\nr=any([r[j:j+m] for r in a[i:i+m]]==b for i in range (n-m+1) for j in range(n-m+1))\nprint("Yes" if r else "No")'] | ['Runtime Error', 'Accepted'] | ['s387771273', 's915202100'] | [3060.0, 3060.0] | [17.0, 20.0] | [201, 201] |
p03804 | u093492951 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import sys\nN, M = [int(i) for i in input().split()]\n\nA = [[i for i in input()] for j in range(N)]\nB = [[i for i in input()] for k in range(M)]\n\nfor i in range(N-M-1):\n for j in range(N-M-1):\n diff = 0\n\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] != B[k][l]:\n diff = 1\n break\n\n if diff == 1:\n break\n\n if diff == 0:\n print('Yes')\n sys.exit()\n\nprint('No')\n", "import sys\nN, M = [int(i) for i in input().split()]\n\nA = [[i for i in input()] for j in range(N)]\nB = [[i for i in input()] for k in range(M)]\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n diff = 0\n\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] != B[k][l]:\n diff = 1\n break\n\n if diff == 1:\n break\n\n if diff == 0:\n print('Yes')\n sys.exit()\n\nprint('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s275550469', 's326008133'] | [3064.0, 3064.0] | [19.0, 18.0] | [501, 501] |
p03804 | u095094246 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n,m=map(int,input().split())\na=[list(input()) for _ in range(n)]\nb=[list(input()) for _ in range(m)]\nr=n-m+1\nfor x in range(r**2):\n for y in range(m**2):\n if a[x//r][x%r]!=b[y//m][y%m]:\n break\n else:\n print('Yes')\n break\nelse:\n print('No')\n", "n,m=map(int,input().split())\na=[list(input()) for _ in range(n)]\nb=[list(input()) for _ in range(m)]\nr=n-m+1\nprint('Yes' if any([all([a[x//r+y//m][x%r+y%m]==b[y//m][y%m] for y in range(m**2)]) for x in range(r**2)]) else 'No')"] | ['Wrong Answer', 'Accepted'] | ['s700490184', 's451717400'] | [9116.0, 9064.0] | [24.0, 127.0] | [257, 226] |
p03804 | u098572984 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N, M = input().split()\nA=[]\nfor i in range(0,N):\n A.append(input())\nB=[]\nfor j in range(0,M):\n B.append(input())\n\nref_tuple = zip(range(0,N-M+1),range(0,N-M+1))\nt=False\nfor ref_row_a, ref_col_a in ref_tuple:\n for row_b, col_b in zip(range(0,M),range(0,M)):\n if not A[ref_row_a+row_b][ref_col_a+col_b]==B[row_b][col_b]:\n break\n if (row_b, col_b)==(M-1,M-1):\n t=True\n break\n if t:\n break\n\nif t:\n print('Yes')\nelse:\n print('No')\n\n", "import itertools\n\n_N, _M = input().split()\nN=int(_N)\nM=int(_M)\nA=[]\nfor i in range(0,N):\n A.append(input())\nB=[]\nfor j in range(0,M):\n B.append(input())\n\nref_tuple = itertools.product(range(0,N-M+1),range(0,N-M+1))\nt=False\nfor ref_row_a, ref_col_a in ref_tuple:\n for row_b, col_b in itertools.product(range(0,M),range(0,M)):\n if not A[ref_row_a+row_b][ref_col_a+col_b]==B[row_b][col_b]:\n break\n if (row_b, col_b)==(M-1,M-1):\n t=True\n break\n if t:\n break\n\nif t:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s104330711', 's938221231'] | [3064.0, 3188.0] | [23.0, 25.0] | [499, 565] |
p03804 | u099918199 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['phase = 0\nif list_a != list_b:\n for i in range(0, n-m):\n for j in range(0, n-m):\n for k in range(0,m):\n if list_a[i+k][j:j+m] == list_b[k]:\n if k != m-1:\n continue\n else:\n pass\n else:\n break\n phase = 1\n print("Yes")\n break\n if phase == 1:\n break\n if phase == 1:\n break\n else:\n print("No")\nelse:\n print("Yes")\n', 'n,m = map(int, input().split())\nlist_a = []\nlist_b = []\ncount = 0\nwhile count < n:\n list_a.append(list(str(input())))\n count += 1\ncount = 0\nwhile count < m:\n list_b.append(list(str(input())))\n count += 1\n#print(list_a)\n#print(list_b)[\nphase = 0\nif list_a != list_b:\n for i in range(0, n-m):\n for j in range(0, n-m):\n for k in range(0,m):\n if list_a[i+k][j:j+m] == list_b[k]:\n if k != m-1:\n continue\n else:\n pass\n else:\n break\n phase = 1\n print("Yes")\n break\n if phase == 1:\n break\n if phase == 1:\n break\n else:\n print("No")\nelse:\n print("Yes")\n'] | ['Runtime Error', 'Accepted'] | ['s097273242', 's485173188'] | [3060.0, 3064.0] | [17.0, 18.0] | [565, 812] |
p03804 | u106297876 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N,M = map(int,input().split())\nA = []\nB = []\nfor i in range(N):\n\ta = list(input())\n\tA.append(a)\nfor j in range(M):\n\tb = list(input())\n\tB.append(b)\n\nprint(A)\nans = "No"\n\nfor i in range(N-M+1):\n\tfor j in range(N-M+1):\n\t\tc = 0\n\t\tfor k in range(M):\n\t\t\tfor l in range(M):\n\t\t\t\tif A[i+k][i+l] == B[k][l]:\n\t\t\t\t\tc+=1\n\t\tif c == M**2:\n\t\t\tans = "Yes"\n\t\t\tbreak\nprint(ans)', 'N,M = map(int,input().split())\nA = []\nB = []\nfor i in range(N):\n\ta = list(input())\n\tA.append(a)\nfor j in range(M):\n\tb = list(input())\n\tB.append(b)\n\nans = "No"\n\nfor i in range(N-M+1):\n\tfor j in range(N-M+1):\n\t\tc = 0\n\t\tfor k in range(M):\n\t\t\tfor l in range(M):\n\t\t\t\tif A[i+k][j+l] == B[k][l]:\n\t\t\t\t\tc+=1\n\t\tif c == M**2:\n\t\t\tans = "Yes"\n\t\t\tbreak\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s696503414', 's489558648'] | [3064.0, 3064.0] | [157.0, 161.0] | [369, 350] |
p03804 | u111365959 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["m,n = [int(x) for x in input().split()]\na = []\nb = []\nfor _ in range(m):\n a.append(int(input().replace('#','1').replace('.','2')))\nm = 0\nfor i in range(n):\n b.append(int(input().replace('#','1').replace('.','2')))\n if a[i] == b[i]:\n m += 1\nprint('Yes') if m == n else print('No')", "m,n = [int(x) for x in input().split()]\na = []\nb = []\nfor _ in range(m):\n a.append(input())\nm = 0\nfor i in range(n):\n b.append(input())\n if b[i] in a[i]:\n m += 1\nprint('Yes') if m == n else print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s384780126', 's709262055'] | [3064.0, 3060.0] | [17.0, 17.0] | [285, 208] |
p03804 | u112317104 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['import sys\nfrom io import StringIO\nimport unittest\n\ndef resolve():\n N, M = map(int, input().split())\n A = [list(input()) for _ in range(N)]\n B = [list(input()) for _ in range(M)]\n\n ans = \'No\'\n for i in range(N):\n for j in range(N):\n if A[i][j] == B[0][0]:\n count = 0\n for k in range(M):\n for l in range(M):\n if i+k>= N or j+l>= N:\n continue\n if A[i+k][j+l] == B[k][l]:\n count += 1\n if count == M * 2:\n ans = \'Yes\'\n break\n if ans == \'Yes\':\n break\n if ans == \'Yes\':\n break\n if ans == \'Yes\':\n break\n \n print(ans)\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n def test_入力例_1(self):\n input = """3 2\n#.#\n.#.\n#.#\n#.\n.#"""\n output = """Yes"""\n self.assertIO(input, output)\n def test_入力例_2(self):\n input = """4 1\n....\n....\n....\n....\n#"""\n output = """No"""\n self.assertIO(input, output)\n\nif __name__ == "__main__":\n unittest.main()', "def resolve():\n N, M = map(int, input().split())\n A = [list(input()) for _ in range(N)]\n B = [list(input()) for _ in range(M)]\n\n ans = 'No'\n for i in range(N):\n for j in range(N):\n if A[i][j] == B[0][0]:\n count = 0\n for k in range(M):\n for l in range(M):\n if i+k>= N or j+l>= N:\n continue\n if A[i+k][j+l] == B[k][l]:\n count += 1\n if count == M * M:\n ans = 'Yes'\n break\n print(ans)\n\nresolve()\n"] | ['Wrong Answer', 'Accepted'] | ['s121195258', 's032342957'] | [5704.0, 3064.0] | [45.0, 333.0] | [1519, 642] |
p03804 | u118211443 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m=map(int,input().split())\na = []\nfor i in range(n):\n a.append(input())\nb = []\nfor i in range(m):\n b.append(input())\n\nok=False\ncf=[]\nfor i in range(n-m+1):\n for j in range(n-m+1):\n for l in range(m):\n cf.append(a[i+l][j:j+m])\n #print(cf)\n if cf==b:\n ok=True\n cf=[]\nprint("Yes"if ok else "No")', 'n,m=map(int,input().split())\na = []\nfor i in range(n):\n a.append(input())\nb = []\nfor i in range(m):\n b.append(input())\n\nok=False\nfor i in range(n-m+1):\n for j in range(n-m+1):\n cf=[]\n for l in range(m):\n cf.append(a[i+l][j:j+m])\n #print(cf)\n if cf==b:\n ok=True\nprint("Yes"if ok else "No")'] | ['Wrong Answer', 'Accepted'] | ['s291836058', 's725024045'] | [3064.0, 3064.0] | [22.0, 24.0] | [345, 359] |
p03804 | u125205981 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["def srch_all(ptn, str):\n index = []\n i = -1\n while True:\n i = str.find(ptn, i + 1)\n if i > -1:\n index.append(i)\n else:\n break\n return index\n\ndef judge(i, jlist, len):\n print(jlist)\n for l in jlist:\n k = 1\n while k < M:\n try:\n if n[i + 1][l:l + len] == m[k]:\n pass\n else:\n return 'No'\n except:\n return 'No'\n k += 1\n else:\n return 'Yes'\n\nN, M = map(int, input().split())\ni = 0\nn = []\nwhile i < N:\n n.append(input())\n i += 1\n\ni = 0\nm = []\nwhile i < M:\n m.append(input())\n i += 1\n\ni = 0\nr = 'No'\nwhile i < N:\n result = srch_all(m[0], n[i])\n if len(result) > 0:\n r = judge(i, result, len(m[0]))\n if r == 'Yes':\n break\n i += 1\nprint(r)", "import copy\nimport re\n\ndef judge(i, jlist, len):\n for l in jlist:\n k = 1\n while k < M:\n try:\n if n[i + 1][l:l + len] == m[k]:\n pass\n else:\n return 'No'\n except:\n return 'No'\n k += 1\n else:\n return 'Yes'\n\nN, M = map(int, input().split())\ni = 0\nn = []\nwhile i < N:\n n.append(input())\n i += 1\n\ni = 0\nm = []\nwhile i < M:\n m.append(input())\n i += 1\n\ni = 0\nr = 'No'\nwhile i < N:\n result = re.search(m[0], n[i])\n if result != None:\n r = judge(i, result.span(), len(m[0]))\n i += 1\nprint(r)", "def srch_all(ptn, str):\n index = []\n i = -1\n while True:\n i = str.find(ptn, i + 1)\n if i > -1:\n index.append(i)\n else:\n break\n return index\n\ndef judge(i, jlist, len):\n for l in jlist:\n k = 1\n while k < M:\n try:\n if n[i + 1][l:l + len] == m[k]:\n pass\n else:\n return 'No'\n except:\n return 'No'\n i += 1\n k += 1\n else:\n return 'Yes'\n\nN, M = map(int, input().split())\ni = 0\nn = []\nwhile i < N:\n n.append(input())\n i += 1\n\ni = 0\nm = []\nwhile i < M:\n m.append(input())\n i += 1\n\ni = 0\nr = 'No'\nwhile i < N:\n result = srch_all(m[0], n[i])\n if len(result) > 0:\n r = judge(i, result, len(m[0]))\n if r == 'Yes':\n break\n i += 1\nprint(r)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s055642635', 's919766567', 's611458298'] | [3064.0, 3700.0, 3064.0] | [24.0, 30.0, 24.0] | [884, 660, 886] |
p03804 | u131411061 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import sys\nN,M = map(int,input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\ncnt = 0\nif A < B:\n print('No')\n sys.exit()\nelse:\n for i in range(N):\n for j in range(M):\n if B[j] in A[i]:\n cnt+=1\n flag = True\n else:\n cnt = 0\n flag = False\n \tif cnt == M:\n \tbreak\nif flag:\n print('Yes')\nelse:\n print('No')", 'import sys\nN,M = map(int,input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\ncnt = 0\nif A < B:\n print(\'No\')\n sys.exit()\nelse:\n for i in range(N):\n for j in range(M):\n print("A[i]:",A[i])\n print("B[j]:",B[j])\n if B[j] in A[i]:\n cnt+=1\n flag = True\n else:\n cnt = 0\n flag = False\n if cnt == M:\n break\nif flag:\n print(\'Yes\')\nelse:\n print(\'No\')', "import sys\nN,M = map(int,input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\ncnt = 0\nif A < B:\n print('No')\n sys.exit()\nelse:\n for i in range(N):\n for j in range(M):\n if B[j] in A[i]:\n cnt+=1\n flag = True\n else:\n cnt = 0\n flag = False\n \tif cnt == M:\n \tbreak\nif flag:\n print('Yes')\nelse:\n print('No')", "N,M = map(int,input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\ndef comp(x,y):\n for i in range(M):\n for j in range(M):\n if A[x+i][y+j] != B[i][j]:\n return False\n return True\nflag = False\nfor i in range(N-M+1):\n for j in range(N-M+1):\n if comp(i,j):\n flag = True\n break\nif flag:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s223107562', 's574544623', 's850065932', 's423373998'] | [2940.0, 3316.0, 2940.0, 3064.0] | [17.0, 23.0, 17.0, 19.0] | [451, 513, 451, 419] |
p03804 | u131634965 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, 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 for j in range(N-M+1):\n count=0\n for k in range(M):\n for l in range(M):\n if a[i][j]==b[k][l]:\n count+=1\n if count==M*M:\n print("Yes")\n exit()\nprint("No")', 'N, 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 for j in range(N-M+1):\n count=0\n for k in range(M):\n for l in range(M):\n if a[i][j]!=b[k][l]:\n break\n else:\n count+=1\n if count==M*M:\n print("Yes")\n exit()\nprint("No")', 'N, 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 for j in range(N-M+1):\n count=0\n for k in range(M):\n for l in range(M):\n if a[i+k][j+l]!=b[k][l]:\n break\n else:\n count+=1\n if count==M*M:\n print("Yes")\n exit()\nprint("No")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s645786185', 's868817458', 's754946392'] | [3064.0, 3064.0, 3064.0] | [132.0, 32.0, 33.0] | [374, 407, 411] |
p03804 | u140251125 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['# input\nN, M = map(int, input().split())\nA = [list(input()) for _ in range(N)]\nB = [list(input()) for _ 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 for l in range(M):\n if B[k][l] == A[i + k][j + l]:\n ans += 1\n else:\n break\n if ans == M * 2:\n print("Yes")\n exit()\n else:\n ans = 0\n break\n\nprint(\'No\')', "import numpy as np\n\n# input\nN, M = map(int, input().split())\nA = [list(input()) for _ in range(N)]\nB = [list(input()) for _ in range(M)]\n\nA_arr = np.array(A)\nB_arr = np.array(B)\n\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n if np.array_equal(A_arr[i:i + M, j:j + M], B_arr):\n print('Yes')\n exit()\n\nprint('No') \n"] | ['Runtime Error', 'Accepted'] | ['s366631930', 's909435118'] | [3064.0, 12436.0] | [17.0, 166.0] | [515, 361] |
p03804 | u143903328 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["m,n = map(int,input().split())\na = []*m\nb = []*n\nflag = False\nfor i in range(m):\n a.append(input())\nfor j in range(n):\n b.append(input())\nflag = False\nfor i in range(m-n+1):\n for j in range(m-n+1):\n for k in range(n):\n if b[k] != a[i][j:j+n]:\n break\n else:\n flag = True\nif flag:\n print('Yes')\nelse:\n print('No')", "m,n = map(int,input().split())\na = []*m\nb = []*n\nflag = False\nfor i in range(m):\n a.append(input())\nfor j in range(n):\n b.append(input())\n\nprint(a)\nprint(b)\n\nfor i in range(m-n+1):\n for j in range(m-n+1):\n for k in range(n+1):\n if b[k] != a[i][j:j+n]:\n break\n flag = True\n\nif flag:\n print('Yes')\nelse:\n print('No')\n", "m,n = map(int,input().split())\na = []*m\nb = []*n\nflag = False\nfor i in range(m):\n a.append(input())\nfor j in range(n):\n b.append(input())\nflag = False\nfor i in range(m-n+1):\n for j in range(m-n+1):\n for k in range(n):\n print(k,j,i)\n if b[k] != a[i][j:j+n]:\n break\n flag = True\nif flag:\n print('Yes')\nelse:\n print('No')\n", "m,n = map(int,input().split())\na = []*m\nb = []*n\nflag = False\nfor i in range(m):\n a.append(input())\nfor j in range(n):\n b.append(input())\n\nfor i in range(0, m-n):\n for j in range(0, m-n):\n for k in range(0,n):\n if b[k] != a[i][j:j+n]:\n break\n else:\n flag = True\n\nif flag:\n print('Yes')\nelse:\n print('No')", "m,n = map(int,input().split())\na = []*m\nb = []*n\nflag = False\nfor i in range(m):\n a.append(input())\nfor j in range(n):\n b.append(input())\n\nprint(a)\nprint(b)\n\nfor i in range(m-n+1):\n for j in range(m-n+1):\n for k in range(n+1):\n if b[k] != a[i][j:j+n]:\n break\n flag = True\n\nif flag:\n print('Yes')\nelse:\n print('No')\n", "m,n = map(int,input().split())\na = []*m\nb = []*n\nflag = False\nfor i in range(m):\n a.append(input())\nfor j in range(n):\n b.append(input())\nflag = False\nfor i in range(m-n+1):\n for j in range(m-n+1):\n for k in range(n):\n if b[k] != a[i+k][j:j+n]:\n break\n else:\n flag = True\nif flag:\n print('Yes')\nelse:\n print('No')\n "] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s134918863', 's191363576', 's407404785', 's415019236', 's600680796', 's200847031'] | [3064.0, 3064.0, 3572.0, 3064.0, 3064.0, 3060.0] | [18.0, 19.0, 23.0, 19.0, 19.0, 18.0] | [477, 476, 491, 444, 476, 488] |
p03804 | u153902122 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import sys\nN, M = map(int,input().split())\nA,B=[],[]\nfor i in range(N):\n array = list(input().split())\n A.append(array)\nfor j in range(M):\n array = input().split()\n B.append(array)\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n new = [A[k][j:j+M] for k in range(i,i+M)]\n if new == b:\n print('Yes')\n sys.exit()\nprint('No')", "import sys\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 for j in range(N-M+1):\n new = [A[k][j:j+M] for k in range(i,i+M)]\n if new == B:\n print('Yes')\n sys.exit()\nprint('No')"] | ['Runtime Error', 'Accepted'] | ['s309471651', 's894706403'] | [3064.0, 3064.0] | [17.0, 21.0] | [374, 288] |
p03804 | u167647458 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\na = [list(input()) for _ in range(n)]\nb = [list(input()) for _ in range(m)]\n\nfor i in range(n):\n for j in range(n):\n if i + m > n and j + m > n:\n a[i : i + m][j : j + m] == b\n print('Yes')\n break\nelse:\n\tprint('No')", "n, m = map(int, input().split())\na = [list(input()) for _ in range(n)]\nb = [list(input()) for _ in range(m)]\n\ndef check():\n for i in range(n):\n for j in range(n):\n if i + m <= n and j + m <= n:\n aa = []\n for k in range(m):\n aa.append(a[i + k][j : j+m])\n if aa == b:\n return 'Yes'\n return 'No'\n\nprint(check())"] | ['Wrong Answer', 'Accepted'] | ['s379317452', 's730086240'] | [3060.0, 3064.0] | [18.0, 23.0] | [290, 443] |
p03804 | u177040005 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N,M = map(int,input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nch = 0\nfor i in range(N-M+1):\n for j in range(1,M-1):\n cnt = 0\n for k in range(M):\n if B[k] == A[i+k][j:j+M]:\n cnt += 1\n if cnt == M:\n ch = 1\nif ch == 1:\n print('Yes')\nelse:\n print('No')\n", "N,M = map(int,input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\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 cnt += 1\n if cnt == M:\n print('Yes')\n exit()\nprint('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s020861223', 's326468207'] | [3060.0, 3060.0] | [22.0, 23.0] | [350, 336] |
p03804 | u183840468 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["a,b = [int(i) for i in input().split()]\n\nal = np.array([list(input()) for _ in range(a)])\nbl = np.array([list(input()) for _ in range(b)])\n\nflg = False\nfor i in range(a - b + 1):\n for j in range(a - b + 1):\n if(al[i:i+b,j:j+b] == bl).all():\n flg = True\n \nprint('Yes' if flg else 'No')\n\n", "import numpy as np\na,b = [int(i) for i in input().split()]\n\nal = np.array([list(input()) for _ in range(a)])\nbl = np.array([list(input()) for _ in range(b)])\n\nflg = False\nfor i in range(a - b + 1):\n for j in range(a - b + 1):\n if(al[i:i+b,j:j+b] == bl).all():\n flg = True\n \nprint('Yes' if flg else 'No')\n\n"] | ['Runtime Error', 'Accepted'] | ['s304233318', 's308556982'] | [3060.0, 22612.0] | [18.0, 411.0] | [319, 338] |
p03804 | u185948224 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N, M = map(int, input().split())\n\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nc = []\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n c = [A[i+k][j:j+M] for k in range(M)]\n if B==c:\n print('Yes')\n break\nif B!=c:print('No')\n", "N, M = map(int, input().split())\n\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nc = []\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n c = [A[i+k][j:j+M] for k in range(M)]\n if B==c:\n print('yes')\n break\nif B!=c:print('No')\n\n", "N, M = map(int, input().split())\n\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nc = []\n\nd = 0\n\nfor i in range(N-M+1):\n if d==1:break\n for j in range(N-M+1):\n c = [A[i+k][j:j+M] for k in range(M)]\n if B==c:\n d = 1\n break\nif d==1:print('Yes')\nelse:print('No')\n\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s531495242', 's740857956', 's807961559'] | [3060.0, 3060.0, 3060.0] | [21.0, 21.0, 21.0] | [283, 284, 320] |
p03804 | u186838327 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\na = ['']*n\nb = ['']*m\nfor i in range(n):\n a[i] = str(input())\nfor i in range(m):\n b[i] = str(input())\nfor i in range(n-m+2):\n c = a[0:m]\n for j in range(n-m+2):\n d = [e[j:j+m] for e in c]\n print(d)\n if b == d:\n print('Yes')\n exit()\nelse:\n print('No')", "n, m = map(int, input().split())\na = ['']*n\nb = ['']*m\nfor i in range(n):\n a[i] = str(input())\nfor i in range(m):\n b[i] = str(input())\nfor i in range(n-m+2):\n c = a[i:i+m]\n for j in range(n-m+2):\n d = [e[j:j+m] for e in c]\n if b == d:\n print('Yes')\n exit()\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s731073430', 's457232202'] | [3572.0, 3064.0] | [25.0, 20.0] | [307, 296] |
p03804 | u198035503 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['s = input() # "3 2"\nn, m = s.split() # ("3", "2")\nn = int(n) # 3\nm = int(m) # 2\n\na = []\nfor i in range(0, n):\n a.append(input())\n\nb = []\nfor i in range(0, m):\n b.append(input())\n\ndef same(a, b, i, j):\n for k in range(0, len(b)):\n if a[i + k][j:j + len(b)] != b[k]:\n return False\n return True\n\nprint("a, b: {}, {}".format(a, b))\n\nis_same = False\nfor i in range(0, n - m + 1):\n for j in range(0, n - m + 1):\n if same(a, b, i, j):\n is_same = True\n break\n else:\n continue\n break\n\nprint("Yes" if is_same else "No")\n', 's = input() # "3 2"\nn, m = s.split() # ("3", "2")\nn = int(n) # 3\nm = int(m) # 2\n\na = []\nfor i in range(0, n):\n a.append(input())\n\nb = []\nfor i in range(0, m):\n b.append(input())\n\ndef same(a, b, i, j):\n for k in range(0, len(b)):\n if a[i + k][j:j + len(b)] != b[k]:\n return False\n return True\n\nis_same = False\nfor i in range(0, n - m + 1):\n for j in range(0, n - m + 1):\n if same(a, b, i, j):\n is_same = True\n break\n else:\n continue\n break\n\nprint("Yes" if is_same else "No")\n'] | ['Wrong Answer', 'Accepted'] | ['s465728310', 's700727141'] | [3064.0, 3064.0] | [18.0, 18.0] | [589, 553] |
p03804 | u202619899 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = map(int, input().split())\nA, B = [], []\nfor _ in range(N):\n A.append(input())\nfor _ in range(M):\n B.append(input())\n\nres = False\nfor sy in range(N - M + 1):\n for dy in range(M):\n y = sy + dy\n ok = True\n for i in range(N - M + 1):\n a = A[y][i:i + M]\n ok = ok and a == B[dy]\n res = res or ok\nprint("Yes" if ok else "No")', 'N, M = map(int, input().split())\nA, B = [], []\nfor _ in range(N):\n A.append(input())\nfor _ in range(M):\n B.append(input())\n\nres = False\nfor sy in range(N - M + 1):\n for sx in range(N - M + 1):\n ok = True\n for dy in range(M):\n y = sy + dy\n a = A[y][sx:sx + M]\n ok = ok and a == B[dy]\n res = res or ok\nprint("Yes" if res else "No")'] | ['Wrong Answer', 'Accepted'] | ['s574241702', 's379479983'] | [3064.0, 3064.0] | [21.0, 23.0] | [384, 392] |
p03804 | u220345792 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = map(int, input().split())\ndata = []\nfor i in range(N):\n data.append(input())\ninput_data=[]\nfor i in range(M):\n input_data.append(input())\nflag_1 = False\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n if flag = False\n for k in range(M):\n for l in range(M):\n if data[i+k][j+l] != input_data[k][l]:\n flag = True\n if flag:\n flag_1 = True\n\nif flag_1:\n print("Yes")\nelse:\n print("No")\n \n\n\n', 'N, M = map(int, input().split())\ndata = []\nfor i in range(N):\n data.append(input())\ninput_data=[]\nfor i in range(M):\n input_data.append(input())\nflag_1 = False\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n flag = True\n for k in range(M):\n for l in range(M):\n if data[i+k][j+l] != input_data[k][l]:\n flag = False\n if flag:\n flag_1 = True\n\nif flag_1:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s874334771', 's670435250'] | [2940.0, 3064.0] | [17.0, 163.0] | [444, 431] |
p03804 | u222668979 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["from itertools import product\n\nn, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nfor i, j in product(range(n - m + 1), repeat=2):\n print(i,j)\n if all(a[i + k][j:] == b[k] for k in range(m)):\n print('Yes')\n break\nelse:\n print('No')\n", "from itertools import product\n\nn, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nfor i, j in product(range(n - m + 1), repeat=2):\n print(i,j)\n if all(a[i + k][j:j + m] == b[k] for k in range(m)):\n print('Yes')\n break\nelse:\n print('No')\n", "from itertools import product\n\nn, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nfor i, j in product(range(n - m + 1), repeat=2):\n if all(a[i + k][j:j + m] == b[k] for k in range(m)):\n print('Yes')\n break\nelse:\n print('No')\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s106332867', 's338186541', 's944345348'] | [3572.0, 3444.0, 3060.0] | [23.0, 21.0, 19.0] | [302, 307, 292] |
p03804 | u227082700 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m=map(int,input().split());a,b,ans=[input()for i in range(n)],[input()for i in range(m)],"No"\nfor i in range(n-m+1):\n for j in range(n-m+1):\n c=[(a[i])[j:j+m]for k in range(m)]\n if b==c:ans="Yes"\nprint(ans)', 'n,m=map(int,input().split());a=[input()for i in range(n)];b=[input()for i in range(m)];ans="No"\nfor i in range(n-m+1):\n for j in range(n-m+1):\n c=[a[i+k][j:j+m]for k in range(m)]\n if b==c:ans="Yes"\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s997612071', 's481919364'] | [3060.0, 3060.0] | [21.0, 21.0] | [215, 215] |
p03804 | u229959388 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\ndef main():\n\n for i in range(n-m+1):\n for j in range(n-m+1):\n if match(i, j):\n print("yes")\n exit()\n \n print("no")\n\ndef match(x, y):\n for i in range(m):\n for j in range(m):\n if (a[x+i][y+j] != b[i][j]):\n return False\n\n return True\n\nif __name__ == "__main__":\n main()', 'n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\ndef main():\n\n for i in range(n-m+1):\n for j in range(n-m+1):\n if match(i, j):\n print("Yes")\n exit()\n \n print("No")\n\ndef match(x, y):\n for i in range(m):\n for j in range(m):\n if (a[x+i][y+j] != b[i][j]):\n return False\n\n return True\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s984248768', 's794112372'] | [3064.0, 3064.0] | [18.0, 18.0] | [463, 463] |
p03804 | u230717961 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = [int(i) for i in input().split()]\n\ndef init_img(n):\n return [[0 if j == "#" else 1 for j in input()] for i in range(n)]\n\nimg = init_img(n)\n\ntmp_img = init_img(m)\n\nflg = False\n\nfor i in range(n):\n if flg:\n break\n\n for j in range(n):\n count = 0\n for k in range(m):\n if img[i+k][j:j+m] == tmp_img[k]:\n count += 1\n\n if count == 3:\n flg = True\n\nif flg:\n print("Yes")\nelse:\n print("No")\n', 'n, m = [int(i) for i in input().split()]\n\ndef init_img(n):\n return [[0 if j == "#" else 1 for j in input()] for i in range(n)]\n\nimg = init_img(n)\n\ntmp_img = init_img(m)\n\nflg = False\n\nfor i in range(n):\n if flg:\n break\n\n if i+m > n:\n break\n\n for j in range(n):\n count = 0\n if j+m > n:\n break\n \n for k in range(m):\n if img[i+k][j:j+m] == tmp_img[k]:\n count += 1\n\n if count == m:\n flg = True\n\nif flg:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s596676142', 's896611053'] | [3064.0, 3064.0] | [31.0, 25.0] | [468, 546] |
p03804 | u249895018 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['#include <string>\n\n\nusing namespace std;\n\nconst int nmax = 50;\nconst int mmax = 50;\nchar N_sq[nmax][nmax], M_sq[mmax][mmax];\n\n\nbool judge_match(int x, int y, int M){\n\tfor(int i=0;i<M;i++){\n\t\tfor(int j=0;j<M;j++){\n\t\t\tif(N_sq[y+i][x+j] != M_sq[y+i][x+j]) return false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\nint main(void){\n\tint N,M;\n\n\tcin >> N >> M;\n\tbool exist = false;\n\n\tfor(int y=0;y < N;y++){\n\t\tfor(int x;x < N;x++){\n\t\t\tcin >> N_sq[y][x];\n\t\t}\n\t}\n\n\tfor(int y=0;y < M;y++){\n\t\tfor(int x;x < M;x++){\n\t\t\tcin >> M_sq[y][x];\n\t\t}\n\t}\n\n\tfor(int y=0;y <= N - M;y++){\n\t\tfor(int x=0;x <= N - M;x++){\n\t\t\tif(judge_match(x, y, M)) exist=true;\n\t\t}\n\t}\n\n\tif(exist)\n\t\tcout << "Yes" << endl;\n\telse\n\t\tcout << "No" << endl;\n\n\treturn 0;\n\n}', 'import sys\n\ncount = 0\nN_list = []\nM_list = []\nfor line in sys.stdin:\n line = line.rstrip("\\n")\n if count == 0:\n line = line.split(" ")\n N = int(line[0])\n M = int(line[1])\n elif count <= N:\n N_list.append(line)\n else:\n M_list.append(line)\n count+=1\n \n \ndef judge_match(N_l, M_l):\n slide_count = len(N_l[0]) - len(M_l[0]) + 1\n count = 0\n for j in range(slide_count):\n count = 0\n for i in range(len(N_l)):\n if N_l[i][j:j+len(M_l[0])] == M_l[i]:\n count += 1\n if count == len(M_l):\n return count\n return count\n\nm_count = 0\nfor i in range(len(N_list)):\n m_count = judge_match(N_list[i:i+len(M_list)], M_list)\n if m_count == len(M_list):\n print("Yes")\n exit(0)\nprint("No")'] | ['Runtime Error', 'Accepted'] | ['s750503407', 's986624999'] | [3064.0, 3064.0] | [24.0, 24.0] | [723, 827] |
p03804 | u250734103 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["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()\n\nmatch_cnt = 0\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n flag = True\n for y in range(M):\n for x in range(M):\n print(A[y + i][x + j], B[y][x])\n if A[y + i][x + j] != B[y][x]:\n flag = False\n if flag:\n match_cnt += 1\n\nif match_cnt > 0:\n print('Yes')\nelse:\n print('No')", "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()\n\nmatch_cnt = 0\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n flag = True\n for y in range(M):\n if A[y + i][j:j + M] != B[y]:\n flag = False\n if flag:\n match_cnt += 1\n\nif match_cnt > 0:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s983671712', 's263864800'] | [9204.0, 9216.0] | [344.0, 33.0] | [515, 427] |
p03804 | u252805217 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['import sys\n\nn, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\n\ncl = [[] for i in range(n - m + 1)]\nfor i in range(n - m + 1):\n for j in range(m):\n if not a[i].find(b[j]) == -1:\n cl[i].append(j)\nprint(cl)\nfor cs in cl:\n if cs == [0]:\n print("Yes")\n sys.exit()\nfor ci in cl:\n if ci == list(range(m)) * (n - m):\n print("Yes")\n sys.exit()\n\nprint("No")\n', 'import sys\n\nn, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\n\ncl = [[] for i in range(n - m + 1)]\nfor i in range(n - m + 1):\n for j in range(m):\n if not a[i].find(b[j]) == -1:\n cl[i].append(j)\n\nif n == m and cl == [[0]]:\n print("Yes")\n sys.exit()\nelse:\n print("No")\n sys.exit()\n\nfor cs in cl:\n if cs == [0]:\n print("Yes")\n sys.exit()\nfor ci in cl:\n if ci == list(range(m)) * (n - m):\n print("Yes")\n sys.exit()\n\nprint("No")\n', 'from itertools import product as prd\n\nn, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\n\n\nc = n - m + 1\nans = [list(map(lambda l: l[j:j+m], a[i:i+m])) == b for i, j in prd(range(c), range(c))]\nprint("Yes" if any(ans) else "No")\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s738524416', 's974231584', 's866751445'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 26.0] | [450, 538, 275] |
p03804 | u252828980 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['a,b = map(int,input().split())\nli1 = [input() for i in range(a)]\nli2 = [input() for i in range(b)]\n#print(li1,li2)\nfor i in range(a-b+1):\n for j in range(a-b+1):\n flag = True\n for k in range(b):\n if li1[i+k][j:j+b] != li2[k]:\n flag = False\n break\n if flag:\n print("Yes")\n \nprint("No")', 'a,b = map(int,input().split())\nli1 = [input() for i in range(a)]\nli2 = [input() for i in range(b)]\n#print(li1,li2)\nfor i in range(a-b+1):\n for j in range(a-b+1):\n flag = True\n for k in range(b):\n if li1[i+k][j:j+b] != li2[k]:\n flag = False\n break\n if flag:\n print("Yes")\n exit()\nprint("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s077154295', 's291025715'] | [3060.0, 3060.0] | [19.0, 18.0] | [371, 378] |
p03804 | u254871849 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = [int(x) for x in input().split()]\nimg_a = [input() for _ in range(n)]\nimg_b = [input() for _ in range(m)]\n\nfound = False\nfor a in range(n - m + 1):\n border = 0\n isok = True\n while isok and not flag:\n for b in range(m):\n if img_b[b] in img_a[b+a][border:]:\n if b == 0:\n index = img_a[a].index(img_b[0], border)\n current_index = img_a[b+a].index(img_b[b], border)\n if current_index == index:\n continue\n elif current_index > index:\n border = current_index\n break\n else:\n border = index\n break\n else: # if not substring in string.\n isok = False\n break\n\n else: # if not loop broken.\n ans = "Yes"\n found = True\n break\n if found:\n break\nelse: # if not \'found==True\' even after last loop, then it means B is not in A.\n ans = "No"\n \nprint(ans)', "import sys\nimport numpy as np\n\nn, m = map(int, sys.stdin.readline().split())\nA = np.array([list(sys.stdin.readline().rstrip()) for _ in range(n)], dtype='U1')\nB = np.array([list(sys.stdin.readline().rstrip()) for _ in range(m)], dtype='U1')\n\ndef main():\n \n for i in range(n - m + 1):\n for j in range(n - m + 1):\n if np.all(A[i:i+m, j:j+m] == B):\n return 'Yes'\n return 'No'\n\nif __name__ == '__main__':\n ans = main()\n print(ans)"] | ['Runtime Error', 'Accepted'] | ['s104054555', 's320318707'] | [3064.0, 12516.0] | [18.0, 166.0] | [1060, 474] |
p03804 | u259334183 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import sys\nn,m=map(int,input().split())\na=[]\nb=[]\nfor x in range(n):\n a.append(input())\nfor y in range(m):\n b.append(input())\nfor z in range(n-m+1):\n k=0\n l=0\n for w in range(n-m+1):\n if (a[w])[z:z+m]==b[k]:\n l+=1\n k+=1\n if l==m:\n print('Yes')\n sys.exit()\n print(a[w][z:z+m])\nelse:\n print('No')", "import sys\nn,m=map(int,input().split())\na=[]\nb=[]\nfor x in range(n):\n a.append(input())\nfor y in range(m):\n b.append(input())\nfor z in range(n-m+1):\n k=0\n l=0\n for w in range(n-m+1):\n if (a[w])[z:z+m]==b[k]:\n l+=1\n k+=1\n if l==m:\n print('Yes')\n sys.exit()\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s654136266', 's560858015'] | [3188.0, 3064.0] | [18.0, 18.0] | [389, 362] |
p03804 | u265506056 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import numpy as np\n\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\nbl = False\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 bl = True\n\nanswer = 'Yes' if bl else 'No'\nprint(answer)\nprint(A,B)", 'import numpy as np\n\nN,M = map(int,input().split())\nA = np.array([list(input()) for _ in range(N)])\nB = np.array([list(input()) for _ in range(M)])\nans="No"\nbl = False\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 ans="Yes"\n break\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s694844672', 's261109679'] | [27012.0, 27256.0] | [125.0, 125.0] | [327, 308] |
p03804 | u267300160 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['import numpy as np\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)])\nfor i in range(N):\n for j in range(N):\n check = A[i:i+M,j:j+M]\n print(check)\n if (check == B).all():\n print("Yes")\n exit()\nprint("No")\n', 'import numpy as np\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)])\nfor i in range(N):\n for j in range(N):\n check = A[i:i+M,j:j+M]\n if check.shape != (M,M):\n continue\n if (check==B).all():\n print("Yes")\n exit()\nprint("No")\n'] | ['Runtime Error', 'Accepted'] | ['s154811807', 's628854715'] | [12444.0, 12440.0] | [180.0, 167.0] | [327, 358] |
p03804 | u270681687 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\n\n\nfor i in range(n-m+1):\n for j in range(n-m)+1:\n flag = 0\n for k in range(m):\n for l in range(m):\n if a[i + k][j + l] != b[k][l]:\n flag = 1\n if flag == 0:\n print('Yes')\n exit()\n\n\nprint('No')\n", "n, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\n\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n flag = 0\n for k in range(m):\n for l in range(m):\n if a[i + k][j + l] != b[k][l]:\n flag = 1\n if flag == 0:\n print('Yes')\n exit()\n\n\nprint('No')\n"] | ['Runtime Error', 'Accepted'] | ['s222666787', 's614023156'] | [3060.0, 3060.0] | [18.0, 155.0] | [380, 380] |
p03804 | u277641173 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m=map(int,input().split())\na=[]\nfor i in range(n):\n a.append(input())\nb=[]\nfor i in range(m):\n b.append(input())\n\nres=0\nfor i in range(0,n-m+1):\n keep=0\n for j in range(i,i+m):\n if b[j-i] in a[j]:\n keep+=1\n if keep==m:\n print("Yes")\n res=1\n break\nif res=0:\n print("No")\n', 'n,m=map(int,input().split())\na=[]\nfor i in range(n):\n a.append(input())\nb=[]\nfor i in range(m):\n b.append(input())\n\nres=0\nfor i in range(0,n-m+1):\n for k in range(0,n-m+1):\n keep=0\n for j in range(i,i+m): \n if b[j-i] in a[j][k:k+m]:\n keep+=1\n if keep==m:\n print("Yes")\n res=1\n break\n if res==1:\n break\nif res==0:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s094226194', 's271503546'] | [2940.0, 3064.0] | [17.0, 25.0] | [295, 381] |
p03804 | u282657760 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nans = 'Yes'\ndef match(i, j):\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] != B[k][l]:\n return False\n return True\nfor i in range(N-M+1):\n for j in range(N-M+1):\n if not match(i, j):\n ans = 'No'\n break\nprint(ans)", "N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nans = 'No'\ndef match(i, j):\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] != B[k][l]:\n return False\n return True\nfor i in range(N-M+1):\n for j in range(N-M+1):\n if match(i, j):\n ans = 'Yes'\n break\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s453813637', 's215106093'] | [3064.0, 3064.0] | [17.0, 20.0] | [349, 345] |
p03804 | u282813849 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N,M = [int(a) for a in input().split()]\nA = []\nB = []\nfor i in range(N):\n A.append(input())\nfor i in range(M):\n B.append(input()) \n\nwa = len(A[0])\nwb = len(B[0])\n \nmatched = False\nfor i1 in range(N - M + 1):\n for j1 in range(wa - wb +1):\n cnt = 0\n for i2 in range(M):\n #print(B[i2]," vs ", A[i1+i2][j1:j1+wb])\n if B[i2] == A[i1+i2][j1:j1+wb]:\n cnt += 1\n if cnt == M:\n matched = True\n break\n \n\nif matched:\n print("YES")\nelse:\n print("NO")\n ', 'N,M = [int(a) for a in input().split()]\nA = []\nB = []\nfor i in range(N):\n A.append(input())\nfor i in range(M):\n B.append(input()) \n\nwa = len(A[0])\nwb = len(B[0])\n \nmatched = False\nfor i1 in range(N - M + 1):\n for j1 in range(wa - wb +1):\n cnt = 0\n for i2 in range(M):\n #print(B[i2]," vs ", A[i1+i2][j1:j1+wb])\n if B[i2] == A[i1+i2][j1:j1+wb]:\n cnt += 1\n if cnt == M:\n matched = True\n break\n \n\nif matched:\n print("Yes")\nelse:\n print("No")\n '] | ['Wrong Answer', 'Accepted'] | ['s808816935', 's371310755'] | [9188.0, 9088.0] | [31.0, 35.0] | [496, 496] |
p03804 | u288430479 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m = map(int,input().split())\nlist_A = list(input() for i in range(n))\nlist_B = list(input() for i in range(m))\nprint(list_A)\nprint(list_B)\nk = "No"\nfor i in range(n-m+1):\n for t in range(n-m+1):\n if any( list_A[v+i][t:t+m]!=list_B[v] for v in range(m)):\n break\n k = "Yes"\nprint(k)', 'n,m = map(int,input().split())\nlist_A = list(input() for i in range(n))\nlist_B = list(input() for i in range(m))\nt = "No"\nfor i in range(n-m+1):\n for t in range(n-m+1):\n if all(list_A[i][t:t+m+1]==list_B[i][t:t+m+1]):\n print("Yes")', 'n,m = map(int,input().split())\nlist_A = list(input() for i in range(n))\nlist_B = list(input() for i in range(m))\nk = "No"\nfor i in range(n-m+1):\n for t in range(n-m+1):\n if all(list_A[v+i][t:t+m]==list_B[v] for v in range(m)):\n k = "Yes"\n break\nprint(k)\n '] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s608568184', 's736289563', 's863160941'] | [3060.0, 3064.0, 3060.0] | [17.0, 18.0, 19.0] | [300, 240, 278] |
p03804 | u298297089 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import numpy as np\nN,M = map(int, input().split())\nA = []\nfor i in range(N):\n A.append(input())\nB = []\nfor i in range(M):\n M.append(input())\nA = np.array(A)\nB = np.array(B)\n\nfor i in range(N-M):\n for j in range(N-M):\n if A[i:i+M, j:j+M] == B:\n print('Yes')\n exit()\nprint('No')", "import numpy as np\nN,M = map(int, input().split())\nA = []\nfor i in range(N):\n A.append(input())\nB = []\nfor i in range(M):\n M.append(input())\nA = np.array(A)\nB = np.array(B)\n\nfor i in range(N-M):\n for j in range(N-M):\n if A[i:i+M][j:j+M] == B:\n print('Yes')\n exit()\nprint('No')", "N,M = map(int, input().split())\nA = []\nfor i in range(N):\n A.append(input())\nB = []\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 tmp = [A[i+k][j:j+M] for k in range(M)]\n if tmp == B:\n print('Yes')\n exit()\nprint('No')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s543088504', 's600899812', 's561346429'] | [12508.0, 12508.0, 3064.0] | [149.0, 149.0, 21.0] | [314, 314, 303] |
p03804 | u324549724 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\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 exit()\nprint("No")\n', 'n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nfor i in range(n-m+1):\n for j in range(n-m+1):\n new = [a[k][j:j+m] for k in range(i, i+m)]\n if new == b:\n print("Yes")\n exit()\nprint("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s934580357', 's297364537'] | [3060.0, 3060.0] | [18.0, 21.0] | [221, 253] |
p03804 | u334712262 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['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):\n for j in range(N-M):\n try:\n for k in range(i, i+M):\n for l in range(l, l+M):\n if A[i+k][j+k] != B[k][l]:\n raise ""\n else:\n print(\'Yes\')\n except:\n print(\'No\')\n ', "N, M = map(int, input().split())\n\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\n\ndef f(i, j):\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] != B[k][l]:\n return False\n return True\n\ndef slv():\n for i in range(N-M+1):\n for j in range(N-M+1):\n if f(i, j):\n return 'Yes'\n return 'No'\nprint(slv())\n \n"] | ['Wrong Answer', 'Accepted'] | ['s260715360', 's429620609'] | [3444.0, 3064.0] | [21.0, 18.0] | [341, 362] |
p03804 | u340781749 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["def solve(n, m, a, b):\n for 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 return True\n return False\n \n\nn, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nprint('Yes' if solve(n, m, a, b) else 'No')", "def solve(n, m, a, b):\n for i in range(n - m + 1):\n for j in range(n - m + 1):\n if [row[j:j+m] for row in a[i:i+m]] == b:\n return True\n return False\n\nn, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nprint('Yes' if solve(n, m, a, b) else 'No')"] | ['Wrong Answer', 'Accepted'] | ['s179336076', 's622724421'] | [3064.0, 3064.0] | [18.0, 20.0] | [293, 307] |
p03804 | u344959886 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['import numpy as np\n\nn,m=map(int,input().split())\na= [list(input()) for i in range(n)] \nb= [list(input()) for i in range(m)] \nna=np.array(a)\n\nsa=n-m+1\n\nfor x in range(sa):\n for y in range(sa):\n\n if na[x:x+m,y:y+m].tolist()==b:\n print("Yes")\nprint("No")', 'import numpy as np\nimport sys\nn,m=map(int,input().split())\na= [list(input()) for i in range(n)] \nb= [list(input()) for i in range(m)] \nna=np.array(a)\n\nsa=n-m+1\n\nfor x in range(sa):\n for y in range(sa):\n\n if na[x:x+m,y:y+m].tolist()==b:\n print("Yes")\n sys.exit()\nprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s306073549', 's323292118'] | [12432.0, 12388.0] | [157.0, 157.0] | [272, 305] |
p03804 | u346395915 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m = map(int,input().split())\nli_a = [list(input()) for _ in range(n)]\nli_b = [list(input()) for _ in range(m)]\n\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n for k in range(m):\n if li_a[i+x][j:j+m] != li_b[x][:]:\n break\n else:\n print("Yes")\n exit()\n \nprint("No")', 'n,m = map(int,input().split())\nli_a = [list(input()) for _ in range(n)]\nli_b = [list(input()) for _ in range(m)]\n\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n for k in range(m):\n if li_a[i+k][j:j+m] != li_b[k][:]:\n break\n else:\n print("Yes")\n exit()\n \nprint("No")'] | ['Runtime Error', 'Accepted'] | ['s123285962', 's615855791'] | [3064.0, 3060.0] | [17.0, 18.0] | [343, 343] |
p03804 | u357949405 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\ndiff = N - M\nfor i in range(diff+1):\n for j in range(diff+1):\n flag = True\n for k in range(M):\n print(A[j+k][i:i+M])\n if not (B[k] in A[j+k][i:i+M]):\n flag = False\n if flag:\n print('Yes')\n exit(0)\n\nprint('No')\n", "N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\ndiff = N - M\nfor i in range(diff+1):\n for j in range(diff+1):\n flag = True\n for k in range(M):\n if not (B[k] in A[j+k][i:i+M]):\n flag = False\n if flag:\n print('Yes')\n exit(0)\n\nprint('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s626871424', 's028205170'] | [3444.0, 3060.0] | [38.0, 24.0] | [391, 358] |
p03804 | u362560965 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = (int(i) for i in input().split())\nA = []\nB = []\nfor i in range(N):\n A.append(input())\nfor i in range(M):\n B.append(input())\n\nfor i in range(N-M+1):\n if B[0] in A[i]:\n pos = A[i].find(B[j])\n flag = 0\n for j in range(M):\n if A[i+j][pos:pos+M] == B[j]:\n pass\n else:\n flag = -1\n break\n if flag = 0:\n print("Yes")\n\nprint("No")', 'import sys\n\nN, M = (int(i) for i in input().split())\nA = []\nB = []\nfor i in range(N):\n A.append(input())\nfor i in range(M):\n B.append(input())\n\nfor i in range(N-M+1):\n if B[0] in A[i]:\n pos = A[i].find(B[0])\n flag = 0\n for j in range(M):\n if A[i+j][pos:pos+M] == B[j]:\n pass\n else:\n flag = -1\n break\n if flag == 0:\n print("Yes")\n sys.exit()\n\nprint("No")'] | ['Runtime Error', 'Accepted'] | ['s140342026', 's380103332'] | [3060.0, 3064.0] | [17.0, 18.0] | [443, 479] |
p03804 | u364741711 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['import sys\n\nn,m=map(int,input().split())\nln=[list(input()) for i in range(n)]\nlm=[list(input()) for i in range(m)]\n\nflg=0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if ln[i][j:j+m]==lm[0][0:]:\n flg=1\n for k in range(m-1):\n if ln[i+k+1][j:j+m]!=lm[k+1][0:]:\n flg=0\n if flg==1:\n print("YES")\n sys.exit()\nprint("NO")\n ', 'import sys\n\nn,m=map(int,input().split())\nln=[list(input()) for i in range(n)]\nlm=[list(input()) for i in range(m)]\n\nflg=0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if ln[i][j:j+m]==lm[0][0:]:\n flg=1\n for k in range(m-1):\n if ln[i+k+1][j:j+m]!=lm[k+1][0:]:\n flg=0\n if flg==1:\n print("Yes")\n sys.exit()\nprint("No")\n '] | ['Wrong Answer', 'Accepted'] | ['s759273548', 's027084160'] | [3064.0, 3064.0] | [18.0, 19.0] | [372, 372] |
p03804 | u366959492 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m=map(int,input().split())\na=[input() for i in range(n)]\nb=[input() for i in range(m)]\nfor i in range(n-m+1):\n for j in range(n-m+1):\n x=[]\n for k in range(m):\n x.append(a[i+k][j+m])\n if x==b:\n print("Yes")\n exit()\nprint("No")\n', 'n,m=map(int,input().split())\na=[input() for i in range(n)]\nb=[input() for i in range(m)]\nfor i in range(n-m+1):\n for j in range(n-m+1):\n x=[]\n for k in range(m):\n x.append(a[i+k][j:j+m])\n if x==b:\n print("Yes")\n exit()\nprint("No")\n'] | ['Runtime Error', 'Accepted'] | ['s341245258', 's251308226'] | [3060.0, 3060.0] | [17.0, 24.0] | [286, 288] |
p03804 | u370331385 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N,M = map(int,input().split())\nA = []\nA_portion = []\nB = []\njudge = 0\n\nif(N < M):\n print('No')\nelse:\n for i in range(N):\n a = input() + '?'*(M)\n A.append(list(a))\n for i in range(M):\n list_dummy = list('?'*(len(a)))\n A.append(list_dummy)\n \n for i in range(M):\n b = input()\n B.append(list(b))\n\n for i in range(N):\n for j in range(M):\n for k in range(M):\n A_portion.append(A[j+k][i:i+M])\n print(j+k,i,i+M-1)\n print(A_portion)\n if(A_portion == B):\n judge = 1\n A_portion = []\n \n if(judge == 1):\n print('Yes')\n else:\n print('No')", "N,M = map(int,input().split())\nA = []\nA_portion = []\nB = []\njudge = 0\n\nif(N < M):\n print('No')\nelse:\n for i in range(N):\n a = input() + '?'*(M)\n A.append(list(a))\n for i in range(M):\n list_dummy = list('?'*(len(a)))\n A.append(list_dummy)\n \n for i in range(M):\n b = input()\n B.append(list(b))\n\n for i in range(N):\n for j in range(N):\n for k in range(M):\n A_portion.append(A[j+k][i:i+M])\n #print(j+k,i,i+M-1)\n #print(A_portion)\n if(A_portion == B):\n judge = 1\n A_portion = []\n \n if(judge == 1):\n print('Yes')\n else:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s407716418', 's330365570'] | [29940.0, 3188.0] | [465.0, 83.0] | [563, 565] |
p03804 | u371467115 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N,M=map(int,input().strip().split(" "))\n\na=[input() for i in range(N)\nb=[input() for i in range(M)]\nN=0\n\nif b[i] in a[i]:\n N+=1\n \nif(N==M):\n print("Yes")\nelse:\n print("No")\n\n', 'N,M=map(int,input().strip().split(" "))\n\na=[]\nb=[]\n\nfor i in range(N):\n a.append(input())\n\nN=0\n\nfor i in range(M):\n b.append(input())\n if(b[i] in a[i]):\n N+=1\n\nif(N==M):\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s947098894', 's857535921'] | [2940.0, 3064.0] | [17.0, 18.0] | [206, 244] |
p03804 | u373047809 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m, *d = open(0).read().split()\nn, m = int(n), int(m)\nr = range(n - m + 1)\nprint(["No","Yes"][all(d[n:] == [t[j:j+m] for t in d[i:i+m]] for i in r for j in r)])', 'n, m, *d = open(0).read().split()\nn, m = int(n), int(m)\nr = range(n - m + 1)\nprint(["No","Yes"][all(d[n:] == [t[j:j+m] for t in d[i:i+m]] for i in r for j in r)::2])', 'n, m, *d = open(0).read().split()\nn, m = int(n), int(m)\nr = range(n - m + 1)\nprint(["No","Yes"][any(d[n:] == [t[j:j+m] for t in d[i:i+m]] for i in r for j in r)])'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s594763716', 's892769384', 's911148572'] | [3060.0, 3060.0, 3060.0] | [17.0, 18.0, 19.0] | [162, 165, 162] |
p03804 | u373304480 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import re\nn,m = map(int, input().split())\na = [input().strip() for i in range(n)]\nb = [input().strip() for i in range(m)]\n\nmc = n-m+1\nans = False\nfor ai in range(0, mc):\n if(ans):\n break\n ind = [x.start() for x in re.finditer(b[0], a[ai])]\n for i in ind:\n if(ans):\n break\n for bi in range(0, mc):\n print(bi,a[ai+bi+1][i:i+m], b[bi+1])\n if(a[ai+bi+1][i:i+m] != b[bi+1]):\n break\n if(bi==mc-1):\n ans = True\nif(ans):\n print('Yes')\nelse:\n print('No')", "import re\nn,m = map(int, input().split())\na = [input().strip() for i in range(n)]\nb = [input().strip() for i in range(m)]\n\nmc = n-m+1\nans = False\nfor ai in range(0, mc):\n if(ans):\n break\n ind = [x.start() for x in re.finditer(b[0], a[ai])]\n if(m==1)and(len(ind)>0):\n ans=True\n break \n for i in ind:\n if(ans):\n break\n for bi in range(1, m):\n if(a[ai+bi][i:i+m] != b[bi]):\n break\n if(bi==m-1):\n ans = True\n break\nif(ans):\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s307141720', 's116881878'] | [3188.0, 3188.0] | [19.0, 20.0] | [493, 510] |
p03804 | u376420711 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = map(int, input().split())\na = []\nb = []\nfor i in range(n):\n a.append(input())\nfor i in range(m):\n b.append(input())\nans = "No"\nprint(a, b)\n\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n if a[i][j] == b[0][0]:\n c = []\n for k in range(m):\n c.append(a[i + k][j:j + m])\n if c == b:\n ans = "Yes"\nprint(ans)\n', 'n, m = map(int, input().split())\na = []\nb = []\nfor i in range(n):\n a.append(input())\nfor i in range(m):\n b.append(input())\nans = "No"\n\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n if a[i][j] == b[0][0]:\n c = []\n for k in range(m):\n c.append(a[i + k][j:j + m])\n if c == b:\n ans = "Yes"\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s326638881', 's691691094'] | [3064.0, 3064.0] | [20.0, 20.0] | [398, 386] |
p03804 | u379794022 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['#!/usr/local/bin python\n# -*- coding: utf-8 -*-\n#\n# ~/PycharmProjects/atcoder/B-TempleteMatching.py\n#\nn, m = map(int, input().split())\na = []\nb = []\nis_contain = True\n\nfor i in range(n):\n a.append(input())\n\nfor i in range(m):\n b.append(input())\n\nprint(a)\nprint(b)\n\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n count = 0\n for k in range(m):\n for l in range(m):\n if a[i+k][j+l] == b[k][l]:\n count += 1\n\n # print(count)\n if count == m*m:\n print("Yes")\n exit()\n\n\nprint("No")\n\n\n', '#!/usr/local/bin python\n# -*- coding: utf-8 -*-\n#\n# ~/PycharmProjects/atcoder/B-TempleteMatching.py\n#\nn, m = map(int, input().split())\na = []\nb = []\nis_contain = True\n\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 k in range(m):\n for l in range(m):\n if a[i+k][j+l] == b[k][l]:\n count += 1\n\n # print(count)\n if count == m*m:\n print("Yes")\n exit()\n\n\nprint("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s385667819', 's212249903'] | [3064.0, 3064.0] | [174.0, 169.0] | [581, 559] |
p03804 | u386819480 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["## ABC 054 b\nimport sys\nimport numpy as np\n\nn,m = (int(_) for _ in input().split())\na = [list(input()) for i in range(n)]\nb = [list(input()) for i in range(m)]\naa = np.array(a)\nbb = np.array(b)\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if (bb[:, :] == aa[i:i+m, j:j+m]):\n print('Yes')\n sys.exit(0)\n\nprint('No')", "## ABC 054 b\nimport sys\nfrom numpy import array as npa\n\nn,m = (int(_) for _ in input().split())\na = npa([list(input()) for i in range(n)])\nb = npa([list(input()) for i in range(m)])\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if ((b[:, :] == a[i:i+m, j:j+m]).all()):\n print('Yes')\n sys.exit(0)\n\nprint('No')"] | ['Runtime Error', 'Accepted'] | ['s980783965', 's624798937'] | [12472.0, 12484.0] | [151.0, 162.0] | [349, 343] |
p03804 | u391731808 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N,M = map(int,input().split())\nA = [input() for _ in [0]*N]\nB = [input() for _ in [0]*M]\nendFlg = False\nfor i in range(N-M):\n for j in range(N-M):\n breakFlg = False\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] != B[k][l]:\n breakFlg = True\n break\n if breakFlg: break\n pass\n else: endFlg = True\n if endFlg: break\nif endFlg:print("Yes")\nelse:print("No")', 'N,M = map(int,input().split())\nA = [input() for _ in [0]*N]\nB = [input() for _ in [0]*M]\nendFlg = False\nfor i in range(N-M+1):\n for j in range(N-M+1):\n breakFlg = False\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] != B[k][l]:\n breakFlg = True\n break\n if breakFlg:break\n else:endFlg=True\n if endFlg: break\n if endFlg: break\nif endFlg:print("Yes")\nelse:print("No")'] | ['Runtime Error', 'Accepted'] | ['s902927997', 's812112886'] | [2940.0, 3064.0] | [17.0, 18.0] | [466, 482] |
p03804 | u393512980 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nfor i in range(0, M - N):\n for j in range(0, M - N):\n if A == B[i:i+N+1][j:j+N+1]:\n flag = True\n if flag:\n break\n if flag:\n break\nif flag:\n print("Yes")\nelse:\n print("No")', 'N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nflag = False\nfor i in range(0, N - M + 1):\n for j in range(0, N - M + 1):\n if B == [x[j:j+M] for x in A[i:i+M]]:\n flag = True\n if flag:\n break\n if flag:\n break\nif flag:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s287976650', 's336472907'] | [3060.0, 3064.0] | [19.0, 21.0] | [291, 321] |
p03804 | u397953026 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m = map(int,input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\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 a[i+k][j:j+m] == b[k]:\n cnt += 1\n if cnt == m:\n print("YES")\n exit()\nprint("NO")', 'n,m = map(int,input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\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 a[i+k][j:j+m] == b[k]:\n cnt += 1\n if cnt == m:\n print("Yes")\n exit()\nprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s706508673', 's116701254'] | [9140.0, 9060.0] | [36.0, 32.0] | [339, 339] |
p03804 | u430223993 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import sys\nn, m = map(int, input().split())\nA = [input() for _ in range(n)]\nB = [input() for _ in range(m)]\ncount = 0\nidx = 0\nposition = []\nfor b in B:\n if idx == 0 and count == 0:\n for i, a in enumerate(A[:-m]):\n if b in a:\n position.append(a.find(b))\n if a.count(b) > 1:\n x = a.find(b)\n for _ in range(a.count(b)-1):\n x = a.find(b, x)\n position.append(x)\n count += 1\n idx = i\n break\n if count == 0:\n print('No')\n sys.exit()\n else:\n for i, a in enumerate(A[idx+1:]):\n for p in position:\n if b == a[p:p + m]:\n break\n print('No')\n sys.exit()\nprint('Yes')", "n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nflag = 0\nfor i in range(n-m+1):\n for j in range(n-m+1):\n c = [x[j:j+m] for x in a[i:i+m]]\n if c == b:\n flag = 1\n break\nprint('Yes') if flag == 1 else print('No')"] | ['Wrong Answer', 'Accepted'] | ['s841386589', 's572674713'] | [3064.0, 3060.0] | [18.0, 20.0] | [847, 297] |
p03804 | u440129511 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n,m=map(int,input().split())\na= [list(input()) for n in range(n)] \nb= [list(input()) for m in range(m)] \nm1=0\nfor i in range(n-m+1): \n for j in range(n-m+1): \n if b[i][j+k]==a[i][j] for k in range(n-m+1):m1+=1\n if m1==m:print('Yes') and exit()\n else:pass\n else:print('No')", "n,m=map(int,input().split())\na= [list(input()) for _ in range(n)] \nb= [list(input()) for _ in range(m)] \nm1=0\nfor i in range(n-m+1): \n for j in range(n-m+1): \n if b[i][j+k]==a[i][j] for k in range(n-m+1):m1+=1\n if m1==m:print('Yes') and exit()\n else:pass\n else:print('No')", "n,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 for j in range(n-m+1):\n a1 = [a[k][j:j+m] for k in range(i,i+m)]\n if a1 == b:\n print('Yes')\n exit()\n\nprint('No')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s805374098', 's961252107', 's104231844'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 21.0] | [340, 340, 283] |
p03804 | u452337391 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['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 a_i in range(N-M):\n if B[0] in A[a_i]:\n \n start = []\n for a_j in range(N-M+1):\n if B[0] == A[a_i][a_j:M+a_j]:\n start.append(a_j)\n print(start)\n for s in start:\n f = True\n for b_i in range(M):\n \n if B[b_i] != A[a_i+b_i][s:s+M]:\n f = False\n if f == True:\n print("Yes")\n exit()\nprint("No")', '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 a_i in range(N-M):\n if B[0] in A[a_i]:\n \n start = []\n for a_j in range(N-M+1):\n if B[0] == A[a_i][a_j:M+a_j]:\n start.append(a_j)\n for s in start:\n f = True\n for b_i in range(M):\n \n if B[b_i] != A[a_i+b_i][s:s+M]:\n f = False\n if f == True:\n print("Yes")\n exit()\nprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s792427964', 's434878122'] | [9192.0, 9164.0] | [29.0, 24.0] | [761, 736] |
p03804 | u454524105 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = map(int, input().split())\na = [[i for i in input()] for _ in range(n)]\nb = [[i for i in input()] for _ in range(m)]\ncom = True\nfor h in range(n-m+1):\n for w in range(n-m+1):\n for hi in range(m):\n for wi in range(m):\n print(a[h+hi][w+wi], b[hi][wi])\n if a[h+hi][w+wi] != b[hi][wi]:\n com = False\n if com:\n print("Yes")\n exit()\n else:\n com = True\nprint("No")', 'n, m = map(int, input().split())\na = [[i for i in input()] for _ in range(n)]\nb = [[i for i in input()] for _ in range(m)]\ncom = True\nfor h in range(n-m+1):\n for w in range(n-m+1):\n for hi in range(m):\n for wi in range(m):\n if a[h+hi][w+wi] != b[hi][wi]:\n com = False\n if com:\n print("Yes")\n exit()\n else:\n com = True\nprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s249078803', 's916509623'] | [5360.0, 3064.0] | [510.0, 137.0] | [479, 431] |
p03804 | u457554982 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['[n,m]=list(map(int,input().split()))\nalist=[]\nblist=[]\ncounter=0\nfor i in range(n):\n alist.append(list(input()))\nfor i in range(m):\n blist.append(list(input()))\nclist=[]\nfor i in range(n-m):\n for j in range(n-m):\n for k in range(m):\n kari=[]\n for l in range(m):\n kari.append(alist[i][j+l])\n clist.append(kari)\n \n if blist==clist:\n counter=1\n break\n\nif counter==1:\n print("Yes")\nelse:\n print("No")', '[n,m]=list(map(int,input().split()))\nalist=[]\nblist=[]\ncounter=0\nfor i in range(n):\n alist.append(list(input()))\nfor i in range(m):\n blist.append(list(input()))\nclist=[]\nif n!=m:\n for i in range(n-m):\n for j in range(n-m):\n for k in range(m):\n kari=[]\n for l in range(m):\n kari.append(alist[i+k][j+l])\n clist.append(kari)\n \n if blist==clist:\n counter=1\n break\n clist=[]\n\nelse:\n if alist==blist:\n counter=1\n\nif counter==1:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s709531815', 's859612087'] | [7412.0, 3064.0] | [106.0, 113.0] | [502, 624] |
p03804 | u459150945 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\nan = [input() for _ in range(n)]\nbn = [input() for _ in range(m)]\nlena = len(an[0])\nlenb = len(bn[0])\ndiff = n-m+1\nflag = False\nfor i in range(diff):\n for j in range(diff):\n print([a[j:diff+j] for a in an[i:diff+i]])\n if [a[j:diff+j] for a in an[i:diff+i]] == bn:\n flag = True\n break\n else:\n continue\n break\nprint('Yes' if flag else 'No')\n", "n, m = map(int, input().split())\nan = [input() for _ in range(n)]\nbn = [input() for _ in range(m)]\ndiff = n-m+1\nflag = False\nfor i in range(diff):\n for j in range(diff):\n if [a[j:m+j] for a in an[i:m+i]] == bn:\n flag = True\nprint('Yes' if flag else 'No')\n"] | ['Wrong Answer', 'Accepted'] | ['s847568910', 's643572059'] | [4852.0, 3060.0] | [58.0, 19.0] | [424, 276] |
p03804 | u459283268 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nexits = False\n\nfor i in range(n):\n for j in range(n):\n for k in range(n):\n match = False\n if a[i][k: k+m] == b[j] and not exits:\n for l in range(1, m):\n if a[i+l][k: k+m] == b[l]:\n match = True\n else:\n match = False\n break\n if match:\n exits = True\n\nprint('Yes' if exits else 'No')\n", "n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nexits = False\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n p = []\n for k in range(m):\n p.append(a[i:i+m][k][j:j+m])\n if p == b:\n exits = True\n\nprint('Yes' if exits else 'No')\n"] | ['Runtime Error', 'Accepted'] | ['s456910412', 's982539396'] | [3064.0, 3060.0] | [18.0, 26.0] | [558, 322] |
p03804 | u461833298 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nlenB = M**2\nflg=False\n\ndef check(i, j):\n cnt=0\n for k in range(M):\n for l in range(M):\n if A[i+k][i+j] == B[k][l]:\n cnt += 1\n if cnt==M**2:\n return True\n \nfor i in range(N-M+1):\n for j in range(N-M+1):\n if A[i][j] == B[0][0]:\n flg = check(i, j)\n \nans='Yes' if flg else 'No'\nprint(ans)", "N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nflg=False\n\ndef check(i, j):\n cnt=0\n for k in range(M):\n for l in range(M):\n if A[i+k][j+l] == B[k][l]:\n cnt += 1\n if cnt==M**2:\n return True\n \nfor i in range(N-M+1):\n for j in range(N-M+1):\n if A[i][j] == B[0][0]:\n flg = check(i, j)\n if flg:\n break\n if flg:\n break\n \nans='Yes' if flg else 'No'\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s198981009', 's521921348'] | [3064.0, 3064.0] | [61.0, 59.0] | [465, 521] |
p03804 | u463655976 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = map(int, input().split())\n\nA = [list(map(int, input())) for _ in range(N)]\nB = [list(map(int, input())) for _ in range(M)]\n\ndef func():\n for i in range(N-M):\n for j in range(N-M):\n if all(A[i+k][j+l] == B[k][l] for k in range(M) for l in range(M)):\n return True\n return False\n\nprint("Yes" if func() else "No")\n\n \n', '\nusing namespace std;\nint main() {\n int N, M;\n cin >> N >> M;\n char A[50][50], B[50][50];\n for(int i=0; i<N; ++i) scanf("%s", &A[i][0]);\n for(int i=0; i<M; ++i) scanf("%s", &B[i][0]);\n for(int Ay=0; Ay<=N-M; ++Ay)for(int Ax=0; Ax<=N-M; ++Ax)\n if([&](int x, int y){\n for(int i = 0, j = 0; i < M; i+= j >= M ? j=0,1 :j++,0)\n if(A[x+i][y+j] != B[i][j]) return 0;\n return 1;\n }(Ax, Ay))\n {\n cout << "Yes" << endl;\n return 0;\n }\n cout << "No" << endl;\n return 0;\n}\n', 'N, M = map(int, input().split())\n\nf = lambda x: 1 if x == "#" else 0\nA = [list(map(f, input())) for _ in range(N)]\nB = [list(map(f, input())) for _ in range(M)]\n\ndef func():\n for i in range(N-M+1):\n for j in range(N-M+1):\n if all(A[i+k][j+l] == B[k][l] for k in range(M) for l in range(M)):\n return True\n return False\n\nprint("Yes" if func() else "No")\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s714221317', 's856678867', 's004943553'] | [3064.0, 2940.0, 3064.0] | [19.0, 17.0, 18.0] | [340, 544, 369] |
p03804 | u468972478 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\nans = "Yes"\nfor i in a:\n for j in b:\n if j not in a:\n ans = "No"\nprint(ans)\n', 'n, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\nfor i in a:\n for j in b:\n if j not in a:\n print("No")\n exit()\nprint("Yes")\n', 'n, m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\nans = "Yes"\nfor i in a:\n for j in b:\n if j not in i:\n ans = "No"\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s219953087', 's469915592', 's153260730'] | [9108.0, 9116.0, 9104.0] | [35.0, 26.0, 27.0] | [182, 186, 182] |
p03804 | u470542271 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\na = [list(input()) for _ in range(n)]\nb = [list(input()) for _ in range(m)]\n\nf = True\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n #check\n for x in range(m):\n for y in range(m):\n if a[x + i][y + j] != b[x][y]:\n f = False\n\nif f:\n print('Yes')\nelse:\n print('No')\n", "n, m = map(int, input().split())\na = [list(input()) for _ in range(n)]\nb = [list(input()) for _ in range(m)]\n\nans = False\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n #check\n f = True\n for x in range(m):\n for y in range(m):\n if a[x + i][y + j] != b[x][y]:\n f = False\n\n if f:\n ans = True\n\nif ans:\n print('Yes')\nelse:\n print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s004630130', 's595843201'] | [3060.0, 3064.0] | [144.0, 148.0] | [373, 433] |
p03804 | u474270503 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N,M=map(int, input().split())\nA=[input() for _ in range(N)]\nB=[input() for _ in range(M)]\n\nfor i in range(N):\n if B[0] in A[i]:\n if all(B[j] in A[i+j] for j in range(1,min(M,N-i)):\n print('Yes')\n exit(0)\nprint('No')\n", "N,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 for j in range(N-M+1):\n t=[k[j:j*m] for k in a[i:i+m]]\n if t==B:\n print('Yes')\n exit()\nprint('No')\n", "N,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 for j in range(N-M+1):\n t=[k[j:j+m] for k in a[i:i+m]]\n if t==B:\n print('Yes')\n exit()\nprint('No')\n", "N,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 for j in range(N-M+1):\n t=[k[j:j+M] for k in A[i:i+M]]\n if t==B:\n print('Yes')\n exit()\nprint('No')\n"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s093275757', 's405652405', 's634270622', 's096714146'] | [2940.0, 3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0, 20.0] | [248, 253, 253, 253] |
p03804 | u483640741 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m=map(int,input().split())\n\npic1=[]\npic2=[]\n\nfor i in range(n):\n pic1.append(input())\n\nfor j in range(m):\n pic2.append(input())\n\n#print(pic1)\n#print(pic2)\n\nans="No"\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n flag=True\n for k in range(m):\n for l in range(m):\n if pic1[i+k][j+l]!=b[k][l]:\n flag=False\n\n if not flag:\n break\n if flag:\n print("Yes")\n exit()\n\nprint("No")\n\n', 'n,m=map(int,input().split())\n\npic1=[]\npic2=[]\n\nfor i in range(n):\n pic1.append(input())\n\nfor j in range(m):\n pic2.append(input())\n\n#print(pic1)\n#print(pic2)\n\nans="No"\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n flag=True\n for k in range(m):\n for l in range(m):\n if pic1[i+k][j+l]!=pic2[k][l]:\n flag=False\n\n if not flag:\n break\n if flag:\n print("Yes")\n exit()\n\nprint("No")\n'] | ['Runtime Error', 'Accepted'] | ['s005426253', 's831827968'] | [3064.0, 3064.0] | [17.0, 23.0] | [498, 500] |
p03804 | u488127128 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["h,w = map(int, input().split())\nS = ['.' + input() + '.' for _ in range(h)]\nS.insert(0,'.'*(w+2))\nS.append('.'*(w+2))\n\nfor r in range(1, h+1):\n for c in range(1, w+1):\n if S[r][c] == '#':\n print('#', end='')\n continue\n else:\n count = 0\n count += S[r-1][c-1:c+2].count('#')\n count += S[r][c-1:c+2].count('#')\n count += S[r+1][c-1:c+2].count('#')\n print(count, end='')\n print()", "import sys\n\ndef solve():\n n,m = map(int, sys.stdin.readline().split())\n A = [sys.stdin.readline().rstrip() for _ in range(n)]\n B = [sys.stdin.readline().rstrip() for _ in range(m)]\n for r in range(n-m+1):\n for c in range(n-m+1):\n X = []\n for i,a in enumerate(A[r:r+m]):\n if a[c:c+m] != B[i]:\n break\n else:\n print('Yes')\n exit()\n print('No')\n\nif __name__ == '__main__':\n solve()"] | ['Wrong Answer', 'Accepted'] | ['s159828648', 's379412685'] | [3444.0, 3064.0] | [21.0, 17.0] | [472, 499] |
p03804 | u488497128 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['import sys\nimport os\n\ndef is_same(a, b):\n for i in range(len(a)):\n if a[i] != b[i]:\n return False\n return True\n\nN, M = list(map(lambda x: int(x), sys.stdin.readline().strip().split(" ")))\n\nA = []\nB = []\n\nfor _ in range(N):\n A.append(sys.stdin.readline().strip())\n\nfor _ in range(M):\n B.append(sys.stdin.readline().strip())\n\nit = N - M + 1\n\nfor i in range(it):\n for j in range(it):\n if is_same(A[i:i+M][j:j+M], B):\n print("Yes")\n sys.exit(0)\nprint("No")', 'import sys\nimport os\n\ndef is_same(a, b):\n for i in range(len(a)):\n if a[i] != b[i]:\n return False\n return True\n\nN, M = list(map(lambda x: int(x), sys.stdin.readline().strip().split(" ")))\n\nA = []\nB = []\n\nfor _ in range(N):\n A.append(sys.stdin.readline().strip())\n\nfor _ in range(M):\n B.append(sys.stdin.readline().strip())\n\nit = N - M + 1\n\nfor i in range(it):\n for j in range(it):\n a = list(map(lambda x: x[j:j+M], A[i:i+M]))\n if is_same(a, B):\n print("Yes")\n sys.exit(0)\nprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s498005094', 's153648114'] | [3064.0, 3064.0] | [18.0, 22.0] | [514, 552] |
p03804 | u497046426 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nflag = False\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n if [r[j: j+M] for r in A[i: i+M]] == B:\n flag = True\n break\n if flag:\n break\nprint('YES' if flag else 'NO')", "N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nflag = False\nfor i in range(N - M + 1):\n for j in range(N - M + 1):\n if [r[j: j+M] for r in A[i: i+M]] == B:\n flag = True\n break\n if flag:\n break\nprint('Yes' if flag else 'No')"] | ['Wrong Answer', 'Accepted'] | ['s825193833', 's204920854'] | [3060.0, 3060.0] | [20.0, 20.0] | [315, 315] |
p03804 | u509661905 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['#!/usr/bin/env python3\n\nimport itertools\n\n\ndef judge(n, m, fig_a, fig_b):\n for dr, dc in itertools.product(range(n - m + 1), repeat=2):\n g = itertools.product(range(m), repeat=2)\n if all(fig_a[r0 + dr][c0 + dc] == fig_b[r0][c0] for r0, c0 in g):\n return True\n return False\n\n\ndef main():\n n, m = (int(x) for x in input().split())\n fig_a = [[c == "#" for c in input()] for _ in range(n)]\n fig_b = [[c == "#" for c in input()] for _ in range(m)]\n print("YES" if judge(n, m, fig_a, fig_b) else "NO")\n\n\nif __name__ == \'__main__\':\n main()\n', '#!/usr/bin/env python3\n\nimport itertools\n\n\ndef judge(n, m, fig_a, fig_b):\n for dr, dc in itertools.product(range(n - m + 1), repeat=2):\n g = itertools.product(range(m), repeat=2)\n if all(fig_a[r0 + dr][c0 + dc] == fig_b[r0][c0] for r0, c0 in g):\n return True\n return False\n\n\ndef main():\n n, m = (int(x) for x in input().split())\n fig_a = [[c == "#" for c in input()] for _ in range(n)]\n fig_b = [[c == "#" for c in input()] for _ in range(m)]\n print("Yes" if judge(n, m, fig_a, fig_b) else "No")\n\n\nif __name__ == \'__main__\':\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s518712952', 's195194315'] | [3064.0, 3064.0] | [20.0, 20.0] | [579, 579] |
p03804 | u518064858 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m=map(int,input().split())\na=[]\nb=[]\nc=0\nfor i in range(n):\n a.append(input())\nfor j in range(m):\n b.append(input())\nfor m in range(len(a)):\n if a[m].find(b[0])!=-1:\n print(1)\n for l in range(len(b)-1):\n if m+l+2>len(a):\n break\n if a[m+l+1][(a[m].find(b[0])):(a[m].find(b[0]))+len(b[l+1]):]!=b[l+1]:\n break\n c+=1\n print(c)\n if c==len(b)-1:\n print("Yes")\n exit()\nprint("No")\n ', 'n,m=map(int,input().split())\na=[]\nb=[]\nc=0\nfor i in range(n):\n a.append(input())\nfor j in range(m):\n b.append(input())\nfor m in range(len(a)):\n if a[m].find(b[0])!=-1:\n for l in range(len(b)-1):\n if m+l+2>len(a):\n break\n if a[m+l+1][(a[m].find(b[0])):(a[m].find(b[0]))+len(b[l+1]):]!=b[l+1]:\n break\n c+=1\n if c==len(b)-1:\n print("Yes")\n exit()\nprint("No")\n '] | ['Wrong Answer', 'Accepted'] | ['s802501349', 's642756110'] | [3064.0, 3064.0] | [18.0, 18.0] | [514, 476] |
p03804 | u520276780 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nflag = False \nfor i in range(n-m+1):\n flag = True\n for k in range(n-m+1):\n for j in range(i,i+m):\n if a[j][k:k+m]!=b[j-i]:\n flag = False\n break\n if not flag:\n break\n if flag:\n break\n#print(i,k,flag) \nprint("Yes" if flag else "No")\n', 'n,m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nflag = False \nfor i in range(n-m+1):\n \n for k in range(n-m+1):\n flag=True\n for j in range(i,i+m):\n #if i==k==3:\n # print(a[j][k:k+m],b[j-i],a[j][k:k+m]==b[j-i],flag)\n if a[j][k:k+m]!=b[j-i]:\n flag = False\n break\n if flag:\n break\n if flag:\n break\n#print(i,k,flag) \nprint("Yes" if flag else "No")\n'] | ['Wrong Answer', 'Accepted'] | ['s608434620', 's090460949'] | [3060.0, 3060.0] | [17.0, 19.0] | [418, 533] |
p03804 | u530786533 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\n\na = []\nfor i in range(n):\n a.append(input())\n\nb = []\nfor i in range(m):\n b.append(input())\n\ndef func(base, target):\n for i in range(n-m+1):\n check = base[i:i+m]\n for j in range(n-m+1):\n check2 = [line[j:j+m] for line in check]\n if check2 == target:\n return print('Yes')\n return print('No')\n\nfunc(a,b)\n", "n, m = map(int, input().split())\n\na = []\nfor i in range(n):\n a.append(input())\n\nb = []\nfor i in range(m):\n b.append(input())\n\ndef func(base, target):\n for i in range(n-m+1):\n check = base[i:i+m]\n for j in range(n-m+1):\n check2 = [line[j:j+m] for line in check]\n if check2 == target:\n return print('Yes')\n return print('No')\n\nfunc(a,b)\n"] | ['Runtime Error', 'Accepted'] | ['s944984518', 's177553861'] | [3188.0, 3064.0] | [18.0, 20.0] | [399, 380] |
p03804 | u539517139 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n,m=map(int,input().split())\nx='No'\na=[input() for _ in range(n)]\nb=[input() for _ in range(m)]\ndef c(i,j):\n global m,global a, global b\n for k in range(m):\n for l in range(m):\n if b[k][l]!=a[i+k][j+l]:\n return 0\n return 1\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if c(i,j)==1:\n x='Yes'\n break\nprint(x)", "n,m=map(int,input().split())\nx='No'\na=[input() for _ in range(n)]\nb=[input() for _ in range(m)]\ndef c(i,j):\n global m\n global a\n global b\n for k in range(m):\n for l in range(m):\n if b[k][l]!=a[i+k][j+l]:\n return 0\n return 1\nfor i in range(n-m+1):\n for j in range(n-m+1):\n if c(i,j)==1:\n x='Yes'\n break\nprint(x)"] | ['Runtime Error', 'Accepted'] | ['s605465886', 's697802272'] | [2940.0, 3316.0] | [17.0, 21.0] | [341, 344] |
p03804 | u540290227 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["n, m = map(int, input().split())\nfor _ in range(n):\n a = list(input())\nfor _ in range(m):\n b = list(input())\nresult = []\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n for k in range(m):\n result.append(a[j+k][i:i+m])\n if b == result:\n print('Yes')\n exit()\n\nprint('No')\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 for i in range(m):\n if b[i] != a[y+i][x:x+m]:\n break\n else:\n print('Yes')\n exit()\nprint('No')"] | ['Wrong Answer', 'Accepted'] | ['s053558775', 's361288185'] | [3188.0, 3064.0] | [22.0, 18.0] | [327, 304] |
p03804 | u552738814 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n,m = map(int,input().split())\n\na_list = []\nb_list = []\nans = "No"\n\nfor i in range(n):\n a_list.append(input())\n\nfor i in range(m):\n b_list.append(input())\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n match = True\n for k in range(m):\n for l in range(m):\n if a_list[i+k][l+j] != b_list[k][l]:\n match = False\n if match:\n ans = "True"\n break\n\nprint(ans)\n', 'n,m = map(int,input().split())\n\na_list = []\nb_list = []\nans = "No"\n\nfor i in range(n):\n a_list.append(input())\n\nfor i in range(m):\n b_list.append(input())\n\nfor i in range(n-m+1):\n for j in range(n-m+1):\n match = True\n for k in range(m):\n for l in range(m):\n if a_list[i+k][l+j] != b_list[k][l]:\n match = False\n if match:\n ans = "Yes"\n break\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s475947126', 's102445989'] | [9212.0, 9100.0] | [117.0, 113.0] | [451, 450] |
p03804 | u557494880 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N,M = int(input())\nA = []\nB = []\nfor i in range(N):\n A.append(input())\nfor i in range(M):\n B.append(input())\nfor i in range(N-M+1):\n for k in range(N-M+1):\n p = 1\n for j in range(i,i+M):\n a = A[j][k:k+M]\n b = B[j-i][k+M]\n if a != b:\n p = 0\n ans += 1\nprint(ans)', "N,M = map(int,input().split())\nA = []\nB = []\nfor i in range(N):\n A.append(input())\nfor i in range(M):\n B.append(input())\nflag = 0\nfor i in range(N-M+1):\n for k in range(N-M+1):\n p = 1\n for j in range(i,i+M):\n a = A[j][k:k+M]\n b = B[j-i]\n if a != b:\n p = 0\n break\n if p == 1:\n flag = 1\n \n\nif flag == 1:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s500855170', 's299786297'] | [3064.0, 3064.0] | [17.0, 19.0] | [338, 451] |
p03804 | u565204025 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['# -*- coding: utf-8 -*-\n\nn,m = map(int,input().split())\na = [i for i in range(n+1)]\nb = [i for i in range(m+1)]\nfor i in range(1,n+1):\n a[i] = list(input())\nfor i in range(1,m+1):\n b[i] = list(input())\nans = True\n\nfor x in range(1,len(a[1])-len(b[1]) + 1 + 1):\n for y in range(1,len(a)-len(b) + 1 + 1):\n for ax in range(1,m+1):\n for ay in range(m):\n if a[ax][ay] != b[ax][ay]:\n ans = False\n break\n else:\n ans = True\n\nprint(ans)\n', '# -*- coding: utf-8 -*-\nn,m = map(int,input().split())\na = [0] * n\nb = [0] * m\nfor i in range(n):\n a[i] = list(input())\nfor i in range(m):\n b[i] = list(input())\n\nans = False\n\nfor i in range(n-m):\n for j in range(n-m):\n match = 0\n for k in range(m):\n for l in range(m):\n if a[k+i][l+j] == b[k][l]:\n match += 1\n if match == m * m:\n ans = True\n\nif n == m:\n match = 0\n for k in range(m):\n for l in range(m):\n if a[k][l] == b[k][l]:\n match += 1\n if match == m * m:\n ans = True\n\nif ans:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s261876039', 's550515735'] | [3064.0, 3064.0] | [29.0, 153.0] | [534, 655] |
p03804 | u572343785 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N,M = map(int,input().split())\n\nA = [[0]]*N\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \ncount = 0 \nfor i in range(N-M+1):\n for j in range(M):\n for k in range(M-N+1):\n if B[j]==A[i][k:k+M]:\n count += 1\n \n if count == M - 1:\n judge = True\n break\n \nif judge == True:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*(N+1)\nA[N] = str("a")*50\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \ncount = 0 \nfor k in range(N-M+1):\n for j in range(M):\n for i in range(M-N+1):\n if B[j]==A[i][k:k+M]:\n count += 1\n \n if count == M - 1:\n judge = True\n break\n \nif judge == True:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*(N+1)\nA[N] = str("a")*50\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \ncount = 0 \nfor i in range(N-M+1):\n for j in range(M-1):\n if B[j]==A[i][i:i+M] and B[j+1]==A[i+1][i:i+M]:\n count += 1\n \n if count == M - 1:\n judge = True\n break\n \nprint(A[N-M][N-M:N])\nif judge == True:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*N\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \n\n\nfor k in range(M-N+1):\n count = 0 \n\n for j in range(M):\n for i in range(N-M+1):\n if B[j]==A[i][k:k+M]:\n count += 1\n \n if count == M:\n judge = True\n break\n \nif judge == True:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*N\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \ncount = 0 \nfor k in range(N-M+1):\n for j in range(M):\n for i in range(M-N+1):\n if B[j]==A[i][k:k+M]:\n count += 1\n \n if count == M - 1:\n judge = True\n break\n \nif judge == True:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*N\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \ncount = 0 \nfor j in range(M):\n for i in range(N-M+1):\n for k in range(M-N+1):\n if B[j]==A[i][k:k+M]:\n count += 1\n \n if count == M:\n judge = True\n break\n \nif judge == True:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*N\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \ncount = 0 \nfor i in range(N-M+1):\n for j in range(M):\n for k in range(M-N+1):\n if B[j]==A[i][k:k+M]:\n count += 1\n \n if count == M:\n judge = True\n break\n \nif judge == True:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*(N+1)\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n \ncount = 0 \nfor i in range(N-M+1):\n for j in range(M):\n if B[j]==A[i][i:i+M] and B[j+1]==A[i+1][i:i+M]:\n count += 1\n \n if count == M - 1:\n print("Yes")\n break\nif count != M-1 or count==0:\n print("No")', 'N,M = map(int,input().split())\n\nA = [[0]]*N\nB = [[0]]*M\n\nfor i in range(N):\n A[i] = input()\nfor j in range(M):\n B[j] = input()\n\njudge = False \n\n\nfor k in range(N-M+1):\n for i in range(N-M+1):\n count = 0\n for j in range(M):\n if B[j]==A[j+i][k:k+M]:\n count += 1\n \n if count == M:\n judge = True\n break\n \nif judge == True:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s010427679', 's100928482', 's140169875', 's216778520', 's237982296', 's280186259', 's444218106', 's670269189', 's628751637'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0, 17.0, 17.0, 17.0, 17.0, 18.0, 23.0] | [464, 487, 497, 514, 464, 472, 472, 416, 516] |
p03804 | u576432509 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['icase=0\nif icase==0:\n n,m=map(int,input().split())\n a=[""]*n\n for i in range(n):\n a[i]=input()\n b=[""]*m\n for i in range(m):\n b[i]=input()\n# n,m=3,2\n# a=[\'#.#\', \'.#.\', \'#.#\']\n# b=[\'#.\', \'.#\']\n for ni in range(n-m+1):\n for nj in range(n-m+1):\n yn=""\n for im in range(m):\n print(a[ni+im][nj:nj+m],b[im])\n if a[ni+im][nj:nj+m]!=b[im]:\n yn="NG"\n break\n if yn=="NG":\n continue\n if yn=="":\n yn="OK"\n break\n if yn=="OK":\n break\n else:\n continue\n if yn=="OK":\n print("Yes")\n else:\n print("No")', 'icase=0\nif icase==0:\n n,m=map(int,input().split())\n a=[""]*n\n for i in range(n):\n a[i]=input()\n b=[""]*m\n for i in range(m):\n b[i]=input()\n# n,m=3,2\n# a=[\'#.#\', \'.#.\', \'#.#\']\n# b=[\'#.\', \'.#\']\n for ni in range(n-m+1):\n for nj in range(n-m+1):\n yn=""\n for im in range(m):\n\n if a[ni+im][nj:nj+m]!=b[im]:\n yn="NG"\n break\n if yn=="NG":\n continue\n if yn=="":\n yn="OK"\n break\n if yn=="OK":\n break\n else:\n continue\n if yn=="OK":\n print("Yes")\n else:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s286569428', 's448842049'] | [3316.0, 3064.0] | [19.0, 18.0] | [746, 748] |
p03804 | u580362735 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["N,M = map(int,input().split())\nN_ = []\nM_ = []\nfor i in range(N):\n N_.append(input())\n \nfor i in range(M):\n M_.append(input())\n\nfor i in range(N-M+1):\n count = 0\n for j in range(N-M+1):\n for k in range(M):\n if N_[i][j:j+M+1] == M_[k]:\n count = count + 1\n if count == M:\n break\n else:\n continue\n break\nif count == M:\n print('Yes')\nelse:\n print('No')", "N,M = map(int,input().split())\nN_ = []\nM_ = []\nfor i in range(N):\n N_.append(input())\n \nfor i in range(M):\n M_.append(input())\n\nfor i in range(N-M+1):\n count = 0\n for j in range(N-M+1):\n for k in range(M):\n if N_[i][j:j+N+1] == M_[k]:\n count = count + 1\n if count == M:\n break\nif count == M:\n print('Yes')\nelse:\n print('No')", "N,M = map(int,input().split())\nN_ = []\nM_ = []\nfor i in range(N):\n N_.append(list(input()))\n \nfor i in range(M):\n M_.append(list(input()))\n\nfor i in range(N-M+1):\n for j in range(N-M+1):\n count = 0\n for p in range(M):\n for q in range(M):\n if N_[i+q][j+p] == M_[p][q]:\n count = count + 1\n if count == M*M:\n break\n else:\n continue\n break\nif count == M*M:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s220552711', 's812252290', 's115699661'] | [3064.0, 3064.0, 3064.0] | [23.0, 22.0, 142.0] | [389, 354, 439] |
p03804 | u588081069 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['N, M = list(map(int, input().split()))\n\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nresult = True\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 s1 = A[i+x][j+y]\n s2 = B[x][y]\n if s1 != s2:\n result = False\n break\n if result is False:\n break\n\nif result is True:\n print("Yes")\nelse:\n print("No")\n', 'N, M = list(map(int, input().split()))\n\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nresult = True\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 s1 = A[i+x][j+y]\n s2 = B[x][y]\n if s1 != s2:\n result = False\n break\n if result is False:\n break\n\nif result is True:\n print("Yes")\nelse:\n print("No")\n', 'N, M = list(map(int, input().split()))\n\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\n\n\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 + k][j : j + M]\n s2 = B[k]\n if s1 != s2:\n break\n else:\n print("Yes")\n\nprint("No")\n', 'N, M = list(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 j in range(N - M + 1):\n result = True\n for x in range(M):\n for y in range(M):\n sA = A[i + x][j + y]\n sB = B[x][y]\n if sA != sB:\n result = False\n break\n if result is False:\n break\n\n if result is True:\n print("Yes")\n exit()\n\nprint("No")\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s327104373', 's635574498', 's679778257', 's003944334'] | [3064.0, 3064.0, 3060.0, 3064.0] | [18.0, 20.0, 20.0, 18.0] | [492, 500, 428, 538] |
p03804 | u590241855 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ['n, m = map(int, input().split())\n\na = [input() for x in range(n)]\nb = [input() for x in range(m)]\n\nball = \'\'.join(b)\n\ndef check():\n for i in range(n):\n if i + m > n:\n continue\n\n for j in range(n):\n if j + m > n:\n continue\n\n aall = ""\n for k in range(m):\n aall += a[i+k][j:j+m]\n\n if aall == ball:\n return True\n\n return False\n\nret = "YES" if check() else "NO"\nprint(ret)\n', 'n, m = map(int, input().split())\n\na = [input() for x in range(n)]\nb = [input() for x in range(m)]\n\nball = \'\'.join(b)\n\ndef check():\n for i in range(n):\n if i + m > n:\n continue\n\n for j in range(n):\n if j + m > n:\n continue\n\n aall = ""\n for k in range(m):\n aall += a[i+k][j:j+m]\n\n if aall == ball:\n return True\n\n return False\n\nret = "Yes" if check() else "No"\nprint(ret)\n'] | ['Wrong Answer', 'Accepted'] | ['s064132040', 's742517367'] | [3064.0, 3064.0] | [21.0, 21.0] | [489, 489] |
p03804 | u594244257 | 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 or black. In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel. The image A is given as N strings A_1,...,A_N. The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N). Similarly, the template image B is given as M strings B_1,...,B_M. The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M). Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images. | ["import functools \n\ndef find_indices(a, b, L):\n \n return [i for i in range(L) if b in a[i:]]\n\ndef solve():\n N,M = map(int, input().split())\n A = [input() for _ in range(N)]\n B = [input() for _ in range(M)]\n idx = 0\n start_pos = []\n for S_a in A:\n indices = find_indices(S_a, B[idx], N)\n \n if indices:\n start_pos.append(set(indices))\n idx += 1\n else:\n start_pos = []\n idx = 0\n \n if idx == M:\n break\n \n # print(start_pos)\n print('Yes' if indices and functools.reduce(lambda a,b:a&b, start_pos) else 'No')", "def solve():\n N,M = map(int, input().split())\n A = [input() for _ in range(N)]\n B = [input() for _ in range(M)]\n idx = 0\n start_pos = {}\n for S_a in A:\n indices = set(find_indices(S_a, B[idx], N))\n if not start_pos:\n start_pos = indices\n else:\n start_pos &= indices\n \n if start_pos:\n idx += 1\n else:\n start_pos = {}\n idx = 0\n \n if idx == M:\n break\n \n print('Yes' if start_pos else 'No')\n \nsolve()", "def find_indices(a, b, L):\n \n return [i for i in range(L) if a[i:].startswith(b)]\n\ndef solve():\n N,M = map(int, input().split())\n A = [input() for _ in range(N)]\n B = [input() for _ in range(M)]\n idx = 0\n start_pos = {}\n for S_a in A:\n indices = set(find_indices(S_a, B[idx], N))\n if not start_pos:\n start_pos = indices\n else:\n start_pos = start_pos&indices\n \n if start_pos:\n idx += 1\n else:\n start_pos = {}\n idx = 0\n \n if idx == M:\n break\n \n print('Yes' if start_pos else 'No')\n \nsolve()"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s520146547', 's641427007', 's415835169'] | [3572.0, 3064.0, 3064.0] | [22.0, 17.0, 18.0] | [675, 549, 687] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.