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
|
---|---|---|---|---|---|---|---|---|---|---|
p03273 | u414558682 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h, w = map(int, input().split())\n\nl = []\nll = [[True for i in range(w)] for j in range(h)]\nfor _ in range(h):\n s = input()\n cells = list(s)\n # print(cells)\n l.append(cells)\n \n# print(l)\n\nfor h_i in range(h):\n flag = True\n for w_i in range(w):\n # print(l[h_i][w_i])\n if l[h_i][w_i] == "#":\n flag = False\n break\n if flag:\n for w_i in range(w):\n ll[h_i][w_i] = False\n\nfor w_i in range(w):\n flag = True\n for h_i in range(h):\n # print(l[h_i][w_i])\n if l[h_i][w_i] == "#":\n flag = False\n break\n if flag:\n for h_i in range(h):\n ll[h_i][w_i] = False\n \n# print(ll)\n\nfor i in range(h):\n lll = []a\n for j in range(w):\n # print(l[i][j])\n if ll[i][j]:\n lll.append(l[i][j])\n if len(lll) > 0:\n print(\'\'.join(lll))', 'h, w = map(int, input().split())\n\nl = []\nll = [[True for i in range(w)] for j in range(h)]\nfor _ in range(h):\n s = input()\n cells = list(s)\n # print(cells)\n l.append(cells)\n \n# print(l)\n\nfor h_i in range(h):\n flag = True\n for w_i in range(w):\n # print(l[h_i][w_i])\n if l[h_i][w_i] == "#":\n flag = False\n break\n if flag:\n for w_i in range(w):\n ll[h_i][w_i] = False\n\nfor w_i in range(w):\n flag = True\n for h_i in range(h):\n # print(l[h_i][w_i])\n if l[h_i][w_i] == "#":\n flag = False\n break\n if flag:\n for h_i in range(h):\n ll[h_i][w_i] = False\n \n# print(ll)\n\nfor i in range(h):\n lll = []a\n for j in range(w):\n # print(l[i][j])\n if ll[i][j]:\n lll.append(l[i][j])\n if len(lll) > 0:\n print(\'\'.join(lll))', 'h, w = map(int, input().split())\n\nl = []\nll = [[True for i in range(w)] for j in range(h)]\nfor _ in range(h):\n s = input()\n cells = list(s)\n # print(cells)\n l.append(cells)\n \n# print(l)\n\nfor h_i in range(h):\n flag = True\n for w_i in range(w):\n # print(l[h_i][w_i])\n if l[h_i][w_i] == "#":\n flag = False\n break\n if flag:\n for w_i in range(w):\n ll[h_i][w_i] = False\n\nfor w_i in range(w):\n flag = True\n for h_i in range(h):\n # print(l[h_i][w_i])\n if l[h_i][w_i] == "#":\n flag = False\n break\n if flag:\n for h_i in range(h):\n ll[h_i][w_i] = False\n \n# print(ll)\n\nfor i in range(h):\n lll = []\n for j in range(w):\n # print(l[i][j])\n if ll[i][j]:\n lll.append(l[i][j])\n if len(lll) > 0:\n print(\'\'.join(lll))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s060889306', 's754551556', 's939909724'] | [9004.0, 8880.0, 9412.0] | [26.0, 23.0, 33.0] | [891, 891, 890] |
p03273 | u426108351 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H, W = map(int, input().split())\ngrid = []\nfor i in range(H):\n line = input()\n for i in range(len(line)):\n if line[i] == '#':\n grid.append(line)\n break\ngridans = [[''] for i in range(len(grid))]\nfor i in range(W):\n flag = 0\n for j in range(len(grid)):\n if grid[j][i] == '#':\n flag = 1\n if flag == 1:\n for j in range(len(grid)):\n gridans[j] += grid[j][i]\nfor i in range(len(gridans)):\n print(gridans[i])\n", "H, W = map(int, input().split())\ngrid = []\nfor i in range(H):\n line = input()\n for i in range(len(line)):\n if line[i] == '#':\n grid.append(line)\n break\ngridans = [[''] for i in range(len(grid))]\nfor i in range(W):\n flag = 0\n for j in range(len(grid)):\n if grid[j][i] == '#':\n flag = 1\n if flag == 1:\n for j in range(len(grid)):\n gridans[j][0] += grid[j][i]\nfor i in range(len(gridans)):\n print(gridans[i][0])\n"] | ['Wrong Answer', 'Accepted'] | ['s515719966', 's719909290'] | [3188.0, 3064.0] | [23.0, 22.0] | [438, 444] |
p03273 | u445226180 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W=map(int,input().split(" "))\n\ndef whitel(gyo):\n ans=0\n for i in range(len(gyo)):\n if gyo[i]=="#":\n ans=1\n break\n return ans\n\nA=[]\nfor i in range(H):\n gyo=input()\n if whitel(gyo)==1:\n A.append(gyo)\n\nfor i in range(len(A)):\n print(A[i])', 'import numpy as np\nH,W=map(int,input().split(" "))\n\ndef white(a):\n ans=0\n for i in range(len(a)):\n if a[i]=="#":\n ans=1\n return ans\n\nA=[]\nfor i in range(H):\n gyo=list(input())\n if white(gyo)==1:\n A.append(gyo)\n\nAnum=np.array(A)\nash=Anum.shape[1]\nfor i in range(ash):\n j=ash-i-1\n if white(Anum[:,j])==0:\n Anum=np.delete(Anum,j,1)\n\nfor i in range(Anum.shape[0]):\n moji=""\n for j in range(Anum.shape[1]):\n moji+=Anum[i,j] \n print(moji)\n'] | ['Wrong Answer', 'Accepted'] | ['s264554119', 's772147863'] | [3064.0, 21504.0] | [18.0, 1299.0] | [291, 509] |
p03273 | u445628522 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W=mamp(int,input().split())\nbd=[]\n\nfor i in range(H):\n bd.append(input())\n\nx=set()\ny=set()\n\nfor i in range(H):\n for j in range(W):\n if bd[i][j]=="#":\n x.add(j)\n y.add(i)\nfor i in y:\n for j in x:\n print(bd[i][j],end="")\n print()', 'H,W=map(int,input().split())\nbd=[]\n\nfor i in range(H):\n bd.append(input())\n\nx=set()\ny=set()\n\nfor i in range(H):\n for j in range(W):\n if bd[i][j]=="#":\n x.add(j)\n y.add(i)\nfor i in y:\n for j in x:\n print(bd[i][j],end="")\n print()'] | ['Runtime Error', 'Accepted'] | ['s265505861', 's775200566'] | [3064.0, 4468.0] | [17.0, 31.0] | [333, 332] |
p03273 | u456416458 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["s = input().split()\n\nh = int(s[0])\nw = int(s[1])\n\nfor i in range(h):\n check = False\n v = input()\n x = list(v)\n for j in range(w):\n if x[j] == '#':\n check = True\n break\n if check:\n print(v)\n", "s = input().split()\n\nh = int(s[0])\nw = int(s[1])\n\nline = []\nrow = []\n\na = [''] * h\n\nfor i in range(h):\n a[i] = input()\n\nfor i in range(h):\n line.append(False)\nfor i in range(w):\n row.append(False)\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] == '#':\n line[i] = True\n row[j] = True\n\nfor i in range(h):\n if line[i]:\n for j in range(w):\n if row[j]:\n print(a[i][j], end='')\n print('')\n\n"] | ['Wrong Answer', 'Accepted'] | ['s108140527', 's436114984'] | [9156.0, 9160.0] | [32.0, 36.0] | [240, 473] |
p03273 | u463655976 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split())\n\nHcnt = [0] * H\nWcnt = [0] * W\n\nL = [list(input()) for _ in range(H)]\n\nfor i, s in enumerate(L):\n for j, c in enumerate(s):\n if c == "#":\n Hcnt[i] += 1\n Wcnt[j] += 1\n\nfor i, s in enumerate(L):\n p = ""\n for j, c in enumerate(s):\n if Hcnt[i] > 0 and Wcnt[j] > 0:\n p += " {}".format(c)\n if p:\n print(p[1:])\n', 'H, W = map(int, input().split())\n\nHcnt = [0] * H\nWcnt = [0] * W\n\nL = [list(input()) for _ in range(H)]\n\nfor i, s in enumerate(L):\n for j, c in enumerate(s):\n if c == "#":\n Hcnt[i] += 1\n Wcnt[j] += 1\n\nfor i, s in enumerate(L):\n if Hcnt[i] <= 0:\n continue\n for j, c in enumerate(s):\n if Wcnt[j] > 0:\n print(c, end="")\n print()\n'] | ['Wrong Answer', 'Accepted'] | ['s599884884', 's900032021'] | [3064.0, 4596.0] | [25.0, 31.0] | [365, 353] |
p03273 | u464912173 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | [" h, w = map(int, input().split())\n a = []\n for _ in range(h):\n l = input()\n if l != '.'*w:\n a.append(l)\n col = []\n h = len(a)\n for i in range(w):\n if a[0][i] == '.':\n for j in range(1,h):\n if a[j][i] != '.':\n col.append(i)\n break\n else:\n col.append(i)\n for l in a:\n ll = ''\n for i in col:\n ll += l[i]\n print(ll)\n\nh, w = map(int, input().split())\na = []\nfor _ in range(h):\n l = input()\n if l != '.'*w:\n a.append(l)\ncol = []\nh = len(a)\nfor i in range(w):\n if a[0][i] == '.':\n for j in range(1,h):\n if a[j][i] != '.':\n col.append(i)\n break\n else:\n col.append(i)\nfor l in a:\n ll = ''\n for i in col:\n ll += l[i]\n print(ll)", "h, w = map(int, input().split())\na = []\nfor _ in range(h):\n l = input()\n if l != '.'*w:\n a.append(l)\ncol = []\nh = len(a)\nfor i in range(w):\n if a[0][i] == '.':\n for j in range(1,h):\n if a[j][i] != '.':\n col.append(i)\n break\n else:\n col.append(i)\nfor l in a:\n ll = ''\n for i in col:\n ll += l[i]\n print(ll)"] | ['Runtime Error', 'Accepted'] | ['s117245867', 's684874090'] | [2940.0, 3064.0] | [17.0, 20.0] | [874, 394] |
p03273 | u466331465 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W = [int(x) for x in input().split()]\nans = []\nfor i in range(H):\n cnt= 0\n S = list(input())\n for j in range(W):\n if S[j]==".":\n cnt +=1\n if cnt!=W:\n ans.append(S)\nans1 = []\nfor j in range(len(ans[0])):\n cnt = 0\n for i in range(len(ans)):\n if ans[i][j]==".":\n cnt+=1\n if cnt ==len(ans):\n ans1.append(j)\nfor i in range(len(ans)):\n for j in ans1:\n ans[i][j]=0\nfor i in range(len(ans)):\n for j in range(len(ans[0])):\n if ans[i][j] !=0:\n \tprint(ans[i][j],end"")\n print()', 'H,W = [int(x) for x in input().split()]\nans = []\nfor i in range(H):\n cnt= 0\n S = list(input())\n for j in range(W):\n if S[j]==".":\n cnt +=1\n if cnt!=W:\n ans.append(S)\nans1 = []\nfor j in range(len(ans[0])):\n cnt = 0\n for i in range(len(ans)):\n if ans[i][j]==".":\n cnt+=1\n if cnt ==len(ans):\n ans1.append(j)\nfor i in range(len(ans)):\n for j in ans1:\n ans[i][j]=0\nfor i in range(len(ans)):\n for j in range(len(ans[0])):\n if ans[i][j] !=0:\n \tprint(ans[i][j],end="")\n print()'] | ['Runtime Error', 'Accepted'] | ['s803419516', 's050515898'] | [3064.0, 4596.0] | [18.0, 32.0] | [509, 510] |
p03273 | u477650749 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["def abc():\n h, w = map(int, input().split())\n lines = []\n for i in range(h):\n line = list(input().rstrip())\n if '#' in line:\n lines.append(line)\n\n for x in reversed(range(w)):\n if len([l for l in lines if l[x] == '#']) == 0:\n for l in lines:\n l.pop(x)\n for line in lines:\n print(''.join(line))", "h, w = map(int, input().split())\na = [''] * h\nfor i in range(h):\n\ta[i] = input()\n \nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif a[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n \nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j], end = '')\n\t\tprint()"] | ['Wrong Answer', 'Accepted'] | ['s267519008', 's039839236'] | [3060.0, 4468.0] | [17.0, 30.0] | [373, 319] |
p03273 | u485319545 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h,w=map(int,input().split())\ngrid=[]\nfor _ in range(h):\n grid.append(list(input()))\n\nrow=[]\ncol=[]\n\nfor i in range(h):\n flg=0\n for j in range(w):\n if grid[i][j]=='#':\n flg=1\n\n if flg==0:\n row.append(i)\n\n\nfor j in range(w):\n flg=0\n for i in range(h):\n if grid[i][j]=='#':\n flg=1\n\n if flg==0:\n col.append(j)\n\nans=[]\nfor i in range(h):\n arr=[]\n for j in range(w):\n if i in row or j in col:\n continue\n else:\n arr.append(grid[i][j])\n if len(arr)!=0:\n ans.append(arr)\n\nfor k in ans:\n print(*k)\n", "h,w=map(int,input().split())\ngrid=[]\nfor _ in range(h):\n grid.append(list(input()))\n\nrow=[]\ncol=[]\n\nfor i in range(h):\n flg=0\n for j in range(w):\n if grid[i][j]=='#':\n flg=1\n\n if flg==0:\n row.append(i)\n\n\nfor j in range(w):\n flg=0\n for i in range(h):\n if grid[i][j]=='#':\n flg=1\n\n if flg==0:\n col.append(j)\n\nans=[]\nfor i in range(h):\n arr=[]\n for j in range(w):\n if i in row or j in col:\n continue\n else:\n arr.append(grid[i][j])\n if len(arr)!=0:\n ans.append(arr)\n\nfor k in ans:\n t=''.join(k)\n print(t)\n"] | ['Wrong Answer', 'Accepted'] | ['s162236138', 's303945256'] | [9232.0, 9208.0] | [39.0, 41.0] | [634, 650] |
p03273 | u485566817 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h, w = map(int, input().split())\na = [input() for _ in range(h)]\n\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n for j in range(w):\n if a[i][j] == "#":\n row[i] = True\n col[i] = True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if col[j]:\n print(a[i][j], end = "")\n print()', 'h, w = map(int, input().split())\na = [input() for _ in range(h)]\n\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n for j in range(w):\n if a[i][j] == "#":\n row[i] = True\n col[j] = True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if col[j]:\n print(a[i][j], end = "")\n print()'] | ['Runtime Error', 'Accepted'] | ['s273853460', 's344024044'] | [4468.0, 4468.0] | [31.0, 29.0] | [363, 363] |
p03273 | u488127128 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H,W = map(int, input().split())\nA = [input() for h in range(H)]\nA = [list(a) for a in A if '#' in a]\nprint(A)\nw = 0\nwhile w < W:\n for a in A:\n if a[w]=='#':\n break\n else:\n for a in A:\n a.pop(w)\n W -= 1\n w -= 1\n w += 1\nfor a in A:\n print(''.join(a))", "H,W = map(int,input().split())\nA = []\nfor h in range(H):\n a = input()\n if '#' in a:\n A.append(a)\nA = [a for a in zip(*A) if '#' in a]\nA = [a for a in zip(*A)]\nfor a in A:\n print(''.join(a))"] | ['Wrong Answer', 'Accepted'] | ['s970706249', 's206461248'] | [3316.0, 3188.0] | [19.0, 18.0] | [310, 205] |
p03273 | u492030100 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["def str_del(string,index):\n string = string[:index]+string[index+1:]\n return string\n\n\nH,W=map(int,input().split())\nlines=[]\nfor i in range(H):\n get=input()\n flag=True\n for s in get:\n if s=='#':\n flag=False\n break\n if not flag:\n lines.append(get)\n else:\n H-=1\n\n\n\nfor i in range(W):\n same_flag = True\n\n for s in range(len(lines)):\n #print(lines)\n try:\n if(lines[s][i]=='#'):\n same_flag=False\n break\n except:\n same_flag = False\n break\n\n if same_flag:\n for s in range(len(lines)):\n lines[s]=str_del(lines[s],i)\n #print(lines[s])\n print('deleted')\n\n\nfor i in range(len(lines)):\n print(lines[i])\n\n", "def str_del(string,index):\n string = string[:index]+string[index+1:]\n return string\n\n\n\n\nH,W=map(int,input().split())\nlines=[]\nfor i in range(H):\n get=input()\n flag=True\n for s in get:\n if s=='#':\n flag=False\n break\n if not flag:\n lines.append(get)\n else:\n H-=1\n\n\ni=0\nwhile(i<W):\n same_flag = True\n\n for s in range(len(lines)):\n #print(lines)\n if(lines[s][i]=='#'):\n same_flag=False\n break\n\n\n if same_flag:\n for s in range(len(lines)):\n lines[s]=str_del(lines[s],i)\n\n i-=1\n W-=1\n #print(lines[s])\n #print('deleted')\n\n i+=1\n\n\nfor i in range(len(lines)):\n print(lines[i])\n\n"] | ['Wrong Answer', 'Accepted'] | ['s407938199', 's581829365'] | [3064.0, 3064.0] | [20.0, 20.0] | [787, 743] |
p03273 | u501163846 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\nl=[]\nfor i in range(h):\n l.append(list(map(str,input())))\nprint(l)\n\nrow=[False]*h\ncol=[False]*w\nfor i in range(h):\n for k in range(w):\n if l[i][k]=="#":\n row[i]=True\n col[k]=True\nfor i in range(h):\n if row[i]:\n for k in range(w):\n if col[k]:\n print(l[i][k], end="")\n print("")\n', 'h,w=map(int,input().split())\nl=[]\nfor i in range(h):\n l.append(list(map(str,input())))\n\nrow=[False]*h\ncol=[False]*w\nfor i in range(h):\n for k in range(w):\n if l[i][k]=="#":\n row[i]=True\n col[k]=True\nfor i in range(h):\n if row[i]:\n for k in range(w):\n if col[k]:\n print(l[i][k], end="")\n print("")\n'] | ['Wrong Answer', 'Accepted'] | ['s480833656', 's651833756'] | [4720.0, 4596.0] | [33.0, 32.0] | [384, 375] |
p03273 | u502389123 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H, W = map(int, input().split())\nmaze = [input() for _ in range(H)]\n\nindex_h = []\nindex_w = []\n\nfor i in range(H):\n for j in range(W):\n if maze[i][j] == '#':\n break\n if j == W - 1:\n index_h.append(i)\n\nfor j in range(W):\n for i in range(H):\n if maze[i][j] == '#':\n break\n if i == H - 1:\n index_w.append(j)\n\nfor i in range(H):\n for j in range(W):\n if i in index_h:\n continue\n if j in index_w:\n continue\n print(maze[i][j], end='')", "H, W = map(int, input().split())\nmaze = [input() for _ in range(H)]\n\nindex_h = []\nindex_w = []\n\nfor i in range(H):\n for j in range(W):\n if maze[i][j] == '#':\n break\n if j == W - 1:\n index_h.append(i)\n\nfor j in range(W):\n for i in range(H):\n if maze[i][j] == '#':\n break\n if i == H - 1:\n index_w.append(j)\n\n\nfor i in range(H):\n flag = True\n for j in range(W):\n if i in index_h:\n flag = False\n break\n if j in index_w:\n continue\n print(maze[i][j], end='')\n if flag:\n print()"] | ['Wrong Answer', 'Accepted'] | ['s585102167', 's543656063'] | [4468.0, 4468.0] | [30.0, 31.0] | [551, 619] |
p03273 | u505830998 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['import sys\nimport numpy as np\n\ninput_methods=[\'clipboard\',\'file\',\'key\']\nusing_method=0\ninput_method=input_methods[using_method]\n\ntin=lambda : map(int, input().split())\nlin=lambda : list(tin())\nmod=1000000007\n\n#+++++\n\ndef kk(al):\n\tfor i in range(len(al)-1, -1, -1):\n\t\tif list(al[i]) == [\'.\']*len(al[i]):\n\t\t\tal = np.delete(al, i, 0)\n\treturn al\n\ndef main():\n\t#a = int(input())\n\th, w = tin()\n\t#s = input()\n\tal=[]\n\tfor _ in range(h):\n\t\ts=list(input())\n\t\tal.append(s)\n\tal = np.array(al)\n\tal = kk(al)\n\tal = kk(al.T)\n\tal=al.T\n\tfor v in al:\n\t\tprint(*v)\n\t\t\n\t\n\t\n\t\n#+++++\nisTest=False\n\ndef pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t\ndef input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l\n\nif __name__ == "__main__":\n\tif sys.platform ==\'ios\':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open(\'inputFile.txt\')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\tret = main()\n\tif ret is not None:\n\t\tprint(ret)', 'import sys\nimport numpy as np\n\ninput_methods=[\'clipboard\',\'file\',\'key\']\nusing_method=0\ninput_method=input_methods[using_method]\n\ntin=lambda : map(int, input().split())\nlin=lambda : list(tin())\nmod=1000000007\n\n#+++++\n\ndef kk(al):\n\tfor i in range(len(al)-1, -1, -1):\n\t\tif list(al[i]) == [\'.\']*len(al[i]):\n\t\t\tal = np.delete(al, i, 0)\n\treturn al\n\ndef main():\n\t#a = int(input())\n\th, w = tin()\n\t#s = input()\n\tal=[]\n\tfor _ in range(h):\n\t\ts=list(input())\n\t\tal.append(s)\n\tal = np.array(al)\n\tal = kk(al)\n\tal = kk(al.T)\n\tal=al.T\n\tfor v in al:\n\t\tprint(\'\'.join(v))\n\t\t\n\t\n\t\n\t\n#+++++\nisTest=False\n\ndef pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t\ndef input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l\n\nif __name__ == "__main__":\n\tif sys.platform ==\'ios\':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open(\'inputFile.txt\')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\tret = main()\n\tif ret is not None:\n\t\tprint(ret)'] | ['Wrong Answer', 'Accepted'] | ['s361131628', 's342217082'] | [13224.0, 12532.0] | [163.0, 162.0] | [1090, 1098] |
p03273 | u506287026 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import functools\nimport numpy as np\nH, W = map(int, input().split())\nmat = np.array([list(input()) for _ in range(H)])\n\n\ndef get_bool(x, value, axis):\n return np.where(x == value, True, False).all(axis=axis)\n\n\ncustom_get_bool = functools.partial(mat, '.')\nmat = mat[:, ~custom_get_bool(0)]\nmat = mat[~custom_get_bool(1)]\nprint('\\n'.join([''.join(row) for row in mat]))\n", "import functools\nimport numpy as np\nH, W = map(int, input().split())\nmat = np.array([list(input()) for _ in range(H)])\n\n\ndef get_bool(x, value, axis):\n return np.where(x == value, True, False).all(axis=axis)\n\n\ncustom_get_bool = functools.partial((mat, '.'))\nmat = mat[:, ~custom_get_bool(0)]\nmat = mat[~custom_get_bool(1)]\nprint('\\n'.join([''.join(row) for row in mat]))\n", "import functools\nimport numpy as np\n\n\ndef get_bool(x, value, axis):\n return np.where(x == value, True, False).all(axis=axis)\n\n\nH, W = map(int, input().split())\nmat = np.array([list(input()) for _ in range(H)])\n\ncustom_get_bool = functools.partial(get_bool, mat, '.')\nmat = mat[:, ~custom_get_bool(0)]\nmat = mat[~custom_get_bool(1)]\nprint('\\n'.join([''.join(row) for row in mat]))\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s310204521', 's458854816', 's286282987'] | [12540.0, 13260.0, 12540.0] | [152.0, 164.0, 154.0] | [372, 374, 383] |
p03273 | u513081876 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H, W = map(int, input().split())\na = []\nfor i in range(H):\n a.append(input())\n\n\nfor index, i in enumerate(a):\n if i == '.'*W:\n a.remove('.'*W)\n\n\naa = list(map(list, zip(*a)))\n\n\nfor index, i in enumerate(aa):\n if i == ['.']*len(aa[0]):\n aa.remove(tamesi)\n\naaa = list(map(list, zip(*aa)))\n\nfor i in aaa:\n print(''.join(i))", "H, W = map(int, input().split())\na = []\nans = []\nfor i in range(H):\n a.append(input())\n \n if len(set(a[-1])) == 1 and a[-1][0] == '.':\n del a[-1]\n\nif len(a) == 1:\n kotae = a[0]\n kotae = kotae.replace('.', '')\n print(kotae)\nelse:\n for x in range(W):\n check = []\n for y in range(len(a)):\n\n if a[y][x] != '.':\n break\n else:\n check.append(a[y][x])\n \n if len(check) == len(a):\n ans.append(x)\n \n \n if len(ans) >= 1:\n re_ans = []\n for i in a:\n kari = list(i)\n for j in ans:\n kari[j] = '0'\n # print(kari)\n re_ans.append(kari)\n \n for i in re_ans:\n moji = ''.join(i)\n mojji = moji.replace('0', '')\n print(mojji)\n else:\n for i in a:\n print(i)"] | ['Runtime Error', 'Accepted'] | ['s127729716', 's672836313'] | [3188.0, 3064.0] | [18.0, 19.0] | [346, 915] |
p03273 | u519452411 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w = [int(_) for _ in input().split()]\nboard = [ list(input()) for _ in range(h)]\n\ngoodx = [False] * w\ngoody = [False] * h\n\nfor i in range(w):\n for j in range(h):\n print("i ={}, j ={}".format(i,j))\n if board[i][j] == \'#\':\n goodx[i] = True\n goody[j] = True\n\nfor i in range(w):\n if goodx[i]:\n for j in range(h):\n if goody[j]:\n print(board[i][j], end=\'\')\n print("")', 'h,w = [int(_) for _ in input().split()]\nboard = [ list(input()) for _ in range(h)]\n\ngoodx = [False] * h\ngoody = [False] * w\n\nfor i in range(h):\n for j in range(w):\n# print("i={}\\tj={}\\tboard={}".format(i,j,board[i][j]))\n if board[i][j] == \'#\':\n goodx[i] = True\n goody[j] = True\n\nfor i in range(h):\n if goodx[i]:\n for j in range(w):\n if goody[j]:\n print(board[i][j], end=\'\')\n print("")'] | ['Runtime Error', 'Accepted'] | ['s166017725', 's222692273'] | [4428.0, 4596.0] | [40.0, 30.0] | [400, 421] |
p03273 | u528748570 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split())\na = [""] * H\nfor i in range(H):\n a[i] = input()\n\nrow = [False] * H\ncol = [False] * W\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n row[i] = True\n col[j] = True\nprint(row, col)\n\nfor i in range(H):\n if row[i]:\n for j in range(W):\n if col[j]:\n print(a[i][j], end = "")\n print()\n', 'H, W = map(int, input().split())\na = [""] * H\nfor i in range(H):\n a[i] = input()\n\nrow = [False] * H\ncol = [False] * W\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n row[i] = True\n col[j] = True\n\nfor i in range(H):\n if row[i]:\n for j in range(W):\n if col[j]:\n print(a[i][j], end = "")\n print()\n'] | ['Wrong Answer', 'Accepted'] | ['s502917416', 's537202791'] | [4212.0, 4468.0] | [31.0, 30.0] | [400, 384] |
p03273 | u530383736 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['# -*- coding: utf-8 -*-\nimport pprint\n\nH,W = list(map(int, input().rstrip().split()))\na_list=[list(input().rstrip()) for i in range(H)]\n#-----\n\nrow_del_list=[]\nfor i,v in enumerate(a_list):\n if v.count(".") == W:\n row_del_list.append(i)\n\nfor i in row_del_list[::-1]:\n del a_list[i]\n H -= 1\n\n \ncolumn_del_list=[]\nfor j in range(W):\n cnt_white=0\n for i in range(H):\n if a_list[i][j] == ".":\n cnt_white += 1\n \n if cnt_white == H:\n column_del_list.append(j)\n \nfor j in column_del_list[::-1]:\n #print("j",j)\n for i in range(H):\n del a_list[i][j]\n W -= 1\n\n\nfor row in a_list:\n print(*row)\n', '# -*- coding: utf-8 -*-\nimport pprint\n\nH,W = list(map(int, input().rstrip().split()))\na_list=[list(input().rstrip()) for i in range(H)]\n#-----\n\nrow_del_list=[]\nfor i,v in enumerate(a_list):\n if v.count(".") == W:\n row_del_list.append(i)\n\nfor i in row_del_list[::-1]:\n del a_list[i]\n H -= 1\n\n \ncolumn_del_list=[]\nfor j in range(W):\n cnt_white=0\n for i in range(H):\n if a_list[i][j] == ".":\n cnt_white += 1\n \n if cnt_white == H:\n column_del_list.append(j)\n \nfor j in column_del_list[::-1]:\n for i in range(H):\n del a_list[i][j]\n W -= 1\n\n\nfor row in a_list:\n print(*row,sep="")\n'] | ['Wrong Answer', 'Accepted'] | ['s460815811', 's459063837'] | [4340.0, 5108.0] | [29.0, 30.0] | [672, 661] |
p03273 | u538739837 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\nh,w=map(int,input().split())\n\nicon=[''] * h\nfor i in range(h):\n a[i]=input()\n\n\nrow=[False]*h\ncol=[False]*w\n\nfor i in range(h):\n for j in range(w):\n if icon[i][j]=='#':\n row[i]=True\n col[j]=True\n\nfor i in range(h):\n if row[i]==True:\n for j in range(w):\n if col[j]==True:\n print(icon[i][j],end='')\n print() \n", "import numpy as np\nh,w=map(int,input().split())\nicon=list()\nfor i in range(h):\n icon.append(list(input().split()))\n\nrow=[False]*h\ncol=[False]*w\n\nfor i in range(h):\n for j in range(w):\n if icon[i][j]=='#':\n row[i]=True\n col[j]=True\n\nfor i in range(h):\n if row[i]==True:\n for j in range(w):\n if col[j]==True:\n print(icon[i][j],end='')\n print() ", "import numpy as np\nh,w=map(int,input().split())\n\nicon=[''] * h\nfor i in range(h):\n icon[i]=input()\n\n\nrow=[False]*h\ncol=[False]*w\n\nfor i in range(h):\n for j in range(w):\n if icon[i][j]=='#':\n row[i]=True\n col[j]=True\n\nfor i in range(h):\n if row[i]==True:\n for j in range(w):\n if col[j]==True:\n print(icon[i][j],end='')\n print() "] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s303596438', 's470599443', 's729032599'] | [21652.0, 12392.0, 13788.0] | [320.0, 152.0, 160.0] | [581, 422, 583] |
p03273 | u549383771 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\nh,w = map(int,input().split())\ngraph = [['.' for j in range(w)]for i in range(h)]\n\n\nfor i in range(h):\n tmp = input()\n for j in range(len(tmp)):\n graph[i][j] = tmp[j]\ngraph = np.array(graph)\n\nflag = True\nwhile flag:\n flag = False\n for i in range(graph.shape[1]-1):\n if( graph[:,i] == ['.']*graph.shape[0]).all():\n flag = True\n if i == 0:\n graph = graph[: , 1:]\n break\n \n if i == graph.shape[1] -1:\n graph = graph[:,:i-1]\n break\n \n else:\n graph = np.concatenate([graph[:,:i],graph[:,i+1:] ], 1)\n break\n \n for i in range(graph.shape[0]-1):\n if (graph[i,:] == ['.']*graph.shape[1]).all():\n flag = True\n if i == 0:\n graph = graph[1: , :]\n break\n \n if i == graph.shape[0] -1:\n graph = graph[:i-1,:]\n break\n \n else:\n graph = np.concatenate([graph[:i , :],graph[i+1: , :] ], 0)\n break\n \nfor i in graph:\n print(*i)", "import numpy as np\nh,w = map(int,input().split())\ngraph = [['.' for j in range(w)]for i in range(h)]\n\n\nfor i in range(h):\n tmp = input()\n for j in range(len(tmp)):\n graph[i][j] = tmp[j]\ngraph = np.array(graph)\n\nflag = True\nwhile flag:\n flag = False\n for i in range(graph.shape[1]-1):\n if( graph[:,i] == ['.']*graph.shape[0]).all():\n flag = True\n if i == 0:\n graph = graph[: , 1:]\n break\n \n if i == graph.shape[1] -1:\n graph = graph[:,:i-1]\n break\n \n else:\n graph = np.concatenate([graph[:,:i],graph[:,i+1:] ], 1)\n break\n \n for i in range(graph.shape[0]-1):\n if (graph[i,:] == ['.']*graph.shape[1]).all():\n flag = True\n if i == 0:\n graph = graph[1: , :]\n break\n \n if i == graph.shape[0] -1:\n graph = graph[:i-1,:]\n break\n \n else:\n print(i)\n graph = np.concatenate([graph[:i , :],graph[i+1: , :] ], 0)\n break\n \nfor i in graph:\n print(*i)", 'import numpy as np\nh,w = map(int,input().split())\ngraph = [[\'.\' for j in range(w)]for i in range(h)]\n\n\nfor i in range(h):\n tmp = input()\n for j in range(len(tmp)):\n graph[i][j] = tmp[j]\ngraph = np.array(graph)\n\nflag = True\nwhile flag:\n flag = False\n for i in range(graph.shape[1]):\n if( graph[:,i] == [\'.\']*graph.shape[0]).all():\n flag = True\n if i == 0:\n graph = graph[: , 1:]\n break\n \n if i == graph.shape[1] -1:\n graph = graph[:,:i]\n break\n \n else:\n graph = np.concatenate([graph[:,:i],graph[:,i+1:] ], 1)\n break\n \n for i in range(graph.shape[0]):\n if (graph[i,:] == [\'.\']*graph.shape[1]).all():\n flag = True\n if i == 0:\n graph = graph[1: , :]\n break\n \n if i == graph.shape[0] -1:\n graph = graph[:i,:]\n break\n \n else:\n graph = np.concatenate([graph[:i , :],graph[i+1: , :] ], 0)\n break\n \nfor i in graph:\n print(*i, sep="")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s821775405', 's834366947', 's708362111'] | [13252.0, 13248.0, 13928.0] | [223.0, 221.0, 230.0] | [1222, 1247, 1222] |
p03273 | u556225812 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H, W = map(int, input().split())\nlst = []\nfor i in range(H):\n lst.append(list(input()))\nfor i in range(H-1, -1, -1):\n if '#' not in lst[i]:\n del lst[i]\nfor j in range(W-1, -1, -1):\n cnt = 0\n for i in range(len(lst)):\n if lst[i][j] == '#':\n cnt += 1\n if cnt == 0:\n for i in range(len(lst)):\n del lst[i][j]\nfor i in lst:\n print(*i)", "H, W = map(int, input().split())\nlst = []\nfor i in range(H):\n lst.append(list(input()))\nfor i in range(H-1, -1, -1):\n if '#' not in lst[i]:\n del lst[i]\nfor j in range(W-1, -1, -1):\n cnt = 0\n for i in range(len(lst)):\n if lst[i][j] == '#':\n cnt += 1\n if cnt == 0:\n for i in range(len(lst)):\n del lst[i][j]\nfor i in lst:\n print(''.join(i))"] | ['Wrong Answer', 'Accepted'] | ['s828657369', 's071347019'] | [3828.0, 3064.0] | [22.0, 19.0] | [390, 398] |
p03273 | u569970656 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h, w = map(int, input().split())\na = [[input()] for _ in range(h)]\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n for j in range(w):\n if a[i][j] == '#':\n row[i] = True\n col[j] = True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if col[j]:\n print(a[i][j], end='')\n print()\n", "h, w = map(int, input().split())\na = [[input().split()] for _ in range(h)]\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n for j in range(w):\n if a[i][j] == '#':\n row[i] = True\n col[j] = True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if col[j]:\n print(a[i][j], end='')\n print()\n", "h, w = map(int, input().split())\na = [''] * h\nfor i in range(h):\n\ta[i] = input()\n\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif a[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n\nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j], end = '')\n\t\tprint()\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s003077240', 's417577497', 's664765502'] | [3064.0, 3064.0, 4468.0] | [17.0, 17.0, 31.0] | [363, 371, 318] |
p03273 | u572343785 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\na=[]\nfor i in range(h):\n a.append(input())\nH=[]\nW=[]\nfor i in range(h):\n for j in range(w):\n if a[i][j]=="#":\n H.append(i)\n W.append(j)\nfor j in H:\n ans=[]\n for i in W:\n ans.append(a[j][i])\nprint("".join(ans))\n', 'h,w=map(int,input().split())\na=[]\nfor i in range(h):\n a.append(input())\nH=[]\nW=[]\nfor i in range(h):\n for j in range(w):\n if a[i][j]=="#":\n H.append(i)\n W.append(j)\nH=set(H)\nW=set(W)\nfor j in H:\n ans=[]\n for i in W:\n ans.append(a[j][i])\n print("".join(ans))\n \n'] | ['Wrong Answer', 'Accepted'] | ['s702506156', 's113811202'] | [3316.0, 3316.0] | [2104.0, 23.0] | [287, 314] |
p03273 | u578489732 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["# -*- coding: utf-8 -*-\nH, W = map(int, input().split(' '));\n\nboard = []\nflags = [ True for x in range(W)]\nfor i in range(H):\n line = list(input())\n if ( '#' in line ):\n board.append(line)\n flags = [ f and s == '.' for s,f in zip(line, flags) ]\n\nj = 0\nfor i, flag in enumerate(flags):\n if flag:\n for b in board:\n b.pop(i-j)\n j += 1\nfor b in board:\n print(''.join(b))", "# -*- coding: utf-8 -*-\nimport sys\nH, W = map(int, input().split(' '));\n\nboard = []\nflags = [ True for x in range(W)]\nfor i in range(H):\n line = list(input())\n if ( '#' in line ):\n board.append(line)\n flags = [ f and s == '.' for s,f in zip(line, flags) ]\n\nj = 0\nfor b in board:\n for l,flag in zip(b,flags):\n if not flag:\n sys.stdout.write(l)\n print()"] | ['Runtime Error', 'Accepted'] | ['s349857818', 's901665587'] | [3188.0, 3828.0] | [19.0, 22.0] | [421, 395] |
p03273 | u580404776 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split())\na = [list(input()) for _ in range(H)]\nprint(a)\n\na = list(zip(*[i for i in a if "#" in i]))\nprint(a)\na = list(zip(*[j for j in a if "#" in j]))\nprint(a)\n\nfor n in range(len(a)):\n print("".join(a[n]))', 'H, W = map(int, input().split())\na = [list(input()) for _ in range(H)]\n\na = list(zip(*[i for i in a if "#" in i]))\na = list(zip(*[j for j in a if "#" in j]))\n\nfor n in range(len(a)):\n print("".join(a[n]))'] | ['Wrong Answer', 'Accepted'] | ['s207328873', 's496279722'] | [3384.0, 3188.0] | [20.0, 18.0] | [234, 207] |
p03273 | u581187895 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['import numpy as np\nh, w = map(int, input().split())\n\ngrid = [list(input()) for _ in range(h)]\ngrid = [row for row in grid if row.count(".") != len(row)]\ngrid = [row for row in np.rot90(grid, k=1) if np.count_nonzero(row == ".") != len(row)]\n[print(row) for row in np.rot90(grid, k=-1)]', 'import numpy as np\n\nh, w = map(int, input().split())\ngrid = np.array([[j for j in input()] for i in range(h)])\ngrid = np.array([x for x in grid if "#" in x])\ngrid = np.array([x for x in grid.T if "#" in x])\n\n[print("".join(x)) for x in grid.T]\n\n \n '] | ['Wrong Answer', 'Accepted'] | ['s267297913', 's344918614'] | [12544.0, 12452.0] | [175.0, 160.0] | [285, 252] |
p03273 | u597374218 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\na=[[j for j in input()] for i in range(h)]\nb=[x for x in a if "#" in x]\nc=zip(*[y for y in zip(*b) if "#" in y])\nfor d in zip(*c):print("".join(d))', 'h,w=map(int,input().split())\na=[]\nfor i in range(h):\n x = input()\n if "#" in x:\n a.append(x)\na=list(zip(*a))\nprint(a)\nb=[]\nfor y in a:\n if "#" in y:\n b.append(y)\nb=list(zip(*b))\nprint(b)\nfor c in b:\n print("".join(c))', 'h,w=map(int,input().split())\nfor a in zip(*[y for y in zip(*[x for x in [[j for j in input()] for i in range(h)] if "#" in x]) if "#" in y]):print("".join(a))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s285206606', 's882469173', 's623184663'] | [3316.0, 3444.0, 3188.0] | [19.0, 20.0, 19.0] | [176, 243, 158] |
p03273 | u597509593 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\n\nH, W = list(map(int, input().split()))\narr = np.array([list(input()) for i in range(H)])\narr = arr[(np.apply_along_axis(lambda line: '#' in line, 1, arr))]\narr = arr[:, (np.apply_along_axis(lambda line: '#' in line, 0, arr))]\nprint(arr)\n", "import numpy as np\n\nH, W = list(map(int, input().split()))\narr = np.array([list(input()) for i in range(H)])\narr = arr[(np.apply_along_axis(lambda line: '#' in line, 1, arr))]\narr = arr[:, (np.apply_along_axis(lambda line: '#' in line, 0, arr))]\nfor l in arr.tolist():\n print(''.join(l))\n"] | ['Wrong Answer', 'Accepted'] | ['s135828193', 's698002794'] | [21116.0, 21260.0] | [293.0, 346.0] | [257, 291] |
p03273 | u598229387 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h,w=map(int,input().split())\na=[[i for i in input()] for j in range(h)]\n\nx=[False]*w\ny=[False]*h\n\nfor i in range(h):\n for j in range(w):\n if a[i][j]=='#':\n x[j]=True\n y[i]=True\n\n\nfor i in range(h):\n li=[]\n for j in range(w):\n if x[j]==True and y[i]==True:\n li+=a[i][j]\n if li!=[]:\n print(*li)\n", "h,w=map(int,input().split())\na=[[i for i in input()] for j in range(h)]\n\nx=[False]*w\ny=[False]*h\n\nfor i in range(h):\n for j in range(w):\n if a[i][j]=='#':\n x[j]=True\n y[i]=True\n\n\nfor i in range(h):\n li=[]\n for j in range(w):\n if x[j]==True and y[i]==True:\n li+=a[i][j]\n if li!=[]:\n print(''.join(li))\n"] | ['Wrong Answer', 'Accepted'] | ['s441577540', 's908701158'] | [3828.0, 3064.0] | [28.0, 24.0] | [359, 367] |
p03273 | u614314290 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split())\nSTAGE = [input() for _ in range(H)]\n\n#print("")\n\nccheck = 0\nfor l in STAGE:\n\tif "#" not in l:\n\t\tSTAGE.remove(l)\n\telse:\n\t\tccheck |= int(l.replace("#", "1").replace(".", "0"), 2)\n\n#print(bin(ccheck))\n\nfor l in STAGE:\n\tprint(l)\n\n', 'H, W = map(int, input().split())\nSTAGE = [input() for _ in range(H)]\n\nccheck = 0\nfor i, l in enumerate(STAGE):\n\tccheck |= int(l.replace("#", "1").replace(".", "0"), 2)\n\nfor l in STAGE:\n\tif "#" not in l:\n\t\tcontinue\n\tfor f, c in zip(format(ccheck, "b").zfill(W), l):\n\t\tif "1" == f:\n\t\t\tprint(c, end="")\n\tprint("")\n'] | ['Wrong Answer', 'Accepted'] | ['s018948737', 's337562660'] | [3060.0, 4468.0] | [17.0, 26.0] | [259, 311] |
p03273 | u619144316 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\n\nH,W = map(int,input().split())\nMAP = []\nfor _ in range(H):\n tmp = tuple(input())\n MAP.append(tmp)\n\nMAP = np.array(MAP)\nL = []\nfor i in range(H):\n if all(MAP[i,:] == '.'):\n L.append(i)\n\nMAP = np.delete(MAP,L,0)\n\nL = []\nfor i in range(W):\n if all(MAP[:,i] == '.'):\n L.append(i)\n\nMAP = np.delete(MAP,L,1)\nfor m in MAP:\n print(*m)", "import numpy as np\n \nH,W = map(int,input().split())\nMAP = []\nfor _ in range(H):\n tmp = tuple(input())\n MAP.append(tmp)\n \nMAP = np.array(MAP)\nL = []\nfor i in range(H):\n if all(MAP[i,:] == '.'):\n L.append(i)\n \nMAP = np.delete(MAP,L,0)\nL = []\nfor i in range(W):\n if all(MAP[:,i] == '.'):\n L.append(i)\n \nMAP = np.delete(MAP,L,1)\nfor m in MAP:\n print(''.join(m))\n"] | ['Wrong Answer', 'Accepted'] | ['s503642786', 's458294952'] | [18464.0, 12504.0] | [282.0, 155.0] | [375, 387] |
p03273 | u620238824 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = list(map(int, input().split())) \nA = list(input() for i in range(H)) \n#A = [input() for _ in range(H)]\n\nB = [False] * H\nC = [False] * W\n\nprint(A)\nfor i in range(H):\n for j in range(W):\n if A[i][j] == "#":\n B[i] = True\n C[j] = True\n\nfor i in range(H):\n\tif B[i]:\n\t\tfor j in range(W):\n\t\t\tif C[j]:\n\t\t\t\tprint(A[i][j], end = \'\')\n\t\tprint()', 'H, W = list(map(int, input().split())) \nA = list(input() for i in range(H)) \n#A = [input() for _ in range(H)]\n\nB = [False] * H\nC = [False] * W\n\nfor i in range(H):\n for j in range(W):\n if A[i][j] == "#":\n B[i] = True\n C[j] = True\n\nfor i in range(H):\n\tif B[i]:\n\t\tfor j in range(W):\n\t\t\tif C[j]:\n\t\t\t\tprint(A[i][j], end = \'\')\n\t\tprint()'] | ['Wrong Answer', 'Accepted'] | ['s879725807', 's004018279'] | [4468.0, 4468.0] | [32.0, 30.0] | [413, 404] |
p03273 | u620945921 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h,w=input().split()\ncnt=0\nb=[]\nfor i in range(int(h)):\n a=input()\n if a.count('.') < int(w):\n b.append(a)\n\nfor i in range(len(b)):\n print(b[i])\n\nprint(len(b))\n\nc=[]\nfor j in range(len(b[0])):\n for i in range(len(b)):\n c.append(b[i][j])\n \nprint(c)", "import numpy as np\n\nh,w=input().split()\nh=int(h)\nw=int(w)\n\nlist1 =[input() for i in range(h)]\n#print(list1)\n\nlist2=[]\nfor i in range(h):\n if list1[i].count('#') > 0:\n list2.append(list1[i])\n#print(list2)\nlist2_num=len(list2)\n\nlist4=[]\nfor i in range(list2_num):\n list3=(list(list2[i]))\n list4.append(list3)\n#print(list4)\nlist4=np.array(list4).T\n#print(list4)\n\nlist4=list4.tolist()\nlist5=[]\nfor i in range(w):\n if list4[i].count('#') > 0:\n list5.append(list4[i])\n#print(list5)\n\nlist5=np.array(list5).T\n#print(list5)\nlist5=list5.tolist()\n#print(list5)\nfor i in range(len(list5)):\n for j in range(len(list5[0])):\n print(list5[i][j], end='')\n print('')"] | ['Wrong Answer', 'Accepted'] | ['s942478689', 's318102196'] | [3316.0, 13920.0] | [20.0, 163.0] | [259, 663] |
p03273 | u623601489 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\nlst=list(input() for i in range(h))\nfor a in lst:\n if a=="."*w:\n h-=1\n lst.remove(a)\nfor i in range(w):\n T=True\n if i>w:\n break\n for b in range(h):\n if lst[b][i]!="." :\n T=False\n break\n if T==True:\n for b in range(h):\n lst[b]="".join(list(lst[b]).pop(i))\n w-=1\nfor b in range(h):\n print(lst[b])', 'h,w=map(int,input().split())\nlst=list(input() for i in range(h))\nprint(lst)\nfor a in lst:\n if a=="."*w:\n h-=1\n lst.remove(a)\nfor i in range(w):\n T=True\n if i>w:\n break\n for b in range(h):\n if lst[b][i]!="." :\n T=False\n break\n if T==True:\n for b in range(h):\n lst[b]=lst[b][:i]+lst[b][i+1:]\n w-=1\nfor b in range(h):\n print("".join(lst[b]))', 'h,w=map(int,input().split())\nlst=list(input() for i in range(h))\nn_h=h\nfor i in range(len(lst)):\n if "#" not in lst[h-i-1]:\n n_h-=1\n lst.pop(h-i-1)\nlst=list(map(list,lst))\nfor i in range(w):\n T=True\n for b in range(n_h):\n if lst[b][w-i-1]=="#":\n T=False\n break\n if T:\n for b in range(h):\n lst[b].pop(w-i-1)\nfor b in range(h):\n print("".join(lst[b]))', 'import numpy\nh,w=map(int,input().split())\nlst=list(input() for i in range(h))\nfor a in lst:\n if a=="."*w:\n h-=1\n lst.remove(a)\nlst=numpy.rot90(lst,k=1)\nfor a in lst:\n if a=="."*h:\n lst.remove(a)\nlst=numpy.rot90(lst,k=-1)\nfor b in range(h):\n print(lst[b])\n', 'h,w=map(int,input().split())\nlst=list(input() for i in range(h))\nfor a in lst:\n if a=="."*w:\n h-=1\n lst.remove(a)\nlst=list(map(list,lst))\nfor i in range(w):\n T=True\n if i>w:\n break\n for b in range(h):\n if lst[b][i]!="." :\n T=False\n break\n if T:\n for b in range(h):\n lst[b].pop(i)\n w-=1\nfor b in range(h):\n print("".join(lst[b]))', 'h,w=map(int,input().split())\nlst=list(input() for i in range(h))\nn_h=h\nfor i in range(len(lst)):\n if "#" not in lst[h-i-1]:\n n_h-=1\n lst.pop(h-i-1)\nn_w=w\nlst=list(map(list,lst))\nfor i in range(w):\n T=True\n for b in range(n_h):\n if lst[b][w-i-1]=="#":\n T=False\n break\n if T:\n for b in range(h):\n lst[b].pop(w-i-1)\n n_w-=1\nfor b in range(h):\n print("".join(lst[b]))', 'h,w=map(int,input().split())\nlst=list(input() for i in range(h))\nn_h=h\nfor i in range(len(lst)):\n if "#" not in lst[h-i-1]:\n n_h-=1\n lst.pop(h-i-1)\nlst=list(map(list,lst))\nfor i in range(w):\n T=True\n for b in range(n_h):\n if lst[b][w-i-1]=="#":\n T=False\n break\n if T:\n for b in range(n_h):\n lst[b].pop(w-i-1)\nfor a in lst:\n print("".join(a))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s254680275', 's282366256', 's332367424', 's635934912', 's735116045', 's762771770', 's815602262'] | [3064.0, 3064.0, 3188.0, 12404.0, 3188.0, 3188.0, 3188.0] | [18.0, 18.0, 18.0, 149.0, 18.0, 18.0, 19.0] | [420, 435, 425, 285, 421, 450, 417] |
p03273 | u623687794 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['a,b=map(int,input().split())\nc=[]\nfor i in range(a):\n g=input()\n if "#" not in g:\n continue\n d=list(g)\n c.append(d)\nl=len(c)\np=[]\nfor i in range(b):\n for j in range(l):\n if c[j][i]=="#":\n p.append(i)\n continue\nfor i in range(l):\n for j in range(len(p)):\n if j == len(p)-1:\n print(c[i][p[j]])\n continue\n print(c[i][p[j]],end="")', 'a,b=map(int,input().split())\nc=[]\nfor i in range(a):\n g=input()\n if "#" not in g:\n continue\n d=list(g)\n c.append(d)\nl=len(c)\np=[]\nfor i in range(b):\n for j in range(l):\n if c[j][i]=="#":\n p.append(i)\n break\nfor i in range(l):\n for j in range(len(p)):\n if j == len(p)-1:\n print(c[i][p[j]])\n else:\n print(c[i][p[j]],end="")\n\n'] | ['Wrong Answer', 'Accepted'] | ['s226559341', 's450207911'] | [5616.0, 4596.0] | [1402.0, 32.0] | [365, 361] |
p03273 | u626881915 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w = map(int,input().split())\nmat = []\nfor i in range(h):\n g = list(input().split())\n if g.count(".") != w:\n mat.append(g)\n\nfor i in range(w-1, -1, -1):\n count = 0\n for j in range(len(mat)):\n if mat[j][i] == ".":\n count += 1\n if count == len(mat):\n for j in range(len(mat)):\n mat[j].pop(i)\n\nfor h in range(len(mat)):\n print(" ".join(mat[h]))\n ', 'h,w = map(int,input().split())\nmat = []\nfor i in range(h):\n g = list(input())\n if g.count(".") != w:\n mat.append(g)\n\n\nfor i in range(w-1, -1, -1):\n count = 0\n for j in range(len(mat)):\n if mat[j][i] == ".":\n count += 1\n if count == len(mat):\n for j in range(len(mat)):\n mat[j].pop(i)\n\nfor h in range(len(mat)):\n print(" ".join(mat[h]))\n \n', 'h,w = map(int,input().split())\nmat = []\nfor i in range(h):\n g = list(input())\n if g.count(".") != w:\n mat.append(g)\n\n\nfor i in range(w-1, -1, -1):\n count = 0\n for j in range(len(mat)):\n if mat[j][i] == ".":\n count += 1\n if count == len(mat):\n for j in range(len(mat)):\n mat[j].pop(i)\n\nfor h in range(len(mat)):\n print("".join(mat[h]))\n \n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s437089901', 's714033869', 's463576865'] | [3064.0, 3064.0, 3064.0] | [18.0, 20.0, 20.0] | [372, 366, 365] |
p03273 | u627530854 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['rows, cols = map(int, input().split())\nmat = [input() for _ in range(rows)]\n\nprint_row = [False for _ in range(rows)]\nprint_col = [False for _ in range(cols)]\n\nfor i in range(rows):\n for j in range(cols):\n if mat[i][j] == \'#\':\n print_row[i] = True\n print_col[i] = True\n \nfor i in range(rows):\n for j in range(cols):\n if print_row[i] or print_col[j]:\n print(mat[i][j], end="")\n print()', 'rows, cols = map(int, input().split())\nmat = [input() for _ in range(rows)]\n\nprint_row = [False for _ in range(rows)]\nprint_col = [False for _ in range(cols)]\n\nfor i in range(rows):\n for j in range(cols):\n if mat[i][j] == \'#\':\n print_row[i] = True\n print_col[j] = True\n\nfor i in range(rows):\n print_newline = False\n for j in range(cols):\n if print_row[i] and print_col[j]:\n print(mat[i][j], end="")\n print_newline = True\n if print_newline:\n print()\n'] | ['Runtime Error', 'Accepted'] | ['s531359262', 's571691547'] | [4468.0, 4468.0] | [30.0, 32.0] | [413, 482] |
p03273 | u628965061 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\na=[""]*h\nfor i in range(h):\n\ta[i]=input()\n\nrow=[False]*h\ncol=[False]*w\nfor i in range(h):\n\tfor i in range(w):\n\t\tif a[i][j]=="#":\n\t\t\trow[i]=True\n\t\t\tcol[j]=True\n\t\t\t\nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j],end=\'\')\n\t\t\t\tprint()', 'h,w=map(int,input().split())\na=[""]*h\nfor i in range(h):\n\ta[i]=input()\n\nrow=[False]*h\ncol=[False]*w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif a[i][j]=="#":\n\t\t\trow[i]=True\n\t\t\tcol[j]=True\n\t\t\t\nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j],end=\'\')\n\t\tprint()'] | ['Runtime Error', 'Accepted'] | ['s401412960', 's036768059'] | [3064.0, 4468.0] | [17.0, 32.0] | [295, 293] |
p03273 | u655975843 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h, w = map(int, input().split())\na = []\nfor i in range(h):\n\ta.append(list(input()))\n\n\ntemp1 = []\ntemp2 = []\nfor i in range(len(a)):\n\tff = 0\n\tfor j in range(len(a[i])):\n\t\tif a[i][0] == '.':\n\t\t\tcontinue\n\t\tff = 1\n\tif ff == 0:\n\t\ttemp1.append(i)\ntemp1.sort(reverse=True)\nfor i in range(len(a[0])):\n\tff = 0\n\tfor j in range(len(a)):\n\t\tif a[0][i] == '.':\n\t\t\tcontinue\n\t\tff = 1\n\tif ff == 0:\n\t\ttemp2.append(i)\ntemp2.sort(reverse=True)\nfor i in range(len(temp1)):\n\ta.pop(temp1[i])\nfor i in range(len(temp2)):\n\tfor k in range(len(a)):\n\t\ta[k].pop(temp2[i])\n\nfor i in range(len(a)):\n\ts = ''\n\tfor j in range(len(a[i])):\n\t\ts += a[i][j]\n\tprint(s)\n", "h, w = map(int, input().split())\na = []\nfor i in range(h):\n\ta.append(list(input()))\n\n\ntemp1 = []\ntemp2 = []\nfor i in range(len(a)):\n\tff = 0\n\tfor j in range(len(a[i])):\n\t\tif a[i][j] == '.':\n\t\t\tcontinue\n\t\tff = 1\n\tif ff == 0:\n\t\ttemp1.append(i)\ntemp1.sort(reverse=True)\nfor i in range(len(a[0])):\n\tff = 0\n\tfor j in range(len(a)):\n\t\tif a[j][i] == '.':\n\t\t\tcontinue\n\t\tff = 1\n\tif ff == 0:\n\t\ttemp2.append(i)\ntemp2.sort(reverse=True)\nfor i in range(len(temp1)):\n\ta.pop(temp1[i])\nfor i in range(len(temp2)):\n\tfor k in range(len(a)):\n\t\ta[k].pop(temp2[i])\n\nfor i in range(len(a)):\n\ts = ''\n\tfor j in range(len(a[i])):\n\t\ts += a[i][j]\n\tprint(s)\n"] | ['Wrong Answer', 'Accepted'] | ['s701567674', 's101888884'] | [3188.0, 3188.0] | [23.0, 23.0] | [629, 629] |
p03273 | u657913472 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["f=lambda s:zip(*[t for t in s if'#'in t]);\nfor r in f(f(__import__('sys').stdin)):print(*r)", "f=lambda s:zip(*[t for t in s if'#'in t]);\nfor r in f(f(__import__('sys').stdin)):print(*r,sep='')"] | ['Wrong Answer', 'Accepted'] | ['s069344784', 's060198032'] | [3828.0, 4468.0] | [21.0, 21.0] | [91, 98] |
p03273 | u665038048 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H, W = map(int, input().split())\na = []\nfor i in range(H):\n a.append(input())\nprint(a[0][0])\nrow = [False]*H\ncol = [False]*W\nfor i in range(H):\n for j in range(W):\n if a[i][j] == '#':\n row[i] = True\n col[j] = True\nfor i in range(H):\n if row[i]:\n for j in range(W):\n if col[j]:\n print(a[i][j], end='')\n print()", 'def main():\n num_lines=int(input())\n H,W=[int(j) for j in input().split()]\n list=[]\n for i in range(H):\n for k in input.split():\n list.append(k) ', "H, W = map(int, input().split())\na = []\nfor i in range(H):\n a.append(input())\nrow = [False]*H\ncol = [False]*W\nfor i in range(H):\n for j in range(W):\n if a[i][j] == '#':\n row[i] = True\n col[j] = True\nfor i in range(H):\n if row[i]:\n for j in range(W):\n if col[j]:\n print(a[i][j], end='')\n print()"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s055157274', 's356107733', 's163711230'] | [4468.0, 2940.0, 4468.0] | [30.0, 18.0, 29.0] | [387, 175, 372] |
p03273 | u673338219 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w = map(int,input().split())\na = [""]*h\nfor i in range(h):\n a[i] = input()\n\nrow = [False]*h\ncolumn = [False]*w\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] = "#":\n row[i] = True\n column[j] = True\n\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if column[j]:\n print("a[i][j]",end = "")\n print()\n \n \n \n', 'h,w = map(int,input().split())\na = [""]*h\nfor i in range(h):\n a[i] = input()\n\nrow = [False]*h\ncolumn = [False]*w\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] = "#":\n row[i] = True\n column[j] = True\n\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if column[j]:\n print(a[i][j],end = "")\n print()\n \n \n \n', 'h,w = map(int,input().split())\na = [""]*h\nfor i in range(h):\n a[i] = input()\n\nrow = [False]*h\ncolumn = [False]*w\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] == "#":\n row[i] = True\n column[j] = True\n\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if column[j]:\n print(a[i][j],end = "")\n print()\n \n \n \n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s411589552', 's824391615', 's043658473'] | [2940.0, 3060.0, 4468.0] | [17.0, 17.0, 31.0] | [363, 361, 362] |
p03273 | u686036872 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split())\na = [list(input()) for i in range(H)]\na = list(zip(*[i for i in a if "#" in a]))\na = list(zip(*[i for i in a if "#" in a]))\nfor i in range(len(a)):\n print("".join(a[i]))', 'H, W = map(int, input().split())\na = [list(input()) for i in range(H)]\na = zip(*[i for i in a if "#" in a])\na = zip(*[i for i in a if "#" in a])\nfor i in range(len(a)):\n print("".join(a[i]))', 'H, W = map(int, input().split())\na=[]\nfor i in range(H):\n x = input()\n if "#" in x:\n a.append(list(x))\nb=[i for i in zip(*a)]\nc=[]\nfor i in range(W):\n if "#" in b[i]:\n c.append(b[i])\nc=[i for i in zip(*c)]\nfor i in c:\n print(*i, sep="")'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s805470771', 's983786473', 's047893740'] | [3060.0, 3060.0, 4724.0] | [18.0, 18.0, 21.0] | [205, 193, 262] |
p03273 | u690442716 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import sys\nH_W = list(map(int,input().split()))\nH = H_W[0]\nW = H_W[1]\nb = [[0 for i in range(W)] for j in range(H)]\na = [[str(c) for c in l.strip()] for l in sys.stdin]\n\n\nfor i in range(H):\n for j in range(W):\n if a[i][j] == '#':\n b[i][j] = 1\n\n\nw = [0] * W\nh = [0] * H\nfor i in range(H):\n for j in range(W):\n h[i] = h[i] + b[i][j]\n w[j] = w[j] + b[i][j]\n\n#print(h)\n#print(w)\n\ni = 0\nc = 0\nj = 0\nfor i in range(H):\n if h[i] == 0:\n del a[j]\n H = H - 1\n j = j - 1\n j = j + 1\n#print(a)\n\nk = 0\nfor i in range(W):\n if w[i] == 0:\n for j in range(H):\n del a[j][k]\n print(a)\n W = W - 1\n k = k - 1\n k = k + 1\n#print(a)\n\nfor i in range(H):\n flag = 0\n for j in range(W):\n if flag == 0:\n ans = a[i][j]\n flag = 1\n else:\n ans = ans + a[i][j]\n print(ans)\n ", "import sys\nH_W = list(map(int,input().split()))\nH = H_W[0]\nW = H_W[1]\nb = [[0 for i in range(W)] for j in range(H)]\na = [[str(c) for c in l.strip()] for l in sys.stdin]\n\n\nfor i in range(H):\n for j in range(W):\n if a[i][j] == '#':\n b[i][j] = 1\n\n\nw = [0] * W\nh = [0] * H\nfor i in range(H):\n for j in range(W):\n h[i] = h[i] + b[i][j]\n w[j] = w[j] + b[i][j]\n\n#print(h)\n#print(w)\n\ni = 0\nc = 0\nj = 0\nfor i in range(H):\n if h[i] == 0:\n del a[j]\n H = H - 1\n j = j - 1\n j = j + 1\n#print(a)\n\nk = 0\nfor i in range(W):\n if w[i] == 0:\n for j in range(H):\n del a[j][k]\n W = W - 1\n k = k - 1\n k = k + 1\n#print(a)\n\nfor i in range(H):\n flag = 0\n for j in range(W):\n if flag == 0:\n ans = a[i][j]\n flag = 1\n else:\n ans = ans + a[i][j]\n print(ans)\n "] | ['Wrong Answer', 'Accepted'] | ['s352669475', 's172250419'] | [42868.0, 3316.0] | [568.0, 28.0] | [1067, 1046] |
p03273 | u691018832 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 7)\n\nh, w = map(int, readline().split())\na = [input() for i in range(h)]\nans = []\nmemo_x = []\nmemo_y = []\nfor i in range(h):\n cnt = 0\n print(a[i])\n for j in range(w):\n if a[i][j] == '.':\n cnt += 1\n if cnt == w:\n memo_x.append(i)\nfor i in range(w):\n cnt = 0\n for j in range(h):\n if a[j][i] == '.':\n cnt += 1\n if cnt == h:\n memo_y.append(i)\nfor i in range(h):\n if i not in memo_x:\n b = ''\n for j in range(w):\n if j not in memo_y:\n b += a[i][j]\n ans.append(b)\nfor i in range(len(ans)):\n print(ans[i])\n", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 7)\n\nh, w = map(int, readline().split())\na = [readline().rstrip().decode() for i in range(h)]\nmemo_w = [False] * h\nmemo_h = [False] * w\nfor i in range(h):\n flag = True\n for j in range(w):\n if a[i][j] == '#':\n flag = False\n break\n if flag:\n memo_w[i] = True\nfor i in range(w):\n flag = True\n for j in range(h):\n if a[j][i] == '#':\n flag = False\n break\n if flag:\n memo_h[i] = True\nfor i in range(h):\n if not memo_w[i]:\n ans = ''\n for j in range(w):\n if not memo_h[j]:\n ans += a[i][j]\n print(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s041860846', 's430000786'] | [3064.0, 3064.0] | [24.0, 21.0] | [765, 776] |
p03273 | u698868214 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W = map(int,input().split())\nmass = [list(input()) for _ in range(H)]\n\nfor i in range(H):\n if "#" not in mass[i]:\n mass.pop(i)\n \nH = len(mass)\n\nnew_mass = [[] for _ in range(W)]\n\nfor j in mass:\n for i, k in enumerate(j):\n new_mass[i].append(k)\n \nfor l in range(W):\n if "#" not in new_mass[l]:\n new_mass.pop(l)\n \nmass = [[] for _ in range(H)]\n\nfor n in new_mass:\n for i, m in enumerate(n):\n mass[i].append(m)\n \nprint(mass)', 'H,W = map(int,input().split())\nA = [""] * H\nfor i in range(H):\n A[i] = input()\n \nrow = [False] * H\ncol = [False] * W\n\nfor j in range(H):\n for k in range(W):\n if A[j][k] == "#":\n row[j] = True\n col[k] = True\n \nfor l in range(H):\n if row[l]:\n for m in range(W):\n if col[m]:\n print(A[l][m], end = "")\n print()'] | ['Runtime Error', 'Accepted'] | ['s127518959', 's761477661'] | [9392.0, 9192.0] | [29.0, 32.0] | [449, 346] |
p03273 | u698919163 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W = map(int,input().split())\na = [input() for i in range(H)]\n\ny = [False]*H\nx = [False]*W\n\nfor i in range(H):\n for j in range(W):\n print(a[i][j])\n if a[i][j] == "#":\n y[i] = True\n x[j] = True\n \nfor i in range(H):\n if y[i] == True:\n for j in range(W):\n if x[j] == True:\n print(a[i][j],end="")\n print()', 'H,W = map(int,input().split())\n\na = [input() for i in range(H)]\n\ny = [False]*H\nx = [False]*H\n\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n y[i] == True\n x[j] == True\n \nfor i in range(H):\n if y[i] == True:\n for j in range(W):\n if x[j] == True:\n print(a[i][j],end="")\n print()', 'H,W = map(int,input().split())\n\na = [input() for i in range(H)]\n\ny = [False]*H\nx = [False]*W\n\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n y[i] == True\n x[j] == True\n \nfor i in range(H):\n if y[i] == True:\n for j in range(W):\n if x[j] == True:\n print(a[i][j],end="")\n print()', 'H,W = map(int,input().split())\na = [input() for i in range(H)]\n\ny = [False]*H\nx = [False]*W\n\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n y[i] = True\n x[j] = True\n \nfor i in range(H):\n if y[i] == True:\n for j in range(W):\n if x[j] == True:\n print(a[i][j],end="")\n print()'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s129728741', 's476252147', 's863693628', 's683816146'] | [4720.0, 3064.0, 3064.0, 4468.0] | [36.0, 20.0, 20.0, 30.0] | [395, 375, 375, 372] |
p03273 | u699089116 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['import numpy as np\nh, w = map(int, input().split())\na = [list(input()) for _ in range(h)]\n\na = np.array(a).reshape(h, w)\na = [i for i in a if "#" in i]\n\na = np.array(a).T\na = [i for i in a if "#" in i]\n\na = np.array(a).T\nfor i in a:\n print(*i)\n', 'import numpy as np\nh, w = map(int, input().split())\na = [list(input()) for _ in range(h)]\n\na = np.array(a).reshape(h, w)\nfor i, v in enumerate(a):\n if "#" not in v:\n a = np.delete(a, i, 0)\n\na = np.rot90(a)\nfor i, v in enumerate(a):\n if "#" not in v:\n a = np.delete(a, i, 0)\n\na = np.rot90(a, 3)\nfor i in a:\n print(*i)', 'import numpy as np\nh, w = map(int, input().split())\na = [list(input()) for _ in range(h)]\n\na = np.array(a).reshape(h, w)\na = [i for i in a if "#" in i]\n\na = np.array(a).T\na = [i for i in a if "#" in i]\n\na = np.array(a).T\nfor i in a:\n print("".join(i))\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s683371276', 's919023212', 's495765981'] | [13180.0, 13224.0, 14292.0] | [163.0, 158.0, 162.0] | [247, 339, 255] |
p03273 | u707498674 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['from collections import Counter\nimport numpy as np\nH, W = map(int, input().split())\na = []\nr_idx = []\nc_idx = []\n#a.shape = (H, W)\nfor i in range(H):\n line = list(input())\n ct = Counter(line).most_common()\n if ct[0][1] != W and ct[0][0]==".":\n r_idx.append(i)\n a.append(line)\na = np.array(a).T\n#a.shape = (W, H)\nb = []\nfor i in range(W):\n ct = Counter(a[i]).most_common()\n if ct[0][1] == H and ct[0][0]==".":\n continue\n b.append(a[i])\n\nb = np.array(b).T\nc = []\nfor idx in r_idx:\n c.append(b[idx])\n\nfor i in range(len(c)):\n print("".join(c[i]))\n', 'from collections import Counter\nimport numpy as np\nH, W = map(int, input().split())\na = []\nr_idx = []\nc_idx = []\n#a.shape = (H, W)\nfor i in range(H):\n line = list(input())\n ct = Counter(line).most_common()\n if not (ct[0][1] == W and ct[0][0] == "."):\n r_idx.append(i)\n a.append(line)\na = np.array(a).T\n#a.shape = (W, H)\nb = []\nfor i in range(W):\n ct = Counter(a[i]).most_common()\n if ct[0][1] == H and ct[0][0]==".":\n continue\n b.append(a[i])\n\nb = np.array(b).T\nc = []\nfor idx in r_idx:\n c.append(b[idx])\n\nfor i in range(len(c)):\n print("".join(c[i]))\n'] | ['Wrong Answer', 'Accepted'] | ['s696423369', 's908191064'] | [12500.0, 22412.0] | [160.0, 342.0] | [585, 593] |
p03273 | u716660050 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H,W=map(int,input().split())\nM=[list(input()) for i in range(H)]\nfor i in range(H):\n if not'#'in M[i]:\n s=[]\n for x in range(W):\n t=[M[y][x] for y in range(H)]\n if not'#'in t: s.append(M[i][x])\n print(''.join(s))", "H,W=map(int,input().split())\nM=[list(input()) for i in range(H)]\nfor i in range(H):\n if '#'in M[i]:\n s=[]\n for x in range(W):\n t=[M[y][x] for y in range(H)]\n if '#'in t: s.append(M[i][x])\n print(''.join(s))"] | ['Wrong Answer', 'Accepted'] | ['s173314003', 's323963570'] | [3060.0, 3060.0] | [113.0, 104.0] | [258, 252] |
p03273 | u722189950 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["\nH, W = map(int, input().split())\na = [input() for _ in range(H)]\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif a[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n \nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j], end = '')\n\t\tprint()", "\nH, W = map(int, input().split())\na = [input() for _ in range(H)]\nrow = [False] * H\ncol = [False] * W\nfor i in range(H):\n\tfor j in range(W):\n\t\tif a[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n \nfor i in range(H):\n\tif row[i]:\n\t\tfor j in range(W):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j], end = '')\n\t\tprint()"] | ['Runtime Error', 'Accepted'] | ['s600644893', 's017436302'] | [3064.0, 4468.0] | [17.0, 31.0] | [321, 321] |
p03273 | u726769307 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h,w=map(int,input().split())\na=[[j for j in input()] for i in range(h)]\nfor i in range(h):\n if a[i].count('.')==w:\n a[i]=[]\nwhile [] in a:\n a.remove([])\nfor i in range(w):\n c=0\n for j in range(len(a)):\n if a[j][i]=='.':\n c+=1\n if c==len(a):\n for j in range(len(a)):\n a[j][i]='!'\nfor i in range(len(a)):\n while '!' in a[i]:a\n a[i].remove('!')\nfor i in a:\n print(*i,sep='')", "h,w=map(int,input().split())\na=[[j for j in input()] for i in range(h)]\nfor i in range(h):\n if a[i].count('.')==w:\n a[i]=[]\nwhile [] in a:\n a.remove([])\nfor i in range(w):\n c=0\n for j in range(len(a)):\n if a[j][i]=='.':\n c+=1\n if c==len(a):\n for j in range(len(a)):\n a[j][i]='!'\nfor i in range(len(a)):\n while '!' in a[i]:\n a[i].remove('!')\nfor i in a:\n print(*i,sep='')"] | ['Runtime Error', 'Accepted'] | ['s240411432', 's514263303'] | [3064.0, 4596.0] | [17.0, 23.0] | [400, 399] |
p03273 | u729707098 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w = (int(i) for i in input().split())\na,b = [],["" for i in range(w)]\nfor _ in range(h):\n\ts = input()\n\tif s.count("#")!=0:\n\t\ta.append(s)\n\t\tfor i in range(w): b[i]+=s[i]\nnum,ans = [True for i in range(w)],["" for i in range(len(a))]\nfor i in range(w):\n\tif b[i].count("#")==0: num[i] = False\nfor i in range(len(a)):\n\tfor j in range(w):\n\t\tif num[j]: ans[i]+=a[i][j]\nfor i in ans: print(ans)', 'h,w = (int(i) for i in input().split())\na,b = [],["" for i in range(w)]\nfor _ in range(h):\n\ts = input()\n\tif s.count("#")!=0:\n\t\ta.append(s)\n\t\tfor i in range(w): b[i]+=s[i]\nnum,ans = [True for i in range(w)],["" for i in range(len(a))]\nfor i in range(w):\n\tif b[i].count("#")==0: num[i] = False\nfor i in range(len(a)):\n\tfor j in range(w):\n\t\tif num[j]: ans[i]+=a[i][j]\nfor i in ans: print(i)'] | ['Wrong Answer', 'Accepted'] | ['s904707994', 's904138379'] | [4084.0, 3064.0] | [29.0, 23.0] | [389, 387] |
p03273 | u732870425 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h, w = map(int, input())\na = [list(input()) for i in range(h)]\n\nrow = [False] * h\ncol = [False] * w\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] == "#":\n row[i] = True\n col[j] = True\n\nfor i in range(h):\n if row[i]:\n ans = ""\n for j in range(w):\n if col[j]:\n ans.join(a[i][j])\n print(ans)', 'h, w = map(int, input().split())\na = [list(input()) for i in range(h)]\n\nrow = [False] * h\ncol = [False] * w\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] == "#":\n row[i] = True\n col[j] = True\n\nfor i in range(h):\n if row[i]:\n ans = ""\n for j in range(w):\n if col[j]:\n ans.join(a[i][j])\n if "#" in ans:\n print(ans)', 'h, w = map(int, input().split())\na = [list(input()) for i in range(h)]\n\nrow = [False] * h\ncol = [False] * w\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] == "#":\n row[i] = True\n col[j] = True\n\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if col[j]:\n print(a[i][j], end = "")\n print()'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s146760060', 's575703452', 's728204212'] | [3064.0, 3064.0, 4596.0] | [17.0, 24.0, 31.0] | [376, 411, 394] |
p03273 | u734876600 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w = map(int,input().split())\nli = []\nfor i in range(h):\n a = list(input().split())\n li.append(a)\nli2 = li.copy()\nc = 0\nfor i in range(h):\n for j in range(w):\n c = 0\n if li[i][j] == ".":\n continue\n elif li[i][j] == "#":\n c = 1\n break\n if c == 0:\n li[i] = ["a"] * w\nd = 0\nn = []\nfor i in range(w):\n for j in range(h):\n d = 0\n if li[j][i] == "." or li[j][i] == "a":\n continue\n else:\n d = 1\n break\n if d == 0:\n n.append(i)\nfor i in n:\n for j in range(h):\n li[j][i] = "a"\n\nfor i in range(h):\n grid = ""\n for x in li[i]:\n if x != "a":\n grid += x\n print(grid)', 'h,w = map(int,input().split())\nli = []\nfor i in range(h):\n a = list(input())\n li.append(a)\nli2 = li.copy()\nc = 0\nfor i in range(h):\n for j in range(w):\n c = 0\n if li[i][j] == ".":\n continue\n elif li[i][j] == "#":\n c = 1\n break\n if c == 0:\n li[i] = ["a"] * w\nd = 0\nn = []\nfor i in range(w):\n for j in range(h):\n d = 0\n if li[j][i] == "." or li[j][i] == "a":\n continue\n else:\n d = 1\n break\n if d == 0:\n n.append(i)\nfor i in n:\n for j in range(h):\n li[j][i] = "a"\n\nfor i in range(h):\n grid = ""\n for x in li[i]:\n if x != "a":\n grid += x\n if grid != "":\n print(grid)'] | ['Runtime Error', 'Accepted'] | ['s469898854', 's044212848'] | [3064.0, 3188.0] | [18.0, 23.0] | [731, 746] |
p03273 | u740284863 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h, w = map(int, input().split())\nmaps = []\nfor i in range(h):\n\tmaps.append(str(input()))\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif maps[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n\nfor i in range(h):\n\tif scr[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(maps[i][j], end = '')\n\t\tprint()\n", "h, w = map(int, input().split())\nmaps = []\nfor i in range(h):\n\tmaps.append(str(input()))\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif maps[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n\nfor i in range(h):\n\tif scr[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j], end = '')\n\t\tprint()\n", 'h,w = map(int,input().split())\nM = []\nfor i in range(h):\n k = str(input())\n if "\n M.append(k)\n\nN = []\nfor i in range(w):\n s = ""\n for j in range(len(M)):\n s += M[j][i]\n if "#" not in s:\n N.append(i)\n\nfor i in range(len(N)):\n for j in range(len(M)):\n M[j] = M[j][0:N[i]]+M[j][N[i]+1:]\n \nfor i in range(len(M)):\n print(M[i])', "h, w = map(int, input().split())\nmaps = []\nfor i in range(h):\n\tmaps.append(str(input()))\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif maps[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n\nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(maps[i][j], end = '')\n\t\tprint()\n"] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s079506697', 's511257431', 's963516272', 's934364540'] | [3064.0, 3064.0, 3064.0, 4468.0] | [21.0, 21.0, 20.0, 31.0] | [331, 328, 455, 331] |
p03273 | u741397536 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h, w = map(int, input().split())\n\narr_all = []\narr_del = []\nfor i in range(h):\n arr_w = input()\n if list(set(arr_w)) == ["."]:\n continue\n else:\n arr_all.append(arr_w)\n arr_del.append([])\n\nprint(arr_all)\n\nd = []\nfor i in range(w):\n for j in range(len(arr_all)):\n if arr_all[j][i] == ".":\n if i == w - 1:\n break\n else:\n continue\n else:\n d.append(i)\n break\n\nfor j in range(len(arr_all)):\n for i in d:\n arr_del[j] += arr_all[j][i]\n\nprint(arr_del)\n\nfor i in range(len(arr_all)):\n print(\'\'.join(arr_del[i]))', 'h, w = map(int, input().split())\n\narr_all = []\narr_del = []\nfor i in range(h):\n arr_w = input()\n if list(set(arr_w)) == ["."]:\n continue\n else:\n arr_all.append(arr_w)\n arr_del.append([])\n\n\nd = []\n\nfor i in range(w):\n for j in range(len(arr_all)):\n if arr_all[j][i] == ".":\n if j == w - 1:\n break\n else:\n continue\n else:\n d.append(i)\n break\n\nfor j in range(len(arr_all)):\n for i in d:\n arr_del[j] += arr_all[j][i]\n\n\nfor i in range(len(arr_all)):\n print(\'\'.join(arr_del[i]))'] | ['Wrong Answer', 'Accepted'] | ['s166446536', 's724016850'] | [3316.0, 3188.0] | [23.0, 22.0] | [635, 606] |
p03273 | u746849814 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\nh, w = map(int, input().split())\nf = np.array([list(input()) for _ in range(h)])\n\nf = f[~np.all(f=='.', axis=1)]\nf = f[:, ~np.all(f=='.', axis=0)]\n\nfor x in f:\n print(*x)", "import numpy as np\nh, w = map(int, input().split())\nf = np.array([list(input()) for _ in range(h)])\n\nwhile True:\n f_shape = f.shape\n f = f[~np.all(f=='.', axis=1)]\n f = f[:, ~np.all(f=='.', axis=0)]\n if f.shape == f_shape:\n break\n\nfor x in f:\n print(*x)", "import numpy as np\nh, w = map(int, input().split())\nf = np.array([list(input()) for _ in range(h)])\n\nf = f[~np.all(f=='.', axis=1), :]\nf = f[:, ~np.all(f=='.', axis=0)]\n\nprint('\\n'.join(''.join(row) for row in f))"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s038973160', 's158534588', 's545699394'] | [13200.0, 13132.0, 12544.0] | [156.0, 155.0, 152.0] | [192, 275, 213] |
p03273 | u749770850 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H,W=map(int,input().split())\n\nl=[]\nfor i in range(H):\n x=input()\n if x!='.'*W:\n l.append(x)\n\nrm=[]\nfor i in range(W):\n f=True\n for j in range(len(l)):\n if l[j][i]=='#':\n f=False\n\n if f:\n rm.append(i)\nprint()\na=[]\nprint(l)\nprint(rm)\nfor x in l:\n for i in rm[::-1]:\n print(i)\n x=x[:i]+x[i+1:]\n a.append(''.join(x))\n\nprint()\nfor i in range(len(a)):\n print(''.join(a[i]))", "\nH,W=map(int,input().split())\n\nl=[]\nfor i in range(H):\n x=input()\n \n if x!='.'*W:\n l.append(x)\n\nrm=[]\nfor i in range(W):\n \n f=True\n for j in range(len(l)):\n if l[j][i]=='#':\n f=False\n\n \n if f:\n rm.append(i)\n\na=[]\nfor x in l:\n for i in rm[::-1]:\n x=x[:i]+x[i+1:]\n a.append(''.join(x))\n\n\nfor i in range(len(a)):\n print(''.join(a[i]))"] | ['Wrong Answer', 'Accepted'] | ['s654295632', 's292424471'] | [3316.0, 3064.0] | [21.0, 19.0] | [395, 489] |
p03273 | u766566560 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H, W = map(int, input().split())\nG = []\n\nfor i in range(H):\n line = input()\n if line != '.' * W:\n G.append(line)\n\nH = len(G)\nans = []\n\nfor i in range(W):\n flg = False\n tmp = ''\n for j in range(H):\n if G[j][i] == '.':\n flg = False\n else:\n flg = True\n tmp += G[j][i]\n if flg == True:\n ans.append(tmp)\n\nprint(ans)", "H, W = map(int, input().split())\nG = []\n\nfor i in range(H):\n line = input()\n if line != '.' * W:\n G.append(line)\n\nH = len(G)\nans = []\n\nfor i in range(W):\n flg = False\n tmp = ''\n for j in range(H):\n if G[j][i] == '.':\n flg = False\n else:\n flg = True\n tmp += G[j][i]\n if tmp != '.' * H:\n ans.append(tmp)\n\nfor i in range(H):\n tmp = ''\n for j in range(len(ans)):\n tmp += ans[j][i]\n print(tmp)"] | ['Wrong Answer', 'Accepted'] | ['s030276308', 's397599917'] | [3064.0, 3064.0] | [21.0, 24.0] | [341, 425] |
p03273 | u767432305 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W=map(int,input().split())\nhw=[]\nfor _ in range(H):\n hw.append(input())\n\nyoko_list=[]\ntate_list=[]\nfor i in range(H):\n for j in range(W):\n if hw[i][j]=="#":\n break\n elif j==W-1:\n yoko_list.append(i)\n\nfor i in range(W):\n for j in range(H):\n if hw[j][i]=="#":\n break\n elif j==H-1:\n tateH,W=map(int,input().split())', 'H,W=map(int,input().split())\nhw=[]\nfor _ in range(H):\n hw.append(input())\n\nyoko_list=[]\ntate_list=[]\nfor i in range(H):\n for j in range(W):\n if hw[i][j]=="#":\n break\n elif j==W-1:\n yoko_list.append(i)\n\nfor i in range(W):\n for j in range(H):\n if hw[j][i]=="#":\n break\n elif j==H-1:\n tate_list.append(i)\n\nfor i in range(H):\n if not i in yoko_list:\n p=0\n for j in range(W):\n if not j in tate_list:\n p+=1\n if p==W-len(tate_list):\n print(hw[i][j])\n else:\n print(hw[i][j],end="")'] | ['Runtime Error', 'Accepted'] | ['s510758747', 's636559975'] | [3064.0, 4468.0] | [20.0, 33.0] | [395, 665] |
p03273 | u778814286 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["h, w = map(int, input().split())\nrs = [input() for _ in range(h)]\nrows = []\n\n\nfor r in rs:\n if '#' in r: rows.append(r)\n\nprint(rows)\nansrows = zip(*[c for c in zip(*rows) if '#' in c])\n\nfor r in list(ansrows):\n print(''.join(r))", "h, w = map(int, input().split())\nrs = [input() for _ in range(h)]\nrows = []\n\n\nfor r in rs:\n if '#' in r: rows.append(r)\n\nansrows = zip(*[c for c in zip(*rows) if '#' in c])\n\nfor r in list(ansrows):\n print(''.join(r))"] | ['Wrong Answer', 'Accepted'] | ['s330296855', 's925102858'] | [3188.0, 3188.0] | [18.0, 18.0] | [269, 257] |
p03273 | u779728630 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map( int, input().split() )\n\nh_set = set()\nw_set = set()\nB = [input() for i in range(H)]\nfor i in range(H):\n for j in range(W):\n if B[i][j] == \'#\':\n w_set.add(j)\n h_set.add(i)\n\nfor i in range(H):\n if i in h_set:\n for j in range(W):\n t = ""\n if j in w_set:\n t += B[i][j]\n print(t)', "H, W = map( int, input().split() )\n\nh_set = set()\nw_set = set()\nfor i in range(H):\n r = input()\n for j in range(W):\n if r[j] == '#':\n w_set.add(j)\n h_set.add(i)\nprint( len(h_set) * len(w_set) )", 'H, W = map( int, input().split() )\n\nh_set = set()\nw_set = set()\nB = [input() for i in range(H)]\nfor i in range(H):\n for j in range(W):\n if B[i][j] == \'#\':\n w_set.add(j)\n h_set.add(i)\n \nfor i in range(H):\n if i in h_set:\n t = ""\n for j in range(W):\n if j in w_set:\n t += B[i][j]\n print(t)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s492279402', 's550724262', 's487458809'] | [9024.0, 9124.0, 9220.0] | [31.0, 29.0, 28.0] | [324, 208, 328] |
p03273 | u781262926 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["inputs = open(0).readlines()\nimport numpy as np\nclass Grid():\n def __init__(self, grid, w=0, h=0, function=lambda x: x):\n self.w = w = w if w else len(grid[0])\n self.h = h = h if h else len(grid)\n dtype = type(function(grid[0][0]))\n self.grid = np.empty((h, w), dtype=dtype)\n for i, rows in zip(range(h), grid):\n for j, val in zip(range(w), rows):\n self.grid[i][j] = function(val)\n \n def is_valid_x(self, x):\n return 0 <= x < self.w\n def is_valid_y(self, y):\n return 0 <= y < self.h\n def is_valid_xy(self, x, y):\n return self.is_valid_x(x) and self.is_valid_y(y) \n \n def __iter__(self):\n return iter(self.grid)\n def __repr__(self):\n return '\\n'.join([' '.join(map(str, rows)) for rows in self.grid])\n def __getitem__(self, x):\n return self.grid[x]\n def __setitem__(self, x, val):\n self.grid[x] = val\n\nh, w = map(int, inputs[0].split())\ngrid_origin = Grid(inputs[1:])\ngrid = grid_origin.grid\n\ngrid = grid[:, ~np.all(grid == '.', axis=0)]\ngrid = grid[~np.all(grid == '.', axis=1), :]\nprint(*[''.join(map(str, rows)) for rows in grid], sep='\\n')", "inputs = open(0).readlines()\nimport numpy as np\nclass Grid():\n def __init__(self, grid, w=0, h=0, function=lambda x: x):\n self.w = w = w if w else len(grid[0])\n self.h = h = h if h else len(grid)\n dtype = type(function(grid[0][0]))\n self.grid = np.empty((h, w), dtype=dtype)\n for i, rows in zip(range(h), grid):\n for j, val in zip(range(w), rows):\n self.grid[i][j] = function(val)\n \n def is_valid_x(self, x):\n return 0 <= x < self.w\n def is_valid_y(self, y):\n return 0 <= y < self.h\n def is_valid_xy(self, x, y):\n return self.is_valid_x(x) and self.is_valid_y(y) \n \n def __iter__(self):\n return iter(self.grid)\n def __repr__(self):\n return '\\n'.join([' '.join(map(str, rows)) for rows in self.grid])\n def __getitem__(self, x):\n return self.grid[x]\n def __setitem__(self, x, val):\n self.grid[x] = val\n\nh, w = map(int, inputs[0].split())\ngrid = Grid(inputs[1:]).grid\nh0, w0 = h, w\nh1, w1 = h+1, w+1\nwhile h0 != h1 or w0 != w1:\n h1, w1 = grid.shape\n grid = grid[:, ~np.all(grid == '.', axis=0)]\n grid = grid[~np.all(grid == '.', axis=1), :]\n h0, w0 = grid.shape\nprint(*[''.join(map(str, rows)) for rows in grid], sep='\\n')", "inputs = [s.strip() for s in open(0).readlines()]\nimport numpy as np\nclass Grid():\n def __init__(self, grid, w=0, h=0, function=lambda x: x):\n self.w = w = w if w else len(grid[0])\n self.h = h = h if h else len(grid)\n dtype = type(function(grid[0][0]))\n self.grid = np.empty((h, w), dtype=dtype)\n for i, rows in zip(range(h), grid):\n for j, val in zip(range(w), rows):\n self.grid[i][j] = function(val)\n \n def is_valid_x(self, x):\n return 0 <= x < self.w\n def is_valid_y(self, y):\n return 0 <= y < self.h\n def is_valid_xy(self, x, y):\n return self.is_valid_x(x) and self.is_valid_y(y) \n \n def __iter__(self):\n return iter(self.grid)\n def __repr__(self):\n return '\\n'.join([' '.join(map(str, rows)) for rows in self.grid])\n def __getitem__(self, x):\n return self.grid[x]\n def __setitem__(self, x, val):\n self.grid[x] = val\n\nh, w = map(int, inputs[0].split())\ngrid = Grid([s.strip() for s in inputs[1:]]).grid\ngrid = grid[:, ~np.all(grid == '.', axis=0)]\ngrid = grid[~np.all(grid == '.', axis=1), :]\nprint(*[''.join(map(str, row)) for row in grid], sep='\\n')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s491628648', 's576263064', 's555877733'] | [14352.0, 12528.0, 12496.0] | [163.0, 156.0, 162.0] | [1182, 1271, 1195] |
p03273 | u785578220 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['input = get_input(INPUT)\n\nh, w = map(int, input().split())\na = [input() for w in range(h)]\n\nfor i in range(h)[::-1]:\n if "#" not in a[i]:\n del a[i]\n h -= 1\n\nn = []\nfor j in range(w):\n m = ["".join(t[j] for t in a)]\n if "#" in m[0]:\n n += m\n\nfor k in range(h):\n print("".join(u[k] for u in n))', 'h, w = map(int, input().split())\na = [input() for w in range(h)]\n\nfor i in range(h)[::-1]:\n if "#" not in a[i]:\n del a[i]\n h -= 1\n\nn = []\nfor j in range(w):\n m = ["".join(t[j] for t in a)]\n if "#" in m[0]:\n n += m\n\nfor k in range(h):\n print("".join(u[k] for u in n))\n'] | ['Runtime Error', 'Accepted'] | ['s039115580', 's169805284'] | [3064.0, 3064.0] | [18.0, 19.0] | [325, 300] |
p03273 | u787059958 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["from collections import defaultdict\nd = defaultdict(int)\nH, W = map(int, input().split())\nL = []\nfor i in range(H):\n L.append(input())\ncl = L[:]\n\nal = []\nfor i in cl:\n if ('#' in i):\n al.append(i)\n# print(al)\n\nif (len(al) == 0):\n print()\n exit()\n\nfor i in range(W):\n d[i] = True\n\nfor i, v in enumerate(al):\n for k, j in enumerate(v):\n if (j == '.'):\n continue\n else:\n d[k] = False\nfor i, v in d.items():\n if (v):\n for j, k in enumerate(al):\n if (i == 0):\n al[j] = ' ' + k[1:]\n elif ((i == len(al) - 1) and (len(al) != 1)):\n al[j] = k[:i - 1] + ' '\n else:\n al[j] = k[:i] + ' ' + k[i + 1:]\n\nfor i in al:\n print(i.replace(' ', ''))\n", "from collections import defaultdict\nd = defaultdict(int)\nH, W = map(int, input().split())\nL = []\nfor i in range(H):\n L.append(input())\ncl = L[:]\n\nal = []\nfor i in cl:\n if ('#' in i):\n al.append(i)\n\nif (len(al) == 0):\n print()\n exit()\n\nfor i in range(W):\n d[i] = True\n\nfor i, v in enumerate(al):\n for k, j in enumerate(v):\n if (j == '.'):\n continue\n else:\n d[k] = False\nfor i, v in d.items():\n if (v):\n for j, k in enumerate(al):\n if (i == 0):\n al[j] = ' ' + k[1:]\n elif ((i == W - 1) and (W != 1)):\n al[j] = k[:i] + ' '\n else:\n al[j] = k[:i] + ' ' + k[i + 1:]\nfor i in al:\n print(i.replace(' ', ''))\n"] | ['Wrong Answer', 'Accepted'] | ['s141524052', 's943692072'] | [3316.0, 3436.0] | [23.0, 24.0] | [781, 752] |
p03273 | u787562674 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W= map(int, input().split())\nA = [input() for i in range(H)]\n\nv_list = []\nreverse_list = [""]*W\nh_list = []\n\nfor i in range(H):\n if "#" in A[i]:\n v_list.append(A[i])\n\nprint(v_list)\n\nfor i in range(W):\n for j in range(len(v_list)):\n reverse_list[i] = reverse_list[i] + v_list[j][i]\n\nfor i in range(W):\n if "#" in reverse_list[i]:\n h_list.append(reverse_list[i])\n\nresult_list = [""]*(len(h_list[0]))\n\nfor i in range(len(h_list[0])):\n for j in range(len(h_list)):\n result_list[i] = result_list[i] + h_list[j][i]\n\nfor s in result_list:\n print(s)\n', 'H, W= map(int, input().split())\nA = [input() for i in range(H)]\n\nv_list = []\nreverse_list = [""]*W\nh_list = []\n\n\ndef delete(h, input, output):\n for i in range(h):\n if "#" in input[i]:\n output.append(input[i])\n\n\ndef reverse(w, h, input, output):\n for i in range(w):\n for j in range(h):\n output[i] = output[i] + input[j][i]\n\ndelete(H, A, v_list)\n\nreverse(W, len(v_list), v_list, reverse_list)\n\ndelete(W, reverse_list, h_list)\n\nresult_list = [""]*(len(h_list[0]))\n\nreverse(len(h_list[0]), len(h_list), h_list, result_list)\n\nfor s in result_list:\n print(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s965792297', 's271084933'] | [3064.0, 3064.0] | [24.0, 20.0] | [588, 665] |
p03273 | u788137651 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split())\na = []\nfor i in range(H):\n list = [i for i in input()]\n a.append(list)\ncolumn = [int(i) for i in range(W)]\nrow = [int(i) for i in range(H)]\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n if i in row:\n row.remove(i)\n if j in column:\n column.remove(j)\nprint(column)\nprint(row)\nfor i in range(H):\n printed = False\n for j in range(W):\n if i not in row and j not in column:\n print(a[i][j], end="")\n printed = True\n if printed:\n print("")\n', 'H, W = map(int, input().split())\na = []\nfor i in range(H):\n list = [i for i in input()]\n a.append(list)\ncolumn = [int(i) for i in range(W)]\nrow = [int(i) for i in range(H)]\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n if i in row:\n row.remove(i)\n if j in column:\n column.remove(j)\n# print(column)\n# print(row)\nfor i in range(H):\n printed = False\n for j in range(W):\n if i not in row and j not in column:\n print(a[i][j], end="")\n printed = True\n if printed:\n print("")\n'] | ['Wrong Answer', 'Accepted'] | ['s388970873', 's358558483'] | [4596.0, 4596.0] | [39.0, 38.0] | [592, 596] |
p03273 | u796942881 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H, W = map(int, input().split())\n\nl = [int(input()) for i in range(H)]\n\ny = [False] * H\nx = [False] * W\n\nfor i in range(H):\n flg = True\n for j in range(W):\n if l[i][j] != '.':\n flg = False\n break\n if flg:\n y[i] = True\n\nfor i in range(W):\n flg = True\n for j in range(H):\n if l[j][i] != '.':\n flg = False\n break\n if flg:\n x[i] = True\n\nfor i in range(H):\n if y[i]:\n continue\n for j in range(W):\n if x[j]:\n continue\n print(l[i][j], end='')\n print()\n", "H, W = map(int, input().split())\n\nl = [input() for i in range(H)]\n\ny = [False] * H\nx = [False] * W\n\nfor i in range(H):\n flg = True\n for j in range(W):\n if l[i][j] != '.':\n flg = False\n break\n if flg:\n y[i] = True\n\nfor i in range(W):\n flg = True\n for j in range(H):\n if l[j][i] != '.':\n flg = False\n break\n if flg:\n x[i] = True\n\nfor i in range(H):\n if y[i]:\n continue\n for j in range(W):\n if x[j]:\n continue\n print(l[i][j], end='')\n print()"] | ['Runtime Error', 'Accepted'] | ['s169615917', 's451675234'] | [3064.0, 4468.0] | [17.0, 29.0] | [576, 570] |
p03273 | u797016134 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w = map(int, input().split())\nli = []\nfor i in range(h):\n a = list(input())\n \n if "#" in a:\n li.append(a)\nprint(li)\nfor j in range(w):\n #if all([li[k][j] == "." for k in range(len(li))]):\n if all(li[k][j] == "." for k in range(len(li))):\n for k in range(len(li)):\n #li[k][j] == ""\n li[k][j] = ""\nfor m in range(len(li)):\n print("".join(li[m]))\n', 'h,w = map(int, input().split())\nli = []\nfor i in range(h):\n a = list(input())\n \n if "#" in a:\n li.append(a)\nfor j in range(w):\n #if all([li[k][j] == "." for k in range(len(li))]):\n if all(li[k][j] == "." for k in range(len(li))):\n for k in range(len(li)):\n #li[k][j] == ""\n li[k][j] = ""\nfor m in range(len(li)):\n print("".join(li[m]))'] | ['Wrong Answer', 'Accepted'] | ['s930742470', 's585352847'] | [3316.0, 3064.0] | [19.0, 19.0] | [502, 491] |
p03273 | u800058906 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["\n\nh,w=map(int,input().split())\n\na=[] \nfor i in range(h):\n x=input().split()\n a.append(x)\n\nh1=[]\nfor i in range(h):\n if a[i]==['.']:\n h1.append(i)\n\nw1=[]\nfor i in range(w):\n flag=0\n for j in range(h):\n if a[j][i]=='#':\n flag=1\n break\n if flag==0:\n w.append(i)\n\nans=[]\nfor i in range(h):\n if i not in h1:\n r=[]\n for j in range(w):\n r.append(a[i][j])\n ans.append(r)\n\nfor i in range(lens(ans)):\n print(''.join(ans[i]))", "h,w=map(int,input().split())\n\na=[] \nfor i in range(h):\n x=input().split()\n a.append(x)\n\nh1=[]\nfor i in range(h):\n if a[i]==['.']*w:\n h1.append(i)\n\nw1=[]\nfor i in range(w):\n flag=0\n for j in range(h):\n if a[j][i]=='#':\n flag=1\n break\n if flag==0:\n w.append(i)\n\nans=[]\nfor i in range(h):\n if i not in h1:\n r=[]\n for j in range(w):\n r.append(a[i][j])\n ans.append(r)\n\nfor i in range(lens(ans)):\n print(''.join(ans[i]))", "\nh,w=map(int,input().split())\n\na=[] \nfor i in range(h):\n x=input().split()\n a.append(x)\n\nh1=[]\nfor i in range(H):\n if a[i]==['.']*w:\n h1.append(i)\n\nw1=[]\nfor i in range(w):\n flag=0\n for j in range(h):\n if a[j][i]=='#':\n flag=1\n break\n if flag==0:\n w.append(i)\n\nans=[]\nfor i in range(h):\n if i not in h1:\n r=[]\n for j in range(w):\n r.append(a[i][j])\n ans.append(r)\n\nfor i in range(lens(ans)):\n print(''.join(ans[i]))\n", "\nh,w=map(int,input().split())\n\na=[] \nfor i in range(h):\n x=input().split()\n a.append(x)\n\nh1=[]\nfor i in range(h):\n if a[i]==['.']*w:\n h1.append(i)\n\nw1=[]\nfor i in range(w):\n flag=0\n for j in range(h):\n if a[j][i]=='#':\n flag=1\n break\n if flag==0:\n w1.append(i)\n\nans=[]\nfor i in range(h):\n if i not in h1:\n r=[]\n for j in range(w):\n r.append(a[i][j])\n ans.append(r)\n\nfor i in range(lens(ans)):\n print(''.join(ans[i]))", "\nh,w=map(int,input().split())\n\na=[] \nfor i in range(h):\n x=input().split()\n a.append(x)\n\nh1=[]\nfor i in range(H):\n if a[i]==['.']*w\n h1.append(i)\n\nw1=[]\nfor i in range(w):\n flag=0\n for j in range(h):\n if a[j][i]=='#':\n flag=1\n break\n if flag==0:\n w.append(i)\n\nans=[]\nfor i in range(h):\n if i not in h1:\n r=[]\n for j in range(w):\n r.append(a[i][j])\n ans.append(r)\n\nfor i in range(lens(ans)):\n print(''.join(ans[i]))", '\nH,W=map(int,input().split())\na=[list(input()) for _ in range(H)]\nh=[]\nfor i in range(H):\n if a[i]==[\'.\']*W:\n h.append(i)\n\nw=[]\nfor i in range(W):\n flag=0\n for j in range(H):\n if a[j][i]==\'#\':\n flag=1\n break\n if flag==0:\n w.append(i)\n \nans=[]\nfor i in range(H):\n if i not in h:\n r=[]\n for j in range(W):\n if j not in w:\n r.append(a[i][j])\n ans.append(r)\n\nfor i in range(len(ans)):\n print("".join(ans[i]))\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s085334828', 's300258170', 's411490765', 's503112764', 's640347836', 's085603987'] | [9208.0, 9232.0, 9208.0, 9252.0, 8960.0, 9232.0] | [23.0, 26.0, 26.0, 27.0, 26.0, 33.0] | [535, 486, 534, 534, 532, 480] |
p03273 | u802977614 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int, input().split())\na=[""]*h\nfor i in range(h):\n a[i]=input()\nrow=[False]*h\ncolumn=[False]*w\nfor i in range(h):\n for j in range(w):\n if a[i][j]=="#":\n row[i]=True\n column[j]=True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if column[j]:\n print(a[i][j]+" ")\n print()', 'h,w=map(int, input().split())\na=[" "]*h\nfor i in range(h):\n a[i]=input()\nrow=[False]*h\ncolumn=[False]*w\nfor i in range(h):\n for j in range(w):\n if a[i][j]=="#":\n row[i]=True\n column[j]=True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if column[j]:\n print(a[i][j]+" ")\n print()', 'h,w=map(int, input().split())\na=[""]*h\nfor i in range(h):\n a[i]=input()\nrow=[False]*h\ncolumn=[False]*w\nfor i in range(h):\n for j in range(w):\n if a[i][j]=="#":\n row[i]=True\n column[j]=True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if column[j]:\n print(a[i][j], end = "")\n print()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s547923790', 's780132007', 's867821089'] | [3656.0, 3572.0, 4468.0] | [28.0, 29.0, 32.0] | [317, 318, 323] |
p03273 | u809819902 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\na=[""]*h\nfor i in range(h):\n a[i]=input()\nrow=[False]*h\ncol=[False]*w\nfor i in range(h):\n for j in range(w):\n if a[i][j]=="#":\n row[i]= True\n col[j]=True\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if col[j]:\n print(a[i][j],end="")\n print\n ', 'h,w=map(int,input().split())\na=[input() for i in range(h)]\nrow=[0]*h\ncol=[0]*w\nfor i in range(h):\n for j in range(w):\n if a[i][j]=="#":\n row[i]=1\n col[j]=1\nfor i in range(h):\n if row[i]:\n for j in range(w):\n if col[j]:\n print(a[i][j],end="")\n print()\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s148172853', 's604902239'] | [9128.0, 9228.0] | [32.0, 33.0] | [362, 328] |
p03273 | u813387707 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h, w = [int(x) for x in input().split()]\n\ntemp_list = []\nl = w\nr = -1\nfor _ in range(h):\n a = input()\n temp_l = a.find("#")\n if temp_l == -1:\n continue\n l = min(temp_l, l)\n r = max(a.rfind("#"), r)\n temp_list.append(a)\n\nfor temp in temp_list:\n print(temp[l:r+1])', 'h, w = [int(x) for x in input().split()]\n \ntemp_list = []\nflag = [False] * w\nfor _ in range(h):\n a = input()\n if "#" not in a:\n continue\n temp_list.append(a)\n for i in range(w):\n flag[i] = flag[i] or a[i] == "#"\n\nfor temp in temp_list:\n print("".join([temp[i] for i in range(w) if flag[i]]))'] | ['Wrong Answer', 'Accepted'] | ['s918978142', 's392772960'] | [3060.0, 3064.0] | [18.0, 23.0] | [290, 320] |
p03273 | u819068380 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['\ndef compression(init, matrix):\n\t\n\tmir = []\n\t\n\tfor row in matrix:\n\t\tif "#"in row:\n\t\t\tmir.append(row)\n\tmatrix = []\n\t\n\tmir = list(map(list, zip(*mir)))\n\t\n\tfor row in mir:\n\t\tif "#"in row:\n\t\t\tmatrix.append(row)\n\t\t\n\tmatrix = list(map(list, zip(*matrix)))\t\n\t\t\t\n\t\n\treturn matrix\n\n\ninit = input().split(" ")\ninit = [int(c) for c in init]\n\nmatrix = [[] for j in range(init[0])]\nj = 0\n\nfor j in range(init[1]+1):\n\tmatrix[j] = input()\n\nresult = compression(init, matrix)\nfor row in result:\n\tprint("".join(row))', '\ndef compression(init, matrix):\n\t\n\tmir = []\n\t\n\tfor row in matrix:\n\t\tif "#"in row:\n\t\t\tmir.append(row)\n\tmatrix = []\n\t\n\tmir = list(map(list, zip(*mir)))\n\t\n\tfor row in mir:\n\t\tif "#"in row:\n\t\t\tmatrix.append(row)\n\t\t\n\tmatrix = list(map(list, zip(*matrix)))\t\n\t\t\t\n\t\n\treturn matrix\n\n\ninit = input().split(" ")\ninit = [int(c) for c in init]\n\nmatrix = [[] for j in range(init[0])]\n\nfor j in range(init[0]):\n\tmatrix[j] = input()\n\nresult = compression(init, matrix)\nfor row in result:\n\tprint("".join(row))'] | ['Runtime Error', 'Accepted'] | ['s296144963', 's383747409'] | [3064.0, 3188.0] | [18.0, 18.0] | [499, 491] |
p03273 | u823885866 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import sys\nimport numpy as np\n\nrm = lambda: map(int, sys.stdin.readline().split())\nrl = lambda: list(map(int, sys.stdin.readline().split()))\n\nh, w = rm()\nli = np.array([np.array(rl()) for _ in range(h)])\nli2 = np.array([])\nli3 = np.array([])\nfor i in li:\n if '#' not in i:\n li2.append(i)\nli2 = li2.T\nfor i in li2:\n if '#' not in i:\n li3.append(i)\nfor i in li3.T:\n print(''.join(i))", "import sys\nimport numpy as np\n\nrm = lambda: map(int, sys.stdin.readline().split())\nrr = lambda: sys.stdin.readline().rstrip()\n\nh, w = rm()\nli = np.array([np.array(list(rr())) for _ in range(h)])\nli2 = []\nli3 = []\nfor i in li:\n if '#' in i:\n li2.append(i)\nli2 = np.array(li2).T\nfor i in li2:\n if '#' in i:\n li3.append(i)\nli3 = np.array(li3).T\nfor i in li3:\n print(''.join(i))\n"] | ['Runtime Error', 'Accepted'] | ['s677290411', 's460117422'] | [27016.0, 27168.0] | [112.0, 119.0] | [390, 384] |
p03273 | u828506439 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\n\nh, w = map(int, input().split())\nA = []\n\nfor _ in range(h):\n a = input()\n if '#' in a:\n A.append(a)\n\nAA = []\ncount = 0\nfor j in range(w):\n retu = []\n for i in range(len(A)):\n retu.append(A[i][j])\n if '#' not in retu:\n continue\n else:\n AA.append(retu)\n\nAA = np.array(AA)\nAA = AA.T\nAA = AA.tolist()\n\nfor aa in AA:\n print(*aa)", "#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n int h, w;\n cin >> h >> w;\n vector<string> a(h);\n for (int i=0; i<h; i++) {\n cin >> a.at(i);\n }\n vector<bool> row(h, false);\n vector<bool> col(w, false);\n for (int i=0; i<h; i++) {\n for (int j=0; j<w; j++) {\n if (a.at(i).at(j) == '#') {\n\t\t\t\trow[i] = true;\n\t\t\t\tcol[j] = true;\n }\n }\n }\n\n\tfor (int i = 0; i < h; i++) {\n\t\tif (row[i]) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\tif (col[j]) {\n\t\t\t\t\tcout << a[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tcout << endl;\n\t\t}\n\t} \n}", "h, w = map(int, input().split())\na = [''] * h\nfor i in range(h):\n\ta[i] = input()\n\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif a[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\n\nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range(w):\n\t\t\tif col[j]:\n\t\t\t\tprint(a[i][j], end = '')\n\t\tprint()\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s131985542', 's251067004', 's786599579'] | [13124.0, 2940.0, 4468.0] | [158.0, 17.0, 30.0] | [392, 575, 318] |
p03273 | u840958781 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['A,B=[],[]\nh,w=map(int,input().split())\nfor i in range(h):\n a=input()\n if "#" in a:\n A.append(a)\nb=""\nfor i in range(w):\n if "#" not in b:\n B.append(i-1)\n b=""\n for j in range(len(A)):\n b+=A[j][i]\nb=""\nb+=A[len(A)-1]\nif "#" not in b:\n B.append(w-1)\nB.pop(0)\no=0\nprint(B)\nfor i in range(len(A)):\n o=0\n A[i]=list(A[i])\n for j in B:\n A[i].pop(j-o)\n if o==len(B)-1:\n print("".join(A[i]))\n o+=1\nif len(B)==0:\n for i in A:\n print("".join(i))', 'A,B=[],[]\nh,w=map(int,input().split())\nfor i in range(h):\n a=input()\n if "#" in a:\n A.append(a)\nb=""\nfor i in range(w):\n if "#" not in b:\n B.append(i-1)\n b=""\n for j in range(len(A)):\n b+=A[j][i]\nif "#" not in b:\n B.append(w-1)\nB.pop(0)\no=0\nfor i in range(len(A)):\n o=0\n A[i]=list(A[i])\n for j in B:\n A[i].pop(j-o)\n if o==len(B)-1:\n print("".join(A[i]))\n o+=1\nif len(B)==0:\n for i in A:\n print("".join(i))'] | ['Wrong Answer', 'Accepted'] | ['s107417578', 's927211969'] | [3188.0, 3188.0] | [20.0, 20.0] | [524, 495] |
p03273 | u844005364 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h, w = map(int, input().split())\n \na = [list(input()) for i in range(h)]\n \nfor i in range(h):\n if "#" not in a[i]:\n del a[i]\n \naT = zip(*a)\n \nfor i in range(len(aT)):\n if "#" not in aT[i]:\n del aT[i]\n \na = zip(*aT)\n \nfor i in a:\n print(i)', 'h, w = map(int, input().split())\n\na = [input() for i in range(h)]\n\nfor i in range(h):\n if "#" not in a[i]:\n del a[i]\n\naT = zip(*a)\n\nfor i in range(len(aT)):\n if "#" not in aT[i]:\n del aT[i]\n\na = zip(*aT)\n\nfor i in a:\n print(i)', 'h, w = map(int, input().split())\n \na = [list(input()) for i in range(h)]\n \nfor i in range(h):\n if "#" not in a[i]:\n del a[i]\n \naT = list(zip(*a))\n \nfor i in range(len(aT)):\n if "#" not in aT[i]:\n del aT[i]\n \na = list(zip(*aT))\n\nfor i in a:\n print(i)\n', 'h, w = map(int, input().split())\na = [list(input()) for i in range(h)]\n\na = [x for x in a if "#" in x]\naT = list(zip(*a))\naT = [x for x in aT if "#" in x]\na = list(zip(*aT))\n\nfor i in a:\n print("".join(i))\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s420156933', 's547251795', 's936272491', 's665875016'] | [3064.0, 3064.0, 3316.0, 3316.0] | [18.0, 17.0, 19.0, 19.0] | [247, 235, 259, 209] |
p03273 | u844266921 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\na=[[c for c in input()] for _ in range(h)]\nb=[]\nflag=0\nfor s in a:\n if ("#" in s) and ("." in s):\n b.append(s)\nfor i in range(w):\n flag=0\n for j in range(len(b)):\n if b[j][i]!=b[0][i]:\n flag=1\n break\n if flag==0:\n for j in range(len(b)):\n b[j][i]=""\nfor s in b:\n print("".join(s))', 'h,w=map(int,input().split())\na=[[c for c in input()] for _ in range(h)]\nb=[]\nflag=0\nfor s in a:\n if "#" in s:\n b.append(s)\nfor i in range(w):\n flag=0\n for j in range(len(b)):\n if b[j][i]=="#":\n flag=1\n break\n if flag==0:\n for j in range(len(b)):\n b[j][i]=""\nfor s in b:\n print("".join(s))'] | ['Wrong Answer', 'Accepted'] | ['s247914496', 's308864099'] | [3064.0, 3064.0] | [19.0, 18.0] | [338, 317] |
p03273 | u855985627 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["H,W=(int(i) for i in input().split(' '))\ngrid=[]\nfor h in range(H):\n tmp = input()\n if tmp.count('#')!=0:\n \tgrid[h]=tmp\n else:\n H -= 1\npop_count=0\nfor w in range(W):\n check = 0\n for h in range(h):\n if grid[h][w-pop_count]='#':\n check = 1\n if check == 0:\n for h in range(H):\n\t\tgrid[h].pop(w-pop_count)\n pop_count+=1\nfor h in range(H):\n print(grid[h])", "H,W=(int(i) for i in input().split(' '))\ngrid=[]\ndelete_count= 0\npop_count=0\nfor h in range(H):\n tmp = [char for char in input()]\n if tmp.count('#')!=0:\n grid.append(tmp)\n else:\n delete_count += 1\nfor w in range(W):\n check = 0\n for h in range(H-delete_count):\n if grid[h][w-pop_count]=='#':\n check = 1\n if check == 0:\n for h in range(H-delete_count):\n del grid[h][w-pop_count]\n pop_count+=1\nfor h in range(H-delete_count):\n grid[h]=''.join(grid[h])\n print(grid[h])"] | ['Runtime Error', 'Accepted'] | ['s954821902', 's351356705'] | [2940.0, 3064.0] | [17.0, 19.0] | [373, 497] |
p03273 | u859897687 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w=map(int,input().split())\nh1=[0 for i in range(h)]\nw1=[0 for i in range(w)]\nfor i in range(h):\n a=input()\n m+=[a]\n if not "#" in a:\n h1[i]=1\n \nfor i in range(w):\n k=1\n for j in range(len(m)):\n if m[j][i]=="#":\n k=0\n break\n if k==1:\n w1[i]=1\n \nfor i in range(h):\n if h1[i]==1:\n continue\n ans=""\n for j in range(w):\n if w1[j]==1:\n continue\n ans+=m[i][j]\n print(ans)\n ', 'h,w=map(int,input().split())\nh1=[0 for i in range(h)]\nw1=[0 for i in range(w)]\nm=[]\nfor i in range(h):\n a=input()\n m+=[a]\n if not "#" in a:\n h1[i]=1\n \nfor i in range(w):\n k=1\n for j in range(len(m)):\n if m[j][i]=="#":\n k=0\n break\n if k==1:\n w1[i]=1\n \nfor i in range(h):\n if h1[i]==1:\n continue\n ans=""\n for j in range(w):\n if w1[j]==1:\n continue\n ans+=m[i][j]\n print(ans)\n '] | ['Runtime Error', 'Accepted'] | ['s528091014', 's120141042'] | [3064.0, 3064.0] | [18.0, 21.0] | [418, 423] |
p03273 | u864197622 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split(" "))\nA=[]\nfor i in range(H):\n tmp = input()\n A.append ([c for c in tmp])\n \nprint (A)\n\nh=H\nw=W\nfor i in range(H):\n cnt = 0 \n for j in range(W):\n if A[i][j] == ".":\n cnt += 1\n \n \n if cnt == W:\n h -= 1\n for ii in range(i, H-1):\n for jj in range(W):\n A[ii][jj] = A[ii+1][jj]\n\nfor j in range(W):\n cnt = 0 \n for i in range(H):\n if A[i][j] == ".":\n cnt += 1\n \n \n if cnt == H:\n w -= 1\n for jj in range(j, W-1):\n for ii in range(H):\n A[ii][jj] = A[ii][jj+1]\n\nprint ("h={0} w={1}\\n".format(h, w))\nB = []\nfor i in range(h):\n B.append([])\n for j in range(w):\n B[i].append (A[i][j])\n \n \nprint (B)', 'H, W = map(int, input().split(" "))\nA=[]\nfor i in range(H):\n tmp = input()\n A.append ([c for c in tmp])\n \n# print (A)\n\nh=H\nw=W\nfor i in range(H-1,-1,-1):\n cnt = 0 \n for j in range(W):\n if A[i][j] == ".":\n cnt += 1\n\n\n if cnt == W:\n h -= 1\n for ii in range(i, H-1):\n for jj in range(W):\n A[ii][jj] = A[ii+1][jj]\n\nfor j in range(W-1,-1,-1):\n cnt = 0 \n for i in range(h):\n if A[i][j] == ".":\n cnt += 1\n\n\n if cnt == h:\n w -= 1\n for jj in range(j, W-1):\n for ii in range(h):\n A[ii][jj] = A[ii][jj+1]\n\ndef printA(A, h, w):\n for i in range(h):\n st = ""\n for j in range(w):\n st += (A[i][j])\n\n print (st) \n\nprintA(A, h, w)'] | ['Wrong Answer', 'Accepted'] | ['s771115797', 's519410394'] | [3560.0, 3188.0] | [199.0, 115.0] | [835, 800] |
p03273 | u867848444 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\nh,w=map(int,input().split())\na=[np.array(input().split()) for i in range(h)]\na=np.array(a)\n\nh_score=[0]*h\nw_score=[0]*w\nfor i in range(h):\n for j in range(w):\n if a[i][j]=='.':\n h_score[j]+=1\n w_score[i]+=1\n\nfor i in range(h):\n if h_score[i]==h:\n a=np.delete(a,i,1)\nfor i in range(w):\n if w_score[i]==w:\n a=np.delete(a,i,0)\n\nfor i in a:\n print(*i)", "h,w=map(int,input().split())\nl=[list(input()) for i in range(h)]\n\nimport numpy as np\nchange_h=0\nchange_w=w\nans=[]\nfor i in range(h):\n if l[i].count('.')!=w:\n ans+=[l[i][:]]\n change_h+=1\nl_count=[]\nfor i in range(w):\n count=0\n for j in range(h):\n if l[j][i]=='.':\n count+=1\n \n if count==h:\n l_count+=[i]\n \nl_count=sorted(l_count,reverse=True)\nfor i in l_count:\n ans=np.delete(ans,i,axis=1)\n \n\n\nfor i in range(change_h):\n print(*ans[i],sep='')"] | ['Runtime Error', 'Accepted'] | ['s711152994', 's560769737'] | [12500.0, 13620.0] | [150.0, 156.0] | [461, 668] |
p03273 | u879674287 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["import numpy as np\n\n\ndef yoko(row):\n cnt = sum(row)\n return cnt == len(row)\n\n\ndef main():\n h, w = map(int, input().split(' '))\n a = []\n\n for i in range(h):\n b = input()\n a += [1 if c == '.' else 0 for c in b]\n a = np.array(a).reshape(h, w)\n\n while True:\n cnt = 0\n del_list = []\n for i in range(len(a)):\n judge = yoko(a[i])\n if judge:\n del_list.append(i)\n\n if len(del_list):\n del_cnt = 0\n for idx in del_list:\n a = np.delete(a, idx - del_cnt, axis=0)\n del_cnt += 1\n else:\n cnt += 1\n\n a = a.T\n\n print('-------')\n print(a)\n\n del_list = []\n for i in range(len(a)):\n judge = yoko(a[i])\n if judge:\n del_list.append(i)\n\n if len(del_list):\n del_cnt = 0\n for idx in del_list:\n a = np.delete(a, idx - del_cnt, axis=0)\n del_cnt += 1\n else:\n cnt += 1\n\n a = a.T\n\n if cnt >= 2:\n break\n\n for i in range(len(a)):\n r = ''\n for j in a[i]:\n if j == 1:\n r += '.'\n else:\n r += '#'\n print(r)\n\n\nmain()\n", "import numpy as np\n\n\ndef yoko(row):\n cnt = sum(row)\n return cnt == len(row)\n\n\ndef main():\n h, w = map(int, input().split(' '))\n a = []\n\n for i in range(h):\n b = input()\n a += [1 if c == '.' else 0 for c in b]\n a = np.array(a).reshape(h, w)\n\n while True:\n cnt = 0\n del_list = []\n for i in range(len(a)):\n judge = yoko(a[i])\n if judge:\n del_list.append(i)\n\n if len(del_list):\n del_cnt = 0\n for idx in del_list:\n a = np.delete(a, idx - del_cnt, axis=0)\n del_cnt += 1\n else:\n cnt += 1\n\n a = a.T\n\n del_list = []\n for i in range(len(a)):\n judge = yoko(a[i])\n if judge:\n del_list.append(i)\n\n if len(del_list):\n del_cnt = 0\n for idx in del_list:\n a = np.delete(a, idx - del_cnt, axis=0)\n del_cnt += 1\n else:\n cnt += 1\n\n a = a.T\n\n if cnt >= 2:\n break\n\n for i in range(len(a)):\n r = ''\n for j in a[i]:\n if j == 1:\n r += '.'\n else:\n r += '#'\n print(r)\n\n\nmain()\n"] | ['Wrong Answer', 'Accepted'] | ['s971962018', 's784775256'] | [12624.0, 12624.0] | [165.0, 165.0] | [1299, 1256] |
p03273 | u879870653 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W = map(int,input().split())\nL = [input() for i in range(H)]\nX = [False for i in range(W)]\nY = [False for i in range(H)]\n\nfor y in range(H) :\n for x in range(W) :\n if L[y][x] == "#" :\n X[x] = True\n Y[y] = True\nprint(X,Y)\n\nfor y in range(H) :\n if Y[y] == True :\n ANS = []\n for x in range(W) :\n if X[x] == True :\n ANS.append(L[y][x])\n print("".join(ANS))\n ', 'H,W = map(int,input().split())\nL = [input() for i in range(H)]\nX = [False for i in range(W)]\nY = [False for i in range(H)]\n\nfor y in range(H) :\n for x in range(W) :\n if L[y][x] == "#" :\n X[x] = True\n Y[y] = True\n\nfor y in range(H) :\n if Y[y] == True :\n ANS = []\n for x in range(W) :\n if X[x] == True :\n ANS.append(L[y][x])\n print("".join(ANS))\n'] | ['Wrong Answer', 'Accepted'] | ['s130941736', 's003434144'] | [3188.0, 3064.0] | [23.0, 23.0] | [445, 426] |
p03273 | u882359130 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = [int(hw) for hw in input().split()]\nA = []\nfor h in range(H):\n a = [a for a in input()]\n if a.count("#") > 0:\n A.append(a)\nfor w in range(W):\n cnt = 0\n for h in range(len(A)):\n if A[h][w] == ".":\n cnt += 1\n if cnt == len(A):\n for h in range(len(A)):\n del A[h][w]\nfor h in range(len(A)):\n print(A[h])', 'H, W = [int(hw) for hw in input().split()]\nA = []\nfor h in range(H):\n a = [a for a in input()]\n if a.count("#") > 0:\n A.append(a)\n\nfor w in reversed(range(W)):\n cnt = 0\n for h in range(len(A)):\n if A[h][w] == ".":\n cnt += 1\n if cnt == len(A):\n for h in range(len(A)):\n del A[h][w]\n\nfor h in range(len(A)):\n ans = "".join(A[h])\n print(ans)'] | ['Runtime Error', 'Accepted'] | ['s702316483', 's874468699'] | [3188.0, 3064.0] | [20.0, 20.0] | [331, 364] |
p03273 | u883203948 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['import numpy as np\n\ndata = input().split()\n\nh = int(data[0])\nw = int(data[1])\n\ncount = 0\n# creating math\ni = 0\nmath = []\nwhile i < h:\n x = input()\n x = list(x)\n math.append(x)\n i += 1\nmath = np.array(math).reshape(h,w)\n\n\n# row check\n\ni = 0 # row\nj = 0 # colum\nwhile i < h:\n while j < w:\n if math[i][j] == ".":\n \n j += 1\n if j == w:\n math = np.delete(math,i,0)\n h = h-1\n \n \n else:\n break\n j = 0\n i += 1\ni = 0\nj = 0\n\n# colum check\n\nwhile j < w:\n while i < h:\n if math[i][j] == ".":\n \n i += 1\n if i == h:\n math = np.delete(math,j,1)\n w = w-1\n \n \n else:\n break\n i = 0\n j += 1\n\nprint(math)\n\n \n \n', 'import numpy as np\n\ndata = input().split()\n\nh = int(data[0])\nw = int(data[1])\n\ncount = 0\n# creating math\ni = 0\nmath = []\nwhile i < h:\n x = input()\n x = list(x)\n math.append(x)\n i += 1\nmath = np.array(math).reshape(h,w)\n\n\n# row check\n\ni = 0 # row\nj = 0 # colum\nwhile i < h:\n while j < w:\n if math[i][j] == ".":\n \n j += 1\n if j == w:\n math = np.delete(math,i,0)\n h = h-1\n i -=1\n \n \n \n else:\n break\n j = 0\n i += 1\ni = 0\nj = 0\n\n# colum check\n\nwhile j < w:\n while i < h:\n if math[i][j] == ".":\n \n i += 1\n if i == h:\n math = np.delete(math,j,1)\n w = w-1\n j -= 1\n \n \n else:\n break\n i = 0\n j += 1\ni = 0\nj = 0\nwhile i < h:\n while j < w:\n print(*math[i][j],end = "")\n j += 1\n i += 1\n j = 0\n print()\n\n\n \n \n'] | ['Wrong Answer', 'Accepted'] | ['s048565422', 's319506297'] | [12504.0, 13912.0] | [166.0, 177.0] | [862, 1038] |
p03273 | u884323674 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int, input().split())\nfield = [[i for i in input()] for j in range(H)]\n\nb_rows = []\nfor row in range(H):\n if field[row].count(".") != W:\n b_rows.append(row)\n\nb_columns = []\nfor column in range(W):\n memo = []\n for row in range(H):\n memo.append(field[column][row])\n if memo.count(".") != H:\n b_columns.append(column)\n\nfor i in b_rows:\n for j in b_columns:\n print(field[i][j], end="")\n print()', 'H, W = map(int, input().split())\nfield = [[i for i in input()] for j in range(H)]\n\nb_rows = []\nfor row in range(H):\n if field[row].count(".") != W:\n b_rows.append(row)\n\nb_columns = []\nfor column in range(W):\n memo = []\n for row in range(H):\n memo.append(field[row][column])\n if memo.count(".") != H:\n b_columns.append(column)\n\nfor i in b_rows:\n for j in b_columns:\n print(field[i][j], end="")\n print()'] | ['Runtime Error', 'Accepted'] | ['s313880876', 's687596793'] | [4468.0, 4468.0] | [29.0, 30.0] | [447, 447] |
p03273 | u887207211 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H, W = map(int,input().split())\nA = [input() for _ in range(N)]\n\ntmp = []\nfor a in zip(*A):\n if(a.count("#") > 0):\n tmp.append("".join(a))\ntmp2 = []\nfor t in zip(*tmp):\n if(t.count("#") > 0):\n tmp2.append("".join(t))\nprint("\\n".join(tmp2))', 'import sys\n\nstdin = sys.stdin\n\nns = lambda : stdin.readline().rstrip()\nni = lambda : int(ns())\nna = lambda : list(map(int, stdin.readline().split()))\n\ndef main():\n h, w = na()\n a = [ns() for _ in range(h)]\n a = ["".join(hw) for hw in zip(*a) if hw.count("#") > 0]\n a = ["".join(hw) for hw in zip(*a) if hw.count("#") > 0]\n print("\\n".join(a))\n\nmain()'] | ['Runtime Error', 'Accepted'] | ['s382213084', 's220592876'] | [3064.0, 3064.0] | [18.0, 18.0] | [247, 355] |
p03273 | u905582793 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h,w = map(int,input().split())\na=[input() for i in range(h)]\nb=[]\nc=[]\nfor i in a:\n if "#" in i:\n b.append(i)\nfor i in range(w):\n for j in range(len(b)):\n if b[j][i] == "#":\n break\n elif j = h-1:\n for k in b:\n del k[j]\nprint(b)', 'a=[input() for i in range(h)]\nb=[]\nfor i in a:\n if "#" in i:\n b.append(i)\nfor i in range(w):\n for j in range(len(b)):\n if b[j][i] == "#":\n break\n elif j == len(b)-1:\n for k in range(len(b)):\n print(b[k][:i],b[k][i+1:],sep="")', 'h,w = map(int,input().split())\na=[list(input()) for i in range(h)]\nb=[]\ndl=[]\nfor i in a:\n if "#" in i:\n b.append(i)\nfor j in range(w):\n for i in range(len(b)):\n if b[i][j] == "#":\n break\n elif i == len(b)-1:\n dl.append(j)\ndl.sort(reverse=True)\nfor i in dl:\n for j in range(len(b)):\n del b[j][i]\nfor c in b:\n print(*c,sep="")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s118890428', 's770933684', 's458857618'] | [2940.0, 3060.0, 4596.0] | [17.0, 17.0, 22.0] | [255, 253, 351] |
p03273 | u905711033 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['import numpy as np\n\nH,W = list(map(int, input().split()))\n\nmat = np.zeros((H, W))\noriginal_mat = []\n\nremoved_line = []\nremoved_column = []\n\nfor i in range(H):\n row = input()\n line = []\n for j, c in enumerate(row):\n if c == "#":\n mat[i, j] = 1\n\n # print(mat[i,:])\n if np.sum(mat[i,:]) == 0:\n removed_line.append(i)\n else:\n original_mat.append(row)\n\nfor i in range(W):\n print(mat[:,i])\n if np.sum(mat[:,i]) == 0:\n removed_column.append(i)\n\nprint(removed_line)\nprint(removed_column)\n\nfor row in original_mat:\n for i, c in enumerate(row):\n if i not in removed_column:\n print(c, end="")\n print("\\n", end="")\n', 'import numpy as np\n\nH,W = list(map(int, input().split()))\n\nmat = np.zeros((H, W))\noriginal_mat = []\n\nremoved_line = []\nremoved_column = []\n\nfor i in range(H):\n row = input()\n line = []\n for j, c in enumerate(row):\n if c == "#":\n mat[i, j] = 1\n\n # print(mat[i,:])\n if np.sum(mat[i,:]) == 0:\n removed_line.append(i)\n else:\n original_mat.append(row)\n\nfor i in range(W):\n # print(mat[:,i])\n if np.sum(mat[:,i]) == 0:\n removed_column.append(i)\n\n# print(removed_line)\n# print(removed_column)\n\nfor row in original_mat:\n for i, c in enumerate(row):\n if i not in removed_column:\n print(c, end="")\n print("\\n", end="")\n'] | ['Wrong Answer', 'Accepted'] | ['s765315485', 's315973060'] | [18256.0, 13932.0] | [403.0, 165.0] | [690, 696] |
p03273 | u911507660 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ["# Q2\nH, W = map(int, input().split())\na = [[c for c in input()] for _h in range(H)]\n\n\nfor h in range(H):\n if '#' in a[h]:\n for w in range(W):\n a[h][w] = ''\nfor w in range(W):\n if '#' in [p[w] for p in a]:\n for h in range(H):\n a[h][w] = ''\n\nfor h in range(H):\n line = ''.join(a[h])\n if line:\n print(''.join(a[h]))", "# Q2\nH, W = map(int, input().split())\na = [[c for c in input()] for _h in range(H)]\n\ncompressed = True\nwhile compressed:\n compressed = False\n for h in range(H):\n if '#' not in a[h]:\n for w in range(W):\n a[h][w] = ''\n compressed = True\n for w in range(W):\n if '#' not in [p[w] for p in a]:\n for h in range(H):\n a[h][w] = ''\n compressed = True\n\nfor h in range(H):\n line = ''.join(a[h])\n if line:\n print(''.join(a[h]))", "# Q2\nH, W = map(int, input().split())\na = [[c for c in input()] for _h in range(H)]\n\ncompressed = False\nwhile compressed:\n compressed = False\n for h in range(H):\n if '#' not in a[h]:\n for w in range(W):\n a[h][w] = ''\n compressed = True\n for w in range(W):\n if '#' not in [p[w] for p in a]:\n for h in range(H):\n a[h][w] = ''\n compressed = True\n\nfor h in range(H):\n line = ''.join(a[h])\n if line:\n print(''.join(a[h]))", "# Q2\nH, W = map(int, input().split())\na = [[c for c in input()] for _h in range(H)]\n\n\nfor h in range(H):\n if '#' not in a[h]:\n for w in range(W):\n a[h][w] = ''\nfor w in range(W):\n if '#' not in [p[w] for p in a]:\n for h in range(H):\n a[h][w] = ''\n\nfor h in range(H):\n line = ''.join(a[h])\n if line:\n print(''.join(a[h]))"] | ['Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s349496751', 's605335003', 's926832207', 's282747417'] | [3064.0, 3064.0, 3064.0, 3064.0] | [19.0, 2104.0, 20.0, 21.0] | [367, 533, 534, 375] |
p03273 | u923077302 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['def main():\n H, W = list(map(int, input().split(" ")))\n a = []\n for r in range(H):\n a += [input()]\n output = solve(H, W, a)\n for s in output:\n print(s)\n return\n\n#________________________________________\n# Solve\n#________________________________________\ndef solve(H, W, a):\n \n index_list = []\n for _r in range(H):\n for _c in range(W):\n if a[_r][_c] is not ".":\n break\n if _c == W-1:\n index_list += [_r]\n for i in index_list:\n del a[i]\n\n for _c in range(len(a[0])):\n for _r in range(len(a)):\n if a[_r][_c] is not ".":\n break\n if _r == len(a)-1:\n index_list += [_c]\n a = list(map(list, zip(*a)))\n for i in index_list:\n del a[i]\n a = list(map(list, zip(*a)))\n a = [ "".join(a[i]) for i in range(len(a))]\n return a\n#________________________________________\n\n\nif __name__ == "__main__":\n main()', 'def main():\n H, W = list(map(int, input().split(" ")))\n a = []\n for r in range(H):\n a += [input()]\n output = solve(H, W, a)\n for s in output:\n print(s)\n return\n\n#________________________________________\n# Solve\n#________________________________________\ndef solve(H, W, a):\n \n index_list = []\n for _r in range(H):\n for _c in range(W):\n if a[_r][_c] is not ".":\n break\n if _c == W-1:\n index_list += [_r]\n j = 0\n for i in index_list:\n del a[i-j]\n j += 1\n\n index_list = []\n a = list(map(list, zip(*a)))\n for _r in range(len(a)):\n for _c in range(len(a[0])):\n if a[_r][_c] is not ".":\n break\n if _c == len(a[0])-1:\n index_list += [_r]\n j = 0\n for i in index_list:\n del a[i-j]\n j += 1\n a = list(map(list, zip(*a)))\n a = [ "".join(a[i]) for i in range(len(a))]\n return a\n#________________________________________\n\n\nif __name__ == "__main__":\n main()'] | ['Runtime Error', 'Accepted'] | ['s449578176', 's552035740'] | [3188.0, 3188.0] | [19.0, 19.0] | [1020, 1097] |
p03273 | u931636178 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['H,W = map(int,input().split())\ngrid = []\nfor i in range(H):\n row = list(input())\n grid.append(row)\nwhile True:\n r_change = False\n for q in range(len(grid)):\n if "#" not in grid[q]:\n del grid[q]\n r_change = True\n break\n if not r_change:\n break\nwhile True:\n c_change = False\n for k in range(len(grid[0])):\n if "#" not in [row[k] for row in grid]:\n grid = [[row[p] for p in range(len(row)) if p != k] for row in grid]\n c_change = True\n break\n if not c_change:\n break\nprint(grid)', 'H,W = map(int,input().split())\ngrid = []\nfor i in range(H):\n row = list(input())\n grid.append(row)\nwhile True:\n r_change = False\n for q in range(len(grid)):\n if "#" not in grid[q]:\n del grid[q]\n r_change = True\n break\n if not r_change:\n break\nwhile True:\n c_change = False\n for k in range(len(grid[0])):\n if "#" not in [row[k] for row in grid]:\n grid = [[row[p] for p in range(len(row)) if p != k] for row in grid]\n c_change = True\n break\n if not c_change:\n break\nfor row in grid:\n print("".join(row))'] | ['Wrong Answer', 'Accepted'] | ['s443351838', 's382964044'] | [3316.0, 3188.0] | [38.0, 37.0] | [593, 622] |
p03273 | u933622697 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['h, w = map(int, input().split())\ngrid = [list(input()) for _ in range(h)]\n\n# Filtering the data if any "#" are existed in the each row or col\n\n# If true, the row is not be deleted\n# (Do not use if statement!)\nrow_compressed_grid = list(filter(lambda row: any(x == "#" for x in row), grid)) \ncompressed_grid = list(filter(lambda col: any(x == "#" for x in col), zip(*row_compressed_grid)))\n\n# list -> string and out\nfor row in compressed_grid:\n print("".join(row))', 'h, w = map(int, input().split())\ngrid = [list(input()) for _ in range(h)]\n\n# Filtering the data if any "#" are existed in the each row or col\n\n# If true, the row is not be deleted\n# (Do not use if statement!)\nrow_compressed_grid = list(filter(lambda row: any(x == "#" for x in row), grid))\ncompressed_grid = list(filter(lambda col: any(x == "#" for x in col), zip(*row_compressed_grid)))\n# list -> string and out\nfor row in zip(*compressed_grid):\n print("".join(row))'] | ['Wrong Answer', 'Accepted'] | ['s916457320', 's898487040'] | [3188.0, 3188.0] | [18.0, 19.0] | [537, 541] |
p03273 | u934442292 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black. Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares: * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns. It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid. | ['import numpy as np\n\nH, W = map(int, input().split())\na = np.array(shape=(H, W), dtype=bool)\nfor i in range(H):\n a[i] = [s == "." for s in input().split()]\n\ny = [True] * H\n i in range(H):\n if all(a[i,:]):\n y[i] = False\n\nx = [True] * W\nfor i in range(W):\n if all(a[:,i]):\n x[i] = False\n\nans = []\nfor i in range(H):\n if not y[i]:\n continue\n s = ""\n for j in range(W):\n if not x[j]:\n continue\n s = "".join([s, "." if a[i,j] else "#"])\n ans.append(s)\n\nprint(*ans, sep="\\n")\n', ' numpy as np\n\nH, W = map(int, input().split())\na = np.zeros(shape=(H, W), dtype=bool)\nfor i in range(H):\n a[i] = [s == "." for s in input().split()]\n\ny = [True] * H\nfor i in range(H):\n if all(a[i,:]):\n y[i] = False\n\nx = [True] * W\nfor i in range(W):\n if all(a[:,i]):\n x[i] = False\n\nans = []\nfor i in range(H):\n if not y[i]:\n continue\n s = ""\n for j in range(W):\n if not x[j]:\n continue\n s = "".join([s, "." if a[i,j] else "#"])\n ans.append(s)\n\nprint(*ans, sep="\\n")\n', ' numpy as np\n\nH, W = map(int, input().split())\na = np.zeros(shape=(H, W), dtype=bool)\nfor i in range(H):\n a[i] = [s == "." for s in input()]\n\ny = [True] * H\nfor i in range(H):\n if all(a[i,:]):\n y[i] = False\n\nx = [True] * W\nfor i in range(W):\n if all(a[:,i]):\n x[i] = False\n\nans = []\nfor i in range(H):\n if not y[i]:\n continue\n s = ""\n for j in range(W):\n if not x[j]:\n continue\n s = "".join([s, "." if a[i,j] else "#"])\n ans.append(s)\n\nprint(*ans, sep="\\n")\n', 'import numpy as np\n\nH, W = map(int, input().split())\na = np.zeros(shape=(H, W), dtype=bool)\nfor i in range(H):\n a[i] = [s == "." for s in input()]\n\ny = [True] * H\nfor i in range(H):\n if all(a[i,:]):\n y[i] = False\n\nx = [True] * W\nfor i in range(W):\n if all(a[:,i]):\n x[i] = False\n\nans = []\nfor i in range(H):\n if not y[i]:\n continue\n s = ""\n for j in range(W):\n if not x[j]:\n continue\n s = "".join([s, "." if a[i,j] else "#"])\n ans.append(s)\n\nprint(*ans, sep="\\n")\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s512361670', 's567194633', 's929599957', 's561666011'] | [2940.0, 2940.0, 2940.0, 12512.0] | [16.0, 17.0, 17.0, 157.0] | [496, 493, 485, 491] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.