s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s064039106
p03574
u472534477
1589047993
Python
PyPy3 (2.4.0)
py
Runtime Error
200
40048
714
import copy H,W=map(int,input().split()) S=[0]*W for i in range(H): S[i]=list(input()+".") S+=[["."]*(W+1)] S2=[["#"]*W]*H for i in range(H): for j in range(W): if S[i][j]=="#": S2[i][j]="#" else: if i==0: im=H else: im=i-1 ...
s088120234
p03574
u924182136
1589006579
Python
Python (3.4.3)
py
Runtime Error
23
3192
2949
H, W = map(int,input().split()) S = [] # for i in range(H): # for j in range(W): # input() for i in range(H): S.append(input()) S_ans = [] for row in S: S_ans.append(list(row)) #print(S) #['.....', '.#.#.', '.....'] #print(S[1][1]) # #と表示される.二次元配列のように扱える! count = 0 for i in range(H): for j in ...
s517138268
p03574
u146346223
1588901104
Python
Python (3.4.3)
py
Runtime Error
19
3188
601
H, W = map(int, input().split()) s = [list(input()) for _ in range(H)] for i in range(H): for j in range(W): if s[i][j] == '.': count = 0 for dx, dy in ( (-1,1), (0,1), (1,1), (-1,0), (0,0), (1,0), (-1,-1),(0,-1),(1,-1) ): ...
s971031425
p03574
u123872895
1588812802
Python
Python (3.4.3)
py
Runtime Error
17
3060
184
l, x, y, s, d = list(map(int, input().split())) if d >= s: a, b = d-s, l-(d-s) else: a, b = l-(s-d), s-d if x >= y: print(a/(x+y)) else: print(min(a/(x+y), b/(y-x)))
s015713034
p03574
u902151549
1588799395
Python
PyPy3 (2.4.0)
py
Runtime Error
235
52972
4069
# coding: utf-8 import re import math from collections import defaultdict import itertools from copy import deepcopy import random from heapq import heappop,heappush import time import os import queue import sys import datetime from functools import lru_cache #@lru_cache(maxsize=None) readline=sys.stdin.readline sys.se...
s673679638
p03574
u070246438
1588721692
Python
Python (3.4.3)
py
Runtime Error
30
3064
490
H,W = map(int,input().split()) src = [input() for i in range(H)] ans = [] for row in src: ans.append(list(row)) dxy=[(-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)] for i in range(H): for j in range(W): c=0 if src[i][j]=="#": continue for dx,dy in dxy: if j+dx<0 or j+d...
s855227915
p03574
u985972698
1588712176
Python
Python (3.4.3)
py
Runtime Error
17
2940
1067
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) const long long INF = 1LL << 60; const int MOD = 1e9 + 7; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<...
s973904081
p03574
u267300160
1588710795
Python
Python (3.4.3)
py
Runtime Error
178
12504
575
import numpy as np H,W = map(int,input().split()) table = [["."]*(W+2),] for _ in range(H): table.append([".",]+list(input())+[".",]) table.append(["."]*(W+2)) table = np.array(table) ans = [] #print(table) for h in range(H): for w in range(W): mawari = table[h:h+3,w:w+3] if mawari.shape != (3,3...
s907676116
p03574
u267300160
1588710648
Python
Python (3.4.3)
py
Runtime Error
175
14536
520
import numpy as np H,W = map(int,input().split()) table = [["."]*(W+2),] for _ in range(H): table.append([".",]+list(input())+[".",]) table.append(["."]*(W+2)) table = np.array(table) ans = [] #print(table) for h in range(H): for w in range(W): mawari = table[h:h+3,w:w+3] #print(mawari) ...
s931735323
p03574
u129898499
1588518690
Python
Python (3.4.3)
py
Runtime Error
17
3064
346
H = int(input()) W = int(input()) name ={} count = 0 for i in range(H): name[i] = input() for j in range(W): if name[i][j] ==".": count = 0 for k in range(i-1,i+2): for l in range(j-1,j+2): if name[k][l] == "#": count += 1 name[i][j] = count for i in range(H): p...
s746595759
p03574
u294384845
1588471785
Python
Python (3.4.3)
py
Runtime Error
33
3572
484
dx=[1,1,1,0,0,-1,-1,-1] dy=[-1,0,1,-1,1,-1,0,1] n,m=map(int,input().split()) s=list() for i in range(n): s.append(input()) ans=[[0 for i in range(n+5)]for i in range(m+5)] for i in range(n): for j in range(m): if s[i][j]=='#': ans[i][j]='#'; else: t=0 for k in range(8): xx=i+dx[k] yy=j+dy[k] ...
s735889270
p03574
u294384845
1588471435
Python
Python (3.4.3)
py
Runtime Error
33
3444
478
dx=[1,1,1,0,0,-1,-1,-1] dy=[-1,0,1,-1,1,-1,0,1] n,m=map(int,input().split()) s=list() for i in range(n): s.append(input()) ans=[[0 for i in range(n+5)]for i in range(m+5)] for i in range(n): for j in range(m): if s[i][j]=='#': ans[i][j]='#'; else: t=0 for k in range(8): xx=i+dx[k] yy=j+dy[k] ...
s352891979
p03574
u886297662
1588264385
Python
Python (3.4.3)
py
Runtime Error
17
3064
492
H, W = map(int, input().split()) S = [] for i in range(H): S.append(list(input())) dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '#': continue cnt = 0 for n in range(8): ni = i + dx[n] nj = j + dy[n] if ni...
s344995050
p03574
u886297662
1588264260
Python
Python (3.4.3)
py
Runtime Error
17
3064
492
H, W = map(int, input().split()) S = [] for i in range(H): S.append(list(input())) dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '#': continue cnt = 0 for n in range(8): ni = i + dx[n] nj = j + dy[n] if ni...
s128209261
p03574
u886297662
1588264126
Python
Python (3.4.3)
py
Runtime Error
17
3064
476
H, W = map(int, input().split()) S = [list(input()) for i in range(H)] dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '#': continue cnt = 0 for n in range(8): ni = i + dx[n] nj = j + dy[n] if ni < 0 or H <= ni ...
s805635377
p03574
u886297662
1588263883
Python
Python (3.4.3)
py
Runtime Error
18
3064
444
H, W = map(int, input().split()) S = [list(input()) for i in range(H)] dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '.': cnt = 0 for n in range(8): ni = i + dx[n] nj = j + dy[n] if ni < 0 or H <= ni or nj...
s665369036
p03574
u886297662
1588263562
Python
Python (3.4.3)
py
Runtime Error
17
3064
472
H, W = map(int, input().split()) S = [list(input()) for i in range(H)] dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '.': cnt = 0 for n in range(8): ni = i + dx[n] nj = j + dy[n] if ni < 0 or ni >= H: ...
s936780194
p03574
u886297662
1588263078
Python
Python (3.4.3)
py
Runtime Error
18
3064
490
H, W = map(int, input().split()) S = [list(map(int, input().split())) for i in range(H)] dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '.': cnt = 0 for n in range(8): ni = i + dx[n] nj = j + dy[n] if ni < ...
s935843822
p03574
u886297662
1588262878
Python
Python (3.4.3)
py
Runtime Error
17
3064
485
H, W = map(int, input().split()) S = [list(map(int, input().split())) for i in range(H)] dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '.': cnt = 0 for n in range(8): ni = i + dx[n] nj = j + dy[n] if ni < ...
s882126696
p03574
u886297662
1588262819
Python
Python (3.4.3)
py
Runtime Error
17
3064
479
H, W = map(int, input().split()) S = [list(map(int, input().split())) for i in range(H)] dx = [-1, -1, -1, 0, 0, 1, 1, 1] dy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(H): for j in range(W): if s[i][j] == '.': cnt = 0 for n in range(8): ni = i + dx nj = j + dy if ni < 0 or n...
s093794018
p03574
u886297662
1588261859
Python
Python (3.4.3)
py
Runtime Error
17
3064
571
H, W = map(int, input().split()) S = [list(map(int, input().split())) for i in range(H)] for i in range(H): for j in range(W): if s[i][j] == '.': cnt = 0 if S[i-1][j-1] == '#': cnt += 1 if S[i-1][j] == '#': cnt += 1 if S[i-1][j+1] == '#': cnt += 1 if S[i][j-1...
s471676421
p03574
u056358163
1588182385
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38640
415
# ABC075 B-Minesweeper import numpy as np H, W = map(int, input().split()) s = np.zeros((H+2, W+2)) for i in range(H): S = input() for j, v in enumerate(S): if v == '#': s[i+1, j+1] = 1 for i in range(H): ans = '' for j in range(W): if s[i+1, j+1] == 1: ans += ...
s730507516
p03574
u437215432
1587932061
Python
Python (3.4.3)
py
Runtime Error
147
12396
733
# ABC075B import numpy as np h, w = map(int, input().split()) board = sp.reshape(np.array(np.repeat("@", (h+2)*(w+2))), (h+2, w+2)) for i in range(h): s = input() board[i+1, 1:w+1] = np.array(list(s)) for i in range(1, h+1): count = np.zeros(w, dtype=str) for j in range(1, w+1): if board[i,j] ...
s079787873
p03574
u437215432
1587932034
Python
Python (3.4.3)
py
Runtime Error
174
13612
733
# ABC075B import numpy as np h, w = map(int, input().split()) board = sp.reshape(np.array(sp.repeat("@", (h+2)*(w+2))), (h+2, w+2)) for i in range(h): s = input() board[i+1, 1:w+1] = np.array(list(s)) for i in range(1, h+1): count = np.zeros(w, dtype=str) for j in range(1, w+1): if board[i,j] ...
s448499231
p03574
u437215432
1587931998
Python
Python (3.4.3)
py
Runtime Error
176
12640
733
# ABC075B import numpy as np h, w = map(int, input().split()) board = sp.reshape(np.array(sp.repeat("@", (h+2)*(w+2))), (h+2, w+2)) for i in range(h): s = input() board[i+1, 1:w+1] = np.array(list(s)) for i in range(1, h+1): count = sp.zeros(w, dtype=str) for j in range(1, w+1): if board[i,j] ...
s869607665
p03574
u459150945
1587849220
Python
Python (3.4.3)
py
Runtime Error
24
3188
709
H, W = map(int, input().split()) S = [input() for _ in range(H)] newS = [['#' for _ in range(W)] for _ in range(H)] for i in range(H): for j in range(W): if S[i][j] == '.': c = max(0, j-1) d = min(W-1, j+1) if i == 0: cnt = S[i][c:d+1].count('#') ...
s501176017
p03574
u459150945
1587848545
Python
Python (3.4.3)
py
Runtime Error
23
3188
693
H, W = map(int, input().split()) S = [input() for _ in range(H)] newS = [['#']*W for _ in range(H)] for i in range(H): for j in range(W): if S[i][j] == '.': c = max(0, j-1) d = min(W-1, j+1) if i == 0: cnt = S[i][c:d+1].count('#') cnt += S[...
s401371653
p03574
u933129390
1587701958
Python
Python (3.4.3)
py
Runtime Error
25
3572
895
mine = [] h, w = map(int, input().split()) for i in range(h): mine.append(list(input()[:])) ans = [[0 for i in range(w)] for j in range(w)] for i in range(h): for j in range(w): if mine[i][j] == '#': if i != 0: ans[i-1][j] += 1 if j != 0: ans[i][j-...
s963023220
p03574
u440129511
1587397969
Python
Python (3.4.3)
py
Runtime Error
23
3320
1991
h,w=map(int,input().split()) s=[input() for _ in range(h)] l=[[] for _ in range(h)] for i in range(h): for j in range(w): if i==0: if j==0 and s[0][0]=='.': l1=[s[0][1],s[1][0],s[1][1]] l1l=l1.count('#') l[i].append(str(l1l)) elif j==w-...
s949070608
p03574
u787449825
1587337911
Python
Python (3.4.3)
py
Runtime Error
24
3256
3426
h, w = map(int, input().split()) s = [[i for i in input()] for _ in range(h)] count = 0 for i in range(h): for j in range(w): if s[i][j] == '.': if i == 0: if j == 0: if s[i][j+1]=='#': count+=1 if s[i+1][j]=='#': ...
s965346768
p03574
u830588156
1587259893
Python
Python (3.4.3)
py
Runtime Error
18
3064
423
H,W = map(int,input().split()) S = [input().split() for i in range(H)] for i in range(0,H): for j in range(0,W): if (S[i][j] == '.'): count = 0 for a in range(-1,2): for b in range(-1,2): if(0<=i+a<=H-1 and 0<=j+b<=W-1): if(...
s782852101
p03574
u830588156
1587259718
Python
Python (3.4.3)
py
Runtime Error
17
3064
444
H,W = map(int,input('H W=').split()) S = [list(map(int,input().split())) for i in range(H)] for i in range(0,H): for j in range(0,W): if (S[i][j] == '.'): count = 0 for a in range(-1,2): for b in range(-1,2): if(0<=i+a<=H-1 and 0<=j+b<=W-1): ...
s059807251
p03574
u830588156
1587259090
Python
Python (3.4.3)
py
Runtime Error
18
3064
478
H,W = map(int,input('H W=').split()) S = [] for i in range(H): s = list(map(int,input().strip().split())) S.append(s) for i in range(0,H): for j in range(0,W): if (S[i][j] == '.'): count = 0 for a in range(-1,2): for b in range(-1,2): if(0<...
s799417651
p03574
u816631826
1587167370
Python
Python (3.4.3)
py
Runtime Error
28
3188
593
H, W = map(int, input().split()) board = [list(input()) for i in range(H)] ans = board dist = [(1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)] for i in range(H): for j in range(W): if board[i][j] == '#': continue count = 0 for x, y in dist: now...
s894252134
p03574
u816631826
1587167214
Python
Python (3.4.3)
py
Runtime Error
19
3064
591
H, W = map(int, input().split()) board = [list(input()) for i in range(H)] ans = board dist = [(1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)] for i in range(H): for j in range(W): if board[i][j] == '#': continue count = 0 for x, y in dist: now...
s591030301
p03574
u816631826
1587167116
Python
Python (3.4.3)
py
Runtime Error
18
3064
583
H, W = map(int, input().split()) board = [list(input()) for i in range(H)] ans = board dist = [(1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)] count = 0 for i in range(H): for j in range(W): if board[i][j] == '#': continue for x, y in dist: now_x = i +...
s319017366
p03574
u077127204
1587133706
Python
Python (3.4.3)
py
Runtime Error
176
13376
296
import numpy as np H, W = map(int, input().split()) S = np.array([list(input()) for _ in range(H)]) for i in range(H): for j in range(W): if S[i, j] == '.': S[i, j] = dict(zip(*np.unique(S[max(i-1, 0):i+2, max(j-1, 0):j+2], return_counts=True)))['#'] for s in S: print(''.join(s))
s030274912
p03574
u277312083
1587089201
Python
Python (3.4.3)
py
Runtime Error
17
2940
715
3 5 ##### ##### #####h, w = map(int, input().split()) field = [["" for _ in range(w)] for _ in range(h)] for i in range(h): s = input() for j in range(w): field[i][j] = s[j] dx = [1, 1, 0, -1, -1, -1, 0, 1] dy = [0, 1, 1, 1, 0, -1, -1, -1] def numbering(x, y): if field[y][x] == ".": c = 0 ...
s533990796
p03574
u970197315
1587086916
Python
Python (3.4.3)
py
Runtime Error
24
3320
1772
h,w=map(int,input().split()) s=[input() for i in range(h)] a=[[0]*w for i in range(h)] for i in range(h): for j in range(w): t=0 if i==0: if j==0: if s[i][j+1]=="#":t+=1 if s[i+1][j+1]=="#":t+=1 if s[i+1][j]=="#":t+=1 elif 0<j<w-1: if s[i][j+1]=="#":t+=1 if ...
s881184956
p03574
u682686221
1587085535
Python
Python (3.4.3)
py
Runtime Error
17
2940
1375
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) #define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++) #define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend...
s703438190
p03574
u884601206
1586892439
Python
Python (3.4.3)
py
Runtime Error
28
3064
430
h,w=map(int,input().split()) s=[list(input()) for i in range(h)] def bombcount(hi,wi): cnt=0 for x in range(-1,2): for y in range(-1,2): if 0<=hi+x<h-1 and 0<=wi+y<w-1: if s[hi+x][wi+y]=="#": cnt+=1 return cnt for i in range(h): for j in range(w): if s[i][j]=...
s114169020
p03574
u877283726
1586709795
Python
Python (3.4.3)
py
Runtime Error
25
3064
1038
H, W = map(int,input().split()) S = [] for _ in range(H): S.append(input()) ans = [[0 for _ in range(W)] for _ in range(H)] for i in range(H): for j in range(W): if S[i][j] == "#": ans[i][j] = "#" if j-1 >= 0 and ans[i][j-1] != "#": ans[i][j-1] += 1 i...
s860796494
p03574
u440129511
1585773173
Python
Python (3.4.3)
py
Runtime Error
17
3064
1848
h,w=map(int,input().split()) s=[list(input()) for _ in range(h)] for i in range(h): for j in range(w): if i==0: if j==0 and s[0][0]=='.': l1=[s[0][1],s[1][0],s[1][1]] l1l=l1.count('#') s[0][0]=l1l elif j==w-1 and s[0][w-1]=='.': ...
s412692531
p03574
u440129511
1585718504
Python
Python (3.4.3)
py
Runtime Error
17
3064
1848
h,w=map(int,input().split()) s=[list(input()) for _ in range(w)] for i in range(h): for j in range(w): if i==0: if j==0 and s[0][0]=='.': l1=[s[0][1],s[1][0],s[1][1]] l1l=l1.count('#') s[0][0]=l1l elif j==w-1 and s[0][w-1]=='.': ...
s350284428
p03574
u586212264
1585628136
Python
PyPy3 (2.4.0)
py
Runtime Error
202
40688
2848
from collections import deque import heapq import itertools import math from collections import Counter h,w=map(int,input().split()) s=[] neighbor=[-1,0,1] for i in range(h): tmp=list(input()) s.append(tmp) ans=[[-1]*w for i in range(h)] for i in range(h): for j in range(w): cnt=0 if s[i][...
s606772528
p03574
u586212264
1585628041
Python
PyPy3 (2.4.0)
py
Runtime Error
191
40688
2848
from collections import deque import heapq import itertools import math from collections import Counter h,w=map(int,input().split()) s=[] neighbor=[-1,0,1] for i in range(h): tmp=list(input()) s.append(tmp) ans=[[-1]*w for i in range(h)] for i in range(h): for j in range(w): cnt=0 if s[i][...
s909775022
p03574
u586212264
1585627762
Python
PyPy3 (2.4.0)
py
Runtime Error
191
40432
2856
from collections import deque import heapq import itertools import math from collections import Counter h,w=map(int,input().split()) s=[] neighbor=[-1,0,1] for i in range(h): tmp=list(input()) s.append(tmp) ans=[[-1]*w for i in range(h)] for i in range(h): for j in range(w): cnt=0 if s[i][...
s923923476
p03574
u332906195
1585548200
Python
Python (3.4.3)
py
Runtime Error
22
3064
474
H, W = map(int, input().split()) S = ['.' * (W + 2)] + ['.' + input() + '.' for _ in range(H)] + ['.' * (W + 2)] ans = [[] for _ in range(H)] N = [(1, 1), (1, 0), (1, -1), (0, 1), (0, -1), (-1, 1), (-1, 0), (-1, -1)] for h in range(1, H + 1): for w in range(1, W + 1): if S[h][w] == '#': ans[h - ...
s362958874
p03574
u332906195
1585548134
Python
Python (3.4.3)
py
Runtime Error
23
3064
460
H, W = map(int, input().split()) S = ['.' * (W + 2)] + ['.' + input() + '.' for _ in range(H)] + ['.' * (W + 2)] ans = [[] for _ in range(H)] N = [(1, 1), (1, 0), (1, -1), (0, 1), (0, -1), (-1, 1), (-1, 0), (-1, -1)] for h in range(H): for w in range(W): if S[h][w] == '#': ans[h - 1].append('#')...
s653248901
p03574
u756030237
1585500178
Python
Python (3.4.3)
py
Runtime Error
29
3500
3484
import copy h, w = map(int, input().split()) map_list = [] for i in range(h): a_list = list(input()) map_list.append(a_list) ans_list = copy.deepcopy(map_list) # 高さのループ for _h in range(h): # 幅のループ for _w in range(w): # カウント用変数 counter = 0 # 調査座標が"#"だったら回答に#を代入 if map_list[_h][_w] == "...
s588107775
p03574
u691018832
1585242857
Python
Python (3.4.3)
py
Runtime Error
25
3648
3373
import sys input = sys.stdin.readline h, m = map(int, input().split()) s = [''] * h ans = [[0] * m for i in range(h)] for i in range(h): s[i] = input() for i in range(1, h - 1): for j in range(1, m - 1): cnt = 0 if s[i][j] == '.': if s[i - 1][j - 1] == '#': cnt += 1 ...
s061459035
p03574
u512212329
1585009026
Python
Python (3.4.3)
py
Runtime Error
17
2940
46
6 6 #####. #.#.## ####.# .#..#. #.##.. #.#...
s056451130
p03574
u595952233
1584984010
Python
Python (3.4.3)
py
Runtime Error
48
5696
2018
import sys from io import StringIO import unittest def resolve(): h, w = map(int, input().split()) s = [[i for i in input()] for _ in range(w)] ans = [[0]*h for i in range(w)] def put(s, i, j): if 0 <= i-1: s[i-1][j] += 1 if 0 <= i-1 and 0 <= j-1: s[i-1][j-1] +...
s081004016
p03574
u432853936
1584680814
Python
Python (3.4.3)
py
Runtime Error
18
3064
637
h,w = map(int,input().split()) s = [list(input()) for i in range(h)] ans = [[0]*5 for i in range(h)] for i in range(h): for j in range(w): if s[i][j] == "#": for k in range(max(0,i-1),min(h,(i+1)+1)): for l in range(max(0,j-1),min...
s826837280
p03574
u697696097
1584502984
Python
Python (3.4.3)
py
Runtime Error
17
2940
592
def masucnt(masu,i,j): s="." try: s=masu[i][j] except: s="" return 1 if s=="#" else 0 h,w=map(int,input().split()) masu=[""]*h for i in range(h): masu[i]=input().strip() for i in range(h): for j in range(len(masu[i])) n=0 s=masu[i][j] if s=="#" print("#",end="") else: ...
s303129364
p03574
u741144749
1584423179
Python
Python (3.4.3)
py
Runtime Error
17
2940
45
6 6 #####. #.#.## ####.# .#..#. #.##.. #.#...
s360709398
p03574
u767995501
1584290402
Python
Python (3.4.3)
py
Runtime Error
17
3064
2050
''' 8方向走査 '.' は 空き、 '#' は爆弾の1行から複数行の「文字列」が与えられるので Minesweeperのように、空きのマスに周囲8方向にある爆弾の数を埋める。 コンテスト中に実装すると、間違えることがあるので、dy や dx それらを使う部分は 予めスニペットなどで直ぐに読み出せるように準備しておく。 8方向走査の他、4方向走査、2方向走査も出題されるので準備しておく。 「文字列」 は 作成後に変更することができない。 ここでは、「文字列」 を 文字 の 「リスト」 とすることで 変更を可能にしている。 行継続文字はバックスラッシュ(円記号) 例えば if 条件 が長くなった場合、バックスラッシュを入れるこ...
s457457535
p03574
u016901717
1584023698
Python
Python (3.4.3)
py
Runtime Error
17
3060
293
h,w=map(int,input().split()) s=[input for i in range(h)] for i in range(h): l="" for j in range(w): if s[i][j]=="#": l+="#" else: l+=str(sum([t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]])) print(l)
s647106710
p03574
u690037900
1583298302
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38256
557
import numpy as np h,w=map(int,input().split()) L=[[i for i in input()] for i in range(h)] L_first=np.zeros((2,w),dtype=str) L_first2=np.zeros((1,1),dtype=str) L=np.array(L,dtype=str) L=np.insert(L_first,1,L,axis=0) L=np.insert(L,0,L_first2,axis=1) L=np.insert(L,w+1,L_first2,axis=1) ans=np.zeros((h,w),dtype=str) for i ...
s439689337
p03574
u403331159
1583082643
Python
Python (3.4.3)
py
Runtime Error
17
2940
575
H,W=map(int,input().split()) field=[["."]*(W+2)] for i in range(H): field.append(["."]) field[-1].extend(list(input())) #ここらへんミスりそうでこわひ field[-1].append(".") field.append(["."]*(W+2)) print(field) for i in range(1,H+1): for j in range(1,W+1): if field[i][j]=="#": print("#",end="") ...
s098388209
p03574
u541318412
1582946879
Python
Python (3.4.3)
py
Runtime Error
21
3064
834
H, W = map(int, input().split()) #左右に'.'を余分に付けて標準入力からリストを作成 grid = [list('.'+input()+'.') for i in range(H)] #上下にも付けてやる grid.insert(0, list('.' * (W + 2))) #上 grid.append(list('.' * (W + 2))) #下 #答えを入れるリスト ans = [] #付け足した行列はカウントしない for i in range(1, H + 1): for j in range(1, W + 1): if grid[i][j] == '#': a...
s292430005
p03574
u696444274
1582664224
Python
Python (3.4.3)
py
Runtime Error
42
5584
3490
import math import itertools import statistics #n = int(input()) #n, d = list(input().split()) h, w = list(map(int, input().split())) s = [] for i in range(h): s.append(input()) count = 0 for i in range(h): for j in range(w): count = 0 if s[i][j]=='.': if i==0: if j...
s175507223
p03574
u696444274
1582664132
Python
Python (3.4.3)
py
Runtime Error
43
5592
3526
import math import itertools import statistics #n = int(input()) #n, d = list(input().split()) h, w = list(map(int, input().split())) s = [] for i in range(h): s.append(input()) count = 0 for i in range(h): for j in range(w): count = 0 if s[i][j]=='.': if i==0: if j...
s352131709
p03574
u277091362
1582657272
Python
Python (3.4.3)
py
Runtime Error
26
3188
691
H, W = map(int, input().split()) S = [list(input()) for i in range(H)] check_i = [] check_j = [] for i in range(H): if i == 0: check_i = [0, 1] elif i == H-1: check_i = [i-1, i] else: check_i = [i-1, i, i+1] for j in range(W): if S[i][j] == "#": continue ...
s563310016
p03574
u896741788
1582647523
Python
Python (3.4.3)
py
Runtime Error
17
3064
407
n,m=map(int,input().split()) l=["!"*(m+2)]+["!"+input()+"!" for i in range(n)]+["!"*(m+2)] ans=["0"*m for c in range(n)] for i in range(n): for d in range(m): if l[i+1][d+1]==".": ret=0 for a,b in[[1,1],[1,0],[0,1],[-1,-1],[-1,0],[0,-1],[1,-1],[-1,1]] : if l[i+1+a][d+1+b]=="#": ret+...
s902108344
p03574
u210718367
1582644172
Python
Python (3.4.3)
py
Runtime Error
28
3316
478
n,m=map(int,input().split()) b=[] for i in range(n): b.append(input()) ans=[[0]*m for i in range(n)] d=[-1,0,1] for i in range(n): for j in range(m): if b[i][j]=='#': for x in d: for y in d: X=i+x Y=j+y if 0 <= X < n and 0 <= Y < m: ans[X][Y]+=1 import sys...
s167660360
p03574
u207799478
1582601228
Python
Python (3.4.3)
py
Runtime Error
42
4404
972
import math import string def readints(): return list(map(int, input().split())) def nCr(n, r): return math.factorial(n)//math.factorial(n-r)*math.factorial(r) h, w = map(int, input().split()) a = [None]*h for i in range(h): a[i] = input() # print(a) dx = [1, 1, 0-1, -1, -1, 0, 1] dy = [0, 1, 1, 1, 0...
s110589415
p03574
u757030836
1582582823
Python
Python (3.4.3)
py
Runtime Error
21
3064
795
h,w = map(int,input().split()) hwl = [] for _ in range(h): l = list(input()) hwl.append(l) for i in range(h): for j in range(w): if hwl[i][j] == ".": cnt = 0 if i != 0 and j !=0 and hwl[i-1][j-1] == "#": cnt +=1 if i != 0 and hwl[i-1][j] == "#": cnt +=1 ...
s074759283
p03574
u686036872
1581772229
Python
Python (3.4.3)
py
Runtime Error
21
3572
784
H, W = map(int, input().split()) lis=[["."]*(W+2)] for i in range(H): lis+=[["."]+list(input())+["."]] lis += [["."]*(W+2)] for w in range(1, H+1): for h in range(1, W+1): x=0 if lis[h][w] == ".": if lis[h+1][w-1] == "#": x += 1 if lis[h+1][w] == "#": ...
s556921552
p03574
u686036872
1581772144
Python
Python (3.4.3)
py
Runtime Error
21
3572
782
H, W = map(int, input().split()) lis=[["."]*(W+2)] for i in range(H): lis+=[["."]+list(input())+["."]] lis += [["."]*(W+2)] for w in range(1, H+1): for h in range(1, W+1): x=0 if lis[h][w] == ".": if lis[h+1][w-1] == "#": x += 1 if lis[h+1][w] == "#": ...
s225329817
p03574
u686036872
1581771917
Python
Python (3.4.3)
py
Runtime Error
21
3444
774
H, W = map(int, input().split()) lis=[["."]*(W+2)] for i in range(H): lis+=[["."]+list(input())+["."]] lis += [["."]*(W+2)] for w in range(1, H+1): for h in range(1, W+1): x=0 if lis[h][w] == ".": if lis[h+1][w-1] == "#": x += 1 if lis[h+1][w] == "#": ...
s306424860
p03574
u686036872
1581771882
Python
Python (3.4.3)
py
Runtime Error
22
3444
774
H, W = map(int, input().split()) lis=[["."]*(W+2)] for i in range(H): lis+=[["."]+list(input())+["."]] lis += [["."]*(W+2)] for w in range(1, H+1): for h in range(1, W+1): x=0 if lis[h][w] == ".": if lis[h+1][w-1] == "#": x += 1 if lis[h+1][w] == "#": ...
s614721873
p03574
u686036872
1581771832
Python
Python (3.4.3)
py
Runtime Error
22
3572
785
H, W = map(int, input().split()) lis=[["."]*(W+2)] for i in range(H): lis+=[["."]+list(input())+["."]] lis += [["."]*(W+2)] print(lis) for w in range(1, H+1): for h in range(1, W+1): x=0 if lis[h][w] == ".": if lis[h+1][w-1] == "#": x += 1 if lis[h+1][w] =...
s900191220
p03574
u982896977
1581284156
Python
Python (3.4.3)
py
Runtime Error
20
3064
968
h,w = map(int,input().split()) a = ["." for i in range(w+2)] dot_map = [a] for _ in range(h): l = list(input()) l.insert(0, ".") l.append(".") dot_map.append(l) dot_map.append(a) for i in range(1, h+1): for j in range(1,w+1): if dot_map[i][j] == ".": counter = 0 if d...
s905171113
p03574
u982896977
1581284126
Python
Python (3.4.3)
py
Runtime Error
21
3064
969
h,w = map(int,input().split()) a = ["." for i in range(w+2)] dot_map = [a] for _ in range(h): l = list(input()) l.insert(0, ".") l.append(".") dot_map.append(l) dot_map.append(a) for i in range(1, h+1): for j in range(1,w+1): if dot_map[i][j] == ".": counter = 0 if d...
s779461083
p03574
u189487046
1581232041
Python
Python (3.4.3)
py
Runtime Error
22
3188
879
h, w = map(int, input().split()) hwl = [] for _ in range(h): l = list(input()) hwl.append(l) for i in range(h): for j in range(w): if hwl[i][j] == ".": cnt = 0 if i != 0 and j != 0 and hwl[i-1][j-1] == "#": cnt += 1 if i != 0 and hwl[i-1][j] == "#...
s769306403
p03574
u189487046
1581231753
Python
Python (3.4.3)
py
Runtime Error
23
3188
937
h, w = map(int, input().split()) hwl = [] for _ in range(h): l = list(input()) hwl.append(l) for i in range(h): for j in range(w): if hwl[i][j] == ".": cnt = 0 if i != 0 and j != 0 and hwl[i-1][j-1] == "#": cnt += 1 if i != 0 and hwl[i-1][j] == "#...
s454154355
p03574
u728120584
1581129046
Python
Python (3.4.3)
py
Runtime Error
30
3064
545
H, W = map(int, input().split()) S = [] for i in range(H): s = list(input()) for j in range(W): if s[j] == '.': s[j] = 0 S.append(s) dx = [0,1,1,1,0,-1,-1,-1] dy = [1,1,0,-1,-1,-1,0,1] for i in range(H): for j in range(W): for k in range(8): nx = j + dx[k] ...
s170485696
p03574
u268792407
1580918742
Python
Python (3.4.3)
py
Runtime Error
21
3320
2544
h,w=map(int,input().split()) slist=[input() for i in range(h)] for i in range(h): s=slist[i] s_new = "" if i==0: t=slist[1] for j in range(w): if j==0 and s[0]==".": m=0 if s[1]=="#": m+=1 if t[0]=="#": m+=1 if t[1]=="#": m+=1 s_n...
s540138710
p03574
u533885955
1580576908
Python
Python (3.4.3)
py
Runtime Error
18
3064
766
H,W = map(int,input().split()) f = list(str(input()) for i in range(H)) for i in range(H): for j in range(W): if f[i][j] == "#": continue count = 0 if i > 0 and j > 0: if f[i-1][j-1] == "#": count+=1 if i > 0: if f[i-1][j] == "#": count+=1 if i > 0 and j < W...
s291147841
p03574
u309141201
1579839497
Python
Python (3.4.3)
py
Runtime Error
28
3192
3386
H, W = map(int, input().split()) S = [] for _ in range(H): S.append(list(input())) # print(S) for i in range(H): for j in range(W): if S[i][j] == '.': bomb_num = 0 if i == 0: if j == 0: for m in range(2): for k in range(...
s499192926
p03574
u762420987
1579394131
Python
Python (3.4.3)
py
Runtime Error
18
3064
537
H, W = map(int, input().split()) graph = [list(input()) for _ in range(H)] def count_bomb(x, y): bomb = 0 one_steps = ((1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (1, -1), (-1, 1), (-1, -1)) for dx, dy in one_steps: nx, ny = x + dx, y + dy if (0 <= nx < H) and (0 <= ny <= W): if ...
s626385385
p03574
u724152875
1578636672
Python
Python (3.4.3)
py
Runtime Error
26
3444
1137
h,w=map(int,input().split()) li=[] for i in range(h): li.append(list(input())) new_li=[[0]*w for i in range(h)] ##の位置をリストに集める sharp_li=[] for i in range(h): for j in range(w): if li[i][j]=='#': sharp_li.append([i,j]) for k in range(len(sharp_li)): #y行X列を扱う y=sharp...
s917081927
p03574
u134712256
1578597398
Python
Python (3.4.3)
py
Runtime Error
23
3192
1777
h,w = list(map(int,input().split())) s=[i for i in range(h)] for i in range(h): s[i] = input() #0行、0列、hー1行、wー1列が場合わけ、ただし4隅は重複 #s[0][0],s[0][w-1],s[h-1][0],s[h-1][w-1] count = [[0 for i in range(w)]for j in range(h)] for i in range(h): for j in range(w): if s[i][j]=="#": if i==0: if j==0: ...
s273977808
p03574
u724152875
1578436711
Python
Python (3.4.3)
py
Runtime Error
26
3444
1137
h,w=map(int,input().split()) li=[] for i in range(h): li.append(list(input())) new_li=[[0]*w for i in range(h)] ##の位置をリストに集める sharp_li=[] for i in range(h): for j in range(w): if li[i][j]=='#': sharp_li.append([i,j]) for k in range(len(sharp_li)): #y行X列を扱う y=sharp...
s323676991
p03574
u724152875
1578435414
Python
Python (3.4.3)
py
Runtime Error
26
3444
1082
h,w=map(int,input().split()) li=[] for i in range(h): li.append(list(input())) new_li=[[0]*w for i in range(h)] ##の位置をリストに集める sharp_li=[] for i in range(h): for j in range(w): if li[i][j]=='#': sharp_li.append([i,j]) for k in range(len(sharp_li)): x=sharp_li[k][0] y=...
s790505823
p03574
u485566817
1578361226
Python
Python (3.4.3)
py
Runtime Error
17
3064
298
h, w = map(int, input().split()) s = list(input() for _ in range(h)) for i in range(h): ans = "" for j in range(w): if s[i][j] == "#": ans += "#" else: ans += str(sum(k[max(0, j-1):min(w, j+2)]) for k in s[max(0, i-1):min(h, i+2)] print(ans)
s011487140
p03574
u757117214
1577918069
Python
Python (3.4.3)
py
Runtime Error
29
3188
454
H,W=map(int,input().split()) l=[""]*W ll=[["" for i in range(W)] for j in range(H)] for i in range(H): l[i]=[i for i in input()] for h in range(H): for w in range(W): if l[h][w]=="#": ll[h][w]="#" else: cnt=0 for hh in [-1,0,1]: for ww in [-1,0,1]: if 0<=h+hh<H and 0<...
s169679786
p03574
u063073794
1577555251
Python
Python (3.4.3)
py
Runtime Error
17
3064
542
yandy H, W = map(int, input().split()) S = [input() for _ in range(H)] A = [''] * H di = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(1,-1),(-1,1),(-1,-1)] for h in range(H): for w in range(W): if S[h][w] == '#': A[h] += '#' else: c = 0 for d in di: h1 = h...
s079442397
p03574
u609814378
1577234203
Python
Python (3.4.3)
py
Runtime Error
17
2940
1
a
s562075865
p03574
u934052933
1577216352
Python
Python (3.4.3)
py
Runtime Error
25
3064
1044
def main()->None: # gridの処理 # 近傍の座標をdx=[-1,0,1], dy=[-1,0,1]を用いて # (xx, yy) が xx = x + dx , yy = y + dy とできる # 参考:http://prd-xxx.hateblo.jp/entry/2017/10/19/205331 # 入力のグリッドから一点ずつ座標指定して選んでその周囲8マスを調べる。 H, W = map(int, input().split()) src = [input() for _ in range(H)] ans = [] for r...
s273832003
p03574
u717265305
1576983957
Python
Python (3.4.3)
py
Runtime Error
20
3444
569
H,W = map(int, input().split()) S = [list(input()) for _ in range(H)] #データ形式はS[i][j] eight = [[-1,-1],[0,-1],[1,-1], # 周囲8マスの定義 [-1,0],[1,0], [-1,1],[0,1],[1,1]] for i in range(H): for j in range(W): if S[i][j] == '#': for e in eight: target = S[i+e[0]][j+e[1]] if target ...
s914908102
p03574
u717265305
1576983826
Python
Python (3.4.3)
py
Runtime Error
20
3444
559
H,W = map(int, input().split()) S = [list(input()) for _ in range(H)] #データ形式はS[i][j] eight = [[-1,-1],[0,-1],[1,-1], # 周囲8マスの定義 [-1,0],[1,0], [-1,1],[0,1],[1,1]] for i in range(H): for j in range(W): if S[i][j] == '#': for e in eight: target = S[i+e[0]][j+e[1]] if target ...
s770969544
p03574
u898967808
1576469858
Python
Python (3.4.3)
py
Runtime Error
17
3064
494
h,w = map(int,input().split()) ff = [list(input()) for _ in range(h)] d = [[-1,-1],[0,-1],[1,-1], [-1, 0], [1, 0], [-1, 1],[0, 1],[1, 1]] for hi in range(h): for wi in range(w): if f[hi][wi]=='#': pass else: count = 0 for dx,dy in d: x = dx+wi y = dy+hi ...
s790285319
p03574
u760802228
1575684356
Python
Python (3.4.3)
py
Runtime Error
28
3064
966
H, W = map(int, input().split()) matrix = [input() for i in range(H)] ans = "" for h in range(H): for w in range(W): bomb = 0 for i in range(-1, 2): if 0 <= h - 1 and 0 <= w + i < W: if matrix[h - 1][w + i] == "#": ...
s923296601
p03574
u760794812
1575549638
Python
PyPy3 (2.4.0)
py
Runtime Error
233
42604
1137
N,M = map(int,input().split()) Map = [] for _ in range(N): temp = input() Map.append(list(temp)) def check(x): answer = 0 if x == '#': answer +=1 return answer Answer = [] for i in range(N): for j in range(M): if Map[i][j] =='#': Answer.append('#') else: counter = 0 if 0...
s879951571
p03574
u760794812
1575548653
Python
Python (3.4.3)
py
Runtime Error
26
3188
1137
N,M = map(int,input().split()) Map = [] for _ in range(N): temp = input() Map.append(list(temp)) def check(x): answer = 0 if x == '#': answer +=1 return answer Answer = [] for i in range(N): for j in range(M): if Map[i][j] =='#': Answer.append('#') else: counter = 0 if 0...
s104861930
p03574
u151305655
1575239762
Python
Python (3.4.3)
py
Runtime Error
17
2940
477
h,w = map(int,input().split()) Array = [list(map(str,input())) for _ in range(h)] dx = [1,1,0,-1,-1,-1,0,1] dy = [0,1,1,1,0,-1,-1,-1] for i in range(h): for j in range(w): if Array[i][j]='#': continue num=0 for d in range(8): ni = i+dy[d] nj = j+dx[d] if ni<0 or h<=ni: cont...
s548545569
p03574
u151305655
1575239401
Python
Python (3.4.3)
py
Runtime Error
17
2940
470
h,w = map(int,input().split()) Array = [list(map(str,input())) for _ in range(h)] dx = [1,1,0,-1,-1,-1,0,1] dy = [0,1,1,1,0,-1,-1,-1] for i in range(h): for j in range(w): if Array[i][j]='#': continue num=0 for d in range(8): ni = i+dy[d] nj = j+dx[d] if ni<0 or h<=ni: cont...
s958808041
p03574
u151305655
1575239167
Python
Python (3.4.3)
py
Runtime Error
17
3060
469
h,w = map(int,input().split()) Array = [list(map(str,input())) for _ in range(h)] dx = [1,1,0,-1,-1,-1,0,1] dy = [0,1,1,1,0,-1,-1,-1] for i in range(h): for j in range(w): if Array[i][j]='#': continue num=0 for d in range(8): ni = i+dy[d] nj = j+dx[d] if ni<0 or h<=ni: cont...