s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s219938794 | p03999 | u136869985 | 1519787146 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 318 | def main():
s = input()
ans = 0
for i in range((len(s) - 1) ** 2):
tmp = ""
for j in range(len(s)):
tmp += s[j]
if (i >> j) & 1:
tmp += "+"
else:
ans += eval(tmp)
else:
print(ans)
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpqids0cxh/tmp3ekpvieb.py", line 16, in <module>
main()
File "/tmp/tmpqids0cxh/tmp3ekpvieb.py", line 2, in main
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s032579108 | p03999 | u143492911 | 1519710774 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 332 | def main():
s=input()
n=len(s)
sum=0
for i in range(1<<(n-1)):
ans=0
t=""
for j in range(n-1):
if 1&j<<i:
t+=s[ans:j+1]
ans+=j+1
t+="+"
t+=s[ans:]
sum+=eval(t)
print(sum)
if __name__ =="__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmpx2gszo8q/tmpgbksdow_.py", line 17, in <module>
main()
File "/tmp/tmpx2gszo8q/tmpgbksdow_.py", line 2, in main
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s416696513 | p03999 | u143492911 | 1519603144 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 258 | from itertools import combinations
s=input()
ans=0
for i in range(len(s)):
for j in combinations(range(1,len(s)),i):
c=0
s_i=s
for k in j:
s_i=s_i[:k+c]+"+"+s_i[j+c:]
c+=1
ans+=eval(s_i)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpqpcq6br2/tmp82yeqm5l.py", line 2, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s726300865 | p03999 | u143492911 | 1518067187 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 195 | from itertools import product
s=input()
ans=0
t=["","+"]
for i in product(range(2),repeat=len(s)-1):
v=s[0]
for j in range(1,len(s)):
v+=t[i[j-1]+s[j]]
ans+=eval(v)
print(ans) | Traceback (most recent call last):
File "/tmp/tmppnk_uzad/tmpsvmuwj9g.py", line 2, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s970636747 | p03999 | u816631826 | 1516738285 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 90 | s,g=raw_input(),0
for i in range(len(s))
p=int(s[:i])
q=int(s[i+1:)
r=p+q
g+=r
print g | File "/tmp/tmpyqk1lhwa/tmp01cubb5s.py", line 4
q=int(s[i+1:)
^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
| |
s384866323 | p03999 | u402953845 | 1480092882 | Python | Python (2.7.6) | py | Runtime Error | 19 | 2696 | 758 | s = map(int, list(raw_input()))
sum = 0
for i in xrange(0, int(1 << len(s)-1)):
temp_num = 0
for j in xrange(0, len(s)):
cur_num = s[j]
if i % 2 == 1:
temp_num += cur_num
if j != len(s) - 1:
sum += temp_num
temp_num = 0
else:
temp_num += cur_num
i /= 2
if j == len(s) - 1:
sum += temp_num
temp_num = 0
temp_num *= 10
print sum
# renketsu wo riyou sita kaihou ga kirei datta node
def sum(total, s):
r = 0
for i in range(len(s)):
if i == 0:
r = total + int(s)
else:
r += sum(total + int(s[:i]), s[i:])
return r
s = raw_input()
total = 0
print sum(total, s) | File "/tmp/tmp0k3l0ue3/tmp7li1fyz_.py", line 19
print sum
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s829330952 | p03999 | u596276291 | 1476133592 | Python | Python (3.4.3) | py | Runtime Error | 33 | 3188 | 697 |
# all_split("abc") -> [['abc'], ['ab', 'c'], ['a', 'bc'], ['a', 'b', 'c']]
def all_split(s):
ans = []
for i in range(2 ** (len(s) - 1)):
b = list(map(int, format(i, "0" + str(len(s) - 1) + "b")))
ans.append(split(s, b))
return ans
def split(s, split_positions):
assert len(s) - 1 == len(split_positions)
ans = []
pre = 0
for i, is_split in enumerate(split_positions, start=1):
if is_split:
ans.append(s[pre:i])
pre = i
ans.append(s[pre:])
return ans
def main():
s = input()
ans = 0
for a in all_split(s):
ans += eval("+".join(a))
print(ans)
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmp133yt5zn/tmp80qcrdlt.py", line 35, in <module>
main()
File "/tmp/tmp133yt5zn/tmp80qcrdlt.py", line 27, in main
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s880579555 | p03999 | u845995447 | 1475765524 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 655 | def SumIndicatedPoint(pcandid):
point = list(str(pcandid))
conNum = nums[0]
count = 1
sum = 0
for p in point:
if p == '0':
conNum = conNum + nums[count]
elif p == '1':
sum = sum + int(conNum)
conNum = nums[count]
count = count + 1
sum = sum + int(conNum)
#print(str(sum))
return sum
if __name__ == '__main__':
nums = list(input())
#nums.reverse()
pcandidstr = '0' + str(len(nums) - 1) + 'b'
pcandid = 0
maxcandid = int('1' * (len(nums) - 1),2)
#add = format(1,pcandidstr)
ALLSUM = 0
while pcandid <= maxcandid:
ALLSUM = ALLSUM + SumIndicatedPoint(format(pcandid,pcandidstr))
pcandid = pcandid + 1
print(str(ALLSUM)) | Traceback (most recent call last):
File "/tmp/tmpw1tz4j6u/tmpsci3s7m8.py", line 18, in <module>
nums = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s094430283 | p03999 | u392294962 | 1473739187 | Python | Python (3.4.3) | py | Runtime Error | 71 | 3444 | 480 | import ast
def pattern(li, el, space, acc, xs):
if len(li) != 1:
acc.append(el)
acc.append(space)
al = li.pop(0)
pattern(list(li), al, '+', list(acc), xs)
pattern(list(li), al, '', list(acc), xs)
else:
acc.append(el)
acc.append(space)
al = li.pop(0)
acc.append(al)
xs.append(ast.literal_eval(''.join(acc)))
li = list(input())
el = li.pop(0)
xs = []
pattern(list(li), el, '+', [], xs)
pattern(list(li), el, '', [], xs)
print(sum(xs)) | Traceback (most recent call last):
File "/tmp/tmp_kus5ii3/tmpo2npl4u6.py", line 17, in <module>
li = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s998297170 | p03999 | u191667127 | 1473648006 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 670 | from math import factorial
total = 0
def cs(k):
t = 0
for i in range(1,k+1):
t += factorial(k)/(factorial(i)*factorial(k-i))
return t
def combine(l):
t = 0
if l == []:
return 0
for i in range(0,len(l)):
sub1 = []
sub2 = []
for j in range(0,i):
sub1.append(l[j])
for j in range(i,len(l)):
sub2.append(l[j])
#print(sub1)
sub_str = ''.join(sub1)
#print(sub_str)
t += int(sub_str)*cs(len(sub2)) + combine(sub2)
return t
inpt = input()
numbers = []
for n in inpt:
numbers.append(n)
total = combine(numbers)
print(total)
| Traceback (most recent call last):
File "/tmp/tmpa7luzyw7/tmp_1fsouu4.py", line 29, in <module>
inpt = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s574183445 | p03999 | u235516118 | 1473647961 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 230 | S = input()
ans = 0
for i in range(2 ** len(S-1)):
tmp = []
count = 1
while(count != len(S)-1):
if(i % 2 == 1):
tmp.append(S[:count])
count += 1
ans += sum(tmp)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmprzviees6/tmpwkw_c3pp.py", line 1, in <module>
S = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s639190716 | p03999 | u566924053 | 1473645221 | Python | Python (3.4.3) | py | Runtime Error | 44 | 3064 | 400 | # coding: utf-8
S = input()
cnt = 0
ls = []
for i in range(2**(len(S)-1)):
#print(str(bin(i))[2:].zfill(len(S)-1))
bi = list(str(bin(i))[2:].zfill(len(S)-1))
ls.append(bi)
for item in ls:
s = S[0]
for inx, bi in enumerate(item):
if bi == "0":
pass
else:
s = s+"+"
s = s + S[inx+1]
cnt += sum(map(int, s.split("+")))
print(cnt) | Traceback (most recent call last):
File "/tmp/tmpww63sci5/tmpy6746k3f.py", line 3, in <module>
S = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s338503459 | p03999 | u866746776 | 1473642867 | Python | Python (3.4.3) | py | Runtime Error | 40 | 3064 | 203 | def sovle(s):
if len(s) == 0:
return 0
l = len(s)
ans = 0
for i in range(1, l+1):
left = s[:i]
right = s[i:]
ans += int(left) + solve(right)
return ans
s = input().strip()
print(solve(s))
| Traceback (most recent call last):
File "/tmp/tmp7mlrbxke/tmpsy5m5inx.py", line 12, in <module>
s = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s822146559 | p04000 | u825685913 | 1600807948 | Python | Python (3.8.2) | py | Runtime Error | 3388 | 3507008 | 421 | h, w, n = map(int,input().split())
cell = [[0]*w for _ in range(h)]
for _ in range(n):
a, b = map(int,input().split())
for i in range(3):
for j in range(3):
if a-i>=0 and b-j>=0:
cell[a-i-1][b-j-1] += 1
else:
continue
ans = [0]*10
for i in range(h-2):
for j in range(w-2):
s = cell[i][j]
ans[s] += 1
for i in ans:
print(i) | Traceback (most recent call last):
File "/tmp/tmpasjuug9n/tmp2zhvfxge.py", line 1, in <module>
h, w, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s962805240 | p04000 | u825685913 | 1600806208 | Python | Python (3.8.2) | py | Runtime Error | 3385 | 3506508 | 400 | h, w, n = map(int,input().split())
cell = [[0]*w for _ in range(h)]
for _ in range(n):
a, b = map(int,input().split())
cell[a-1][b-1] = 1
ans = [0]*10
for i in range(h-2):
for j in range(w-2):
s = [cell[i][j],cell[i+1][j],cell[i+2][j],cell[i][j+1],cell[i+1][j+1],cell[i+2][j+1],cell[i][j+2],cell[i+1][j+2],cell[i+2][j+2]].count(1)
ans[s] += 1
for i in ans:
print(i) | Traceback (most recent call last):
File "/tmp/tmpiw5aevxe/tmpbry4p3e3.py", line 1, in <module>
h, w, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s963188086 | p04000 | u231685196 | 1599502958 | Python | PyPy3 (7.3.0) | py | Runtime Error | 99 | 74704 | 1976 | import numpy as np
from collections import Counter
h,w,n = map(int,input().split())
d = {}
for i in range(n):
a,b = map(int,input().split())
a,b = a-1,b-1
am1_f = a-1 > 0
ap1_f = a+1 < h-1
bm1_f = b-1 > 0
bp1_f = b+1 < w-1
a_f = a > 0 and a < h-1
b_f = b > 0 and b < w-1
am1 = a-1
ap1 = a+1
bm1 = b-1
bp1 = b+1
if am1_f:
baseid = am1 * w
if b_f:
pid = baseid + b
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bm1_f:
pid = baseid + bm1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bp1_f:
pid = baseid + bp1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if ap1_f:
baseid = ap1*w
if b_f:
pid = baseid + b
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bm1_f:
pid = baseid + bm1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bp1_f:
pid = baseid + bp1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if a_f:
baseid = a * w
if b_f:
pid = baseid + b
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bm1_f:
pid = baseid + bm1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bp1_f:
pid = baseid + bp1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
# print(d)
ans = [0 for i in range(10)]
for val in d.values():
ans[val] += 1
ans[0] = (h-2)*(w-2)-sum(ans)
for a in ans:
print(a) | Traceback (most recent call last):
File "/tmp/tmpkpihc6e4/tmpwtuu01xu.py", line 4, in <module>
h,w,n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s860876073 | p04000 | u074220993 | 1599112736 | Python | Python (3.8.2) | py | Runtime Error | 3385 | 3513980 | 626 | H, W, N = map(int, input().split())
Grid = [[0]*(W-2) for _ in range(H-2)] #3*3正方形を左上のマスで区別。値は正方形内の黒塗りの個数
Ans = [(H-2)*(W-2) if i == 0 else 0 for i in range(10)]
f = lambda x:int(x)-1
Draw = lambda x,y:[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2] #塗りつぶしたマスを含む正方形の座標のリストを返す関数
for _ in range(N):
a, b = map(f, input().split())
for x,y in Draw(a,b): #Ans及びGridの更新
Ans[Grid[x][y]] += -1
Ans[Grid[x][y]+1] += 1
Grid[x][y] += 1
for ans in Ans:print(ans) | Traceback (most recent call last):
File "/tmp/tmpap498m0z/tmpbf9tta0z.py", line 1, in <module>
H, W, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s923800784 | p04000 | u406138190 | 1597170565 | Python | Python (3.8.2) | py | Runtime Error | 3309 | 35868 | 443 | import numpy as np
h,w,n=map(int,input().split())
board=np.zeros((h,w))
for i in range(n):
a,b=map(int,input().split())
board[a-1][b-1]=1
result=[0]*10
for i in range(1,h-1):
for j in range(1,w-1):
tmp=0
tmp=board[i][j]+board[i-1][j]+board[i+1][j]+board[i][j-1]+board[i+1][j-1]+board[i-1][j-1]+board[i][j+1]+board[i-1][j+1]+board[i+1][j+1]
result[int(tmp)]+=1.0
for i in range(10):
print(int(result[i])) | Traceback (most recent call last):
File "/tmp/tmps1zq3llh/tmp8zxgryel.py", line 2, in <module>
h,w,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s376147743 | p04000 | u798316285 | 1594696618 | Python | Python (3.8.2) | py | Runtime Error | 1334 | 128716 | 499 | h,w,n=map(int,input().split())
D=dict()
for i in range(n):
a,b=map(int,input().split())
for p in range(-1,2):
for q in range(-1,2):
aa=a+p
bb=b+q
if 2<=aa<=h-1 and 2<=bb<=w-1:
aabb=str(aa)+str(bb)
if aabb in D:
D[aabb]+=1
else:
D[aabb]=1
ans=[0]*10
V=list(D.values())
for v in V:
ans[v]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
for i in range(10):
print(ans[i]) | Traceback (most recent call last):
File "/tmp/tmp4xn8qtau/tmpa1whmnyf.py", line 1, in <module>
h,w,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s741750649 | p04000 | u883866798 | 1591049791 | Python | Python (3.4.3) | py | Runtime Error | 3203 | 789144 | 375 | x, y, n = map(int, input().split())
box = [[0 for _ in range(y)] for _ in range(x)]
for _ in range(n):
a, b = map(int, input().split())
box[a - 1][b - 1] = 1
table = [0] * 9
for i in range(x - 2):
for j in range(y - 2):
total = sum(box[i][j:j + 3]) + sum(box[i + 1][j:j + 3]) + sum(box[i + 2][j:j + 3])
table[total] += 1
[print(a) for a in table] | Traceback (most recent call last):
File "/tmp/tmpasxlz4_q/tmpnehm_rio.py", line 1, in <module>
x, y, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s682845690 | p04000 | u888100977 | 1590860254 | Python | Python (3.4.3) | py | Runtime Error | 2374 | 166924 | 628 | h, w, n = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]
for _ in range(n):
x, y = map(int, input().split())
x -= 1
y -= 1
for i in surround:
if x + i[0] >= w or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= h:
continue
else:
d[(x+i[0], y + i[1])] += 1
num = [0]*9
for key in d:
if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:
num[d[key]] += 1
num[0] = (h-2)*(w-2) - sum(num)
for ans in num:
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp1g_wmevo/tmp963bap9d.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s516718863 | p04000 | u888100977 | 1590860238 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1384 | 153076 | 628 | h, w, n = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]
for _ in range(n):
x, y = map(int, input().split())
x -= 1
y -= 1
for i in surround:
if x + i[0] >= w or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= h:
continue
else:
d[(x+i[0], y + i[1])] += 1
num = [0]*9
for key in d:
if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:
num[d[key]] += 1
num[0] = (h-2)*(w-2) - sum(num)
for ans in num:
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpfcqlnxa9/tmp0uislibh.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s578938842 | p04000 | u443736699 | 1590522718 | Python | Python (3.4.3) | py | Runtime Error | 3160 | 24112 | 339 | h,w,n = input().split()
h,w,n = int(h), int(w), int(n)
import numpy as np
masu = np.zeros((h,w))
for i in range(n):
x,y = input().split()
x,y = int(x)-1, int(y)-1
masu[x][y] = 1
count = [0] * 10
for i in range(h-2):
for j in range(w-2):
shiro = np.sum(masu[i:i+3,j:j+3])
count[int(shiro)] += 1
print(*count, sep="\n") | Traceback (most recent call last):
File "/tmp/tmpped966ah/tmpfwrww5iq.py", line 1, in <module>
h,w,n = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s953946409 | p04000 | u497952650 | 1590477764 | Python | Python (3.4.3) | py | Runtime Error | 3169 | 349512 | 1270 | import sys
from collections import defaultdict
def input():
return sys.stdin.readline().strip()
def recordnum(a,b):
if not (0 < a < H-1 and 0 < b < W-1):
return
else:
res = M[(a,b)]
for i,j in vector:
res += M[(a+i,b+j)]
num[res] += 1
return
def dfs(a,b,color):
if visited[(a,b)]:
return
recordnum(a,b)
visited[(a,b)] = True
if color == "b":
for i,j in vector:
x = a+i
y = b+j
if 0 < x < H-1 and 0 < y < W-1:
if M[(x,y)]:
dfs(x,y,"b")
else:
dfs(x,y,"w")
else:
##白い箇所から白い箇所への探索はしない
for i,j in vector:
x = a+i
y = b+j
if 0 < x < H-1 and 0 < y < W-1 and M[(x,y)]:
dfs(a,b,"b")
H,W,N = map(int,input().split())
M = defaultdict(int)
visited = defaultdict(int)
ab = []
for _ in range(N):
a,b = map(int,input().split())
ab.append([a-1,b-1])
M[(a-1,b-1)] = 1
vector = [[0,1],[0,-1],[1,0],[-1,0],[1,1],[-1,-1],[1,-1],[-1,1]]
num = [0]*10
for a,b in ab:
dfs(a,b,"b")
num[0] = (H-2)*(W-2) - sum(num)
for i in num:
print(i) | Traceback (most recent call last):
File "/tmp/tmpql7j6rvi/tmplyfjf6c0.py", line 46, in <module>
H,W,N = map(int,input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s701185186 | p04000 | u714642969 | 1589728243 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3612 | 1602184 | 1430 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
H,W,N=map(int,input().split())
a,b=[0]*N,[0]*N
for i in range(N):
a[i],b[i]=map(int1,input().split())
unique_a=list(set(a))
unique_b=list(set(b))
unique_a.sort()
unique_b.sort()
d_a,d_b={},{}
tmp_a=0
if unique_a:
d_a[unique_a[0]]=tmp_a
for i in range(len(unique_a)-1):
tmp_a+=min(unique_a[i+1]-unique_a[i],3)
d_a[unique_a[i+1]]=tmp_a
tmp_b=0
if unique_b:
d_b[unique_b[0]]=tmp_b
for i in range(len(unique_b)-1):
tmp_b+=min(unique_b[i+1]-unique_b[i],3)
d_b[unique_b[i+1]]=tmp_b
c=[[0]*(tmp_b+1) for _ in range(tmp_a+1)]
for i in range(N):
c[d_a[a[i]]][d_b[b[i]]]+=1
s=[[0]*(tmp_b+2) for _ in range(tmp_a+2)]
for i in range(tmp_a+1):
for j in range(tmp_b+1):
s[i+1][j+1]=s[i][j+1]+s[i+1][j]-s[i][j]+c[i][j]
ans=[0]*10
for i in range(tmp_a-1):
for j in range(tmp_b-1):
ans[s[i+3][j+3]-s[i][j+3]-s[i+3][j]+s[i][j]]+=1
ans[0]=(H-2)*(W-2)-sum(ans[1:])
for row in ans:
print(row)
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpv5j0jl9q/tmpl1om2t_u.py", line 51, in <module>
main()
File "/tmp/tmpv5j0jl9q/tmpl1om2t_u.py", line 12, in main
H,W,N=map(int,input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s251354969 | p04000 | u480300350 | 1589689393 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38256 | 9778 | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
from operator import itemgetter # itemgetter(1), itemgetter('key')
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict # subclass of dict. defaultdict(facroty)
# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate # accumulate(iter[, f])
# from functools import reduce # reduce(f, iter[, init])
# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy # to copy multi-dimentional matrix without reference
# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)
from random import shuffle
def main():
mod = 1000000007 # 10^9+7
inf = float('inf') # sys.float_info.max = 1.79...e+308
# inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19
sys.setrecursionlimit(10**6) # 1000 -> 1000000
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def mi_0(): return map(lambda x: int(x)-1, input().split())
def lmi(): return list(map(int, input().split()))
def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
def li(): return list(input())
class TwoDimNode:
def __init__(self, x=None, y=None, parent=None, left=None, right=None):
"""
2 次元二分探索木のためのノード
"""
self.x = x
self.y = y
self.parent = parent
self.left = left
self.right = right
self.flag = True
class TwoDimTree:
def __init__(self, points=[]):
"""
2 次元二分探索木 (kD tree) を作成する
root の深さを 0 として、深さが偶数の場合そこでは x を基準に、奇数の場合 y を基準に二分探索木条件を満たすようにする
"""
# nil の設定
self.nil = TwoDimNode()
self.nil.parent = self.nil
self.nil.left = self.nil
self.nil.right = self.nil
# root の設定
self.root = self.nil
# もし予め一次元の点の集合が与えられるのならバランスする形で kD tree を構築する
self._balance_insert(points)
def preorder_traverse(self, node=None):
node = self.root if node is None else node
if node != self.nil:
print(f"({node.x},{node.y})", end=' ')
self.preorder_traverse(node=node.left)
self.preorder_traverse(node=node.right)
def postorder_traverse(self, node=None):
node = self.root if node is None else node
if node != self.nil:
self.preorder_traverse(node=node.left)
self.preorder_traverse(node=node.right)
print(f"({node.x},{node.y})", end=' ')
def inorder_traverse(self, node=None):
node = self.root if node is None else node
if node != self.nil:
self.preorder_traverse(node=node.left)
print(f"({node.x},{node.y})", end=' ')
self.preorder_traverse(node=node.right)
def _balance_insert(self, seq, depth=0):
# 毎回 x or y をキーとしてソートを行い、中央値をとって insert すれば平衡になる
if seq:
arranged = sorted(seq, key=itemgetter(depth % 2))
mid = len(seq) // 2
self.insert(seq[mid][0], seq[mid][1])
self._balance_insert(arranged[:mid], depth+1)
self._balance_insert(arranged[mid+1:], depth+1)
def insert(self, x, y):
"""
kD tree に値が (x, y) であるノードを O(depth) で挿入する
(コンストラクタで生成した kD tree は平衡であることが保証されるが、insert により生成した部分の平衡性は保証されないことに注意)
"""
trailer = self.nil # (x, y) を挿入するべき nil の一つ前のノードを保存するトレーラポインタ
pos = self.root # (x, y) を挿入するべき nil の場所を探す
depth = 0
while pos != self.nil:
trailer = pos
k, pos_k = (x, pos.x) if depth % 2 == 0 else (y, pos.y)
if k < pos_k:
pos = pos.left
elif pos_k < k:
pos = pos.right
else:
pos.flag ^= pos.flag
pos = pos.left if pos.flag else pos.right
depth += 1
inserted_node = TwoDimNode(x, y, trailer, self.nil, self.nil)
# trailer の depth
depth -= 1
k, trailer_k = (x, trailer.x) if depth % 2 == 0 else (y, trailer.y)
# tree is empty
if trailer == self.nil:
self.root = inserted_node
# どこかのノードの子供の位置に挿入する時
elif k < trailer_k or (k == trailer_k and trailer.flag):
trailer.left = inserted_node
else:
trailer.right = inserted_node
def two_dim_search(self, sx, tx, sy, ty, node=None, depth=0):
"""
kD tree に対し閉区間 D = {(x, y) | sx<=x<=tx, sy<=y<=ty} 内に存在する点を探してリストにまとめて返す (対応する点の個数 k として O(√n + k))
下記のように検索必要性を判断し再帰的に左右の子に対し探索を行えば良い
<-------- node.x -------->
<----------->
少しでも [sx,tx] が左側ゾーン ((-inf, node.x]) に被っていたら検索しておく必要がある
<----->
少しでも [sx, tx] が右側ゾーン ([node.x, inf)) に被っていたら検索しておく必要がある
"""
cnt = 0
node = self.root if node is None else node
# print(f"{node.x} {node.y}")
if depth % 2 == 0:
if node.left != self.nil and sx <= node.x:
cnt += self.two_dim_search(sx, tx, sy, ty, node.left, depth+1)
if sx <= node.x <= tx and sy <= node.y <= ty:
cnt += 1
if node.right != self.nil and tx >= node.x:
cnt += self.two_dim_search(sx, tx, sy, ty, node.right, depth+1)
else:
if node.left != self.nil and sy <= node.y:
cnt += self.two_dim_search(sx, tx, sy, ty, node.left, depth+1)
if sx <= node.x <= tx and sy <= node.y <= ty:
cnt += 1
if node.right != self.nil and ty >= node.y:
cnt += self.two_dim_search(sx, tx, sy, ty, node.right, depth+1)
return cnt
def unvisited_p(d, i, j):
if i in d:
if j in d[i]:
return False
return True
def register(d, i, j):
if i not in d:
d[i] = set()
d[i].add(j)
else:
d[i].add(j)
h, w, n = mi()
points = [lmi() for _ in range(n)]
shuffle(points)
num_of_grids_contains_black = [0] * 10
# kD tree 処理
kd_tree = TwoDimTree()
for x, y in points:
kd_tree.insert(x, y)
d = dict()
for x, y in points:
# print(f"{x} {y} {kd_tree.two_dim_search(x-1, x+1, y-1, y+1)}")
for i in range(x-1, x+2):
for j in range(y-1, y+2):
if 2 <= i <= h-1 and 2 <= j <= w-1 and unvisited_p(d, i, j): # 探索する 3*3 grid のセンター
num_of_grids_contains_black[kd_tree.two_dim_search(i-1, i+1, j-1, j+1)] += 1
register(d, i, j)
num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])
print(*num_of_grids_contains_black, sep='\n')
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmp10x_ts_k/tmp4m6mvsqs.py", line 203, in <module>
main()
File "/tmp/tmp10x_ts_k/tmp4m6mvsqs.py", line 176, in main
h, w, n = mi()
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s540115296 | p04000 | u480300350 | 1589678705 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 7563 | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter # itemgetter(1), itemgetter('key')
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict # subclass of dict. defaultdict(facroty)
# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate # accumulate(iter[, f])
# from functools import reduce # reduce(f, iter[, init])
# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy # to copy multi-dimentional matrix without reference
# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)
from random import shuffle
def main():
mod = 1000000007 # 10^9+7
inf = float('inf') # sys.float_info.max = 1.79...e+308
# inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19
sys.setrecursionlimit(10**6) # 1000 -> 1000000
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def mi_0(): return map(lambda x: int(x)-1, input().split())
def lmi(): return list(map(int, input().split()))
def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
def li(): return list(input())
class TwoDimNode:
def __init__(self, x=None, y=None, parent=None, left=None, right=None):
self.x = x
self.y = y
self.parent = parent
self.left = left
self.right = right
self.flag = True
class TwoDimTree:
def __init__(self):
self.nil = TwoDimNode()
self.nil.parent = self.nil
self.nil.left = self.nil
self.nil.right = self.nil
self.root = self.nil
def preorder_traverse(self, node=None):
if node is None:
node = self.root
if node != self.nil:
print(f"({node.x},{node.y})", end=' ')
self.preorder_traverse(node=node.left)
self.preorder_traverse(node=node.right)
def post_order_traverse(self, node=None):
if node is None:
node = self.root
if node != self.nil:
self.post_order_traverse(node=node.left)
self.post_order_traverse(node=node.right)
print(f"({node.x},{node.y})", end=' ')
def insert(self, x, y):
trailer = self.nil
pos = self.root
depth = 0
while pos != self.nil:
trailer = pos
if depth % 2 == 0:
k, pos_k = x, pos.x
else:
k, pos_k = y, pos.y
if k < pos_k:
pos = pos.left
elif pos_k < k:
pos = pos.right
else:
pos.flag ^= pos.flag
pos = pos.left if pos.flag else pos.right
depth += 1
inserted_node = TwoDimNode(x, y, trailer, self.nil, self.nil)
# trailer の depth
depth -= 1
if depth % 2 == 0:
k, trailer_k = x, trailer.x
else:
k, trailer_k = y, trailer.y
# tree is empty
if trailer == self.nil:
self.root = inserted_node
elif k < trailer_k or (k == trailer_k and trailer.flag):
trailer.left = inserted_node
else:
trailer.right = inserted_node
def two_dim_search(self, sx, tx, sy, ty, node=None, depth=0):
buf = []
if node is None:
node = self.root
# print(f"{node.x} {node.y}")
if depth % 2 == 0:
if node.left != self.nil and sx <= node.x:
buf += self.two_dim_search(sx, tx, sy, ty, node.left, depth+1)
if sx <= node.x <= tx and sy <= node.y <= ty:
buf.append((node.x, node.y))
if node.right != self.nil and tx >= node.x:
buf += self.two_dim_search(sx, tx, sy, ty, node.right, depth+1)
else:
if node.left != self.nil and sy <= node.y:
buf += self.two_dim_search(sx, tx, sy, ty, node.left, depth+1)
if sx <= node.x <= tx and sy <= node.y <= ty:
buf.append((node.x, node.y))
if node.right != self.nil and ty >= node.y:
buf += self.two_dim_search(sx, tx, sy, ty, node.right, depth+1)
return buf
def unvisited_p(d, i, j):
if i in d:
if j in d[i]:
return False
return True
def register(d, i, j):
if i not in d:
d[i] = set()
d[i].add(j)
else:
d[i].add(j)
h, w, n = mi()
points = [lmi() for _ in range(n)]
shuffle(points)
num_of_grids_contains_black = [0] * 10
# kD tree 処理
kd_tree = TwoDimTree()
for x, y in points:
kd_tree.insert(x, y)
# kd_tree.preorder_traverse()
# print('')
# kd_tree.post_order_traverse()
# print('')
d = dict()
for x, y in points:
# print(f"{x} {y} {kd_tree.two_dim_search(x-1, x+1, y-1, y+1)}")
for i in range(x-1, x+2):
for j in range(y-1, y+2):
if 2 <= i <= h-1 and 2 <= j <= w-1 and unvisited_p(d, i, j): # 探索する 3*3 grid のセンター
# print(f"{i} {j}")
# print(kd_tree.two_dim_search(i-1, i+1, j-1, j+1))
num_of_grids_contains_black[len(kd_tree.two_dim_search(i-1, i+1, j-1, j+1))] += 1
register(d, i, j)
num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])
print(*num_of_grids_contains_black, sep='\n')
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmpevgxa69t/tmpqjicmecv.py", line 177, in <module>
main()
File "/tmp/tmpevgxa69t/tmpqjicmecv.py", line 141, in main
h, w, n = mi()
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s184114744 | p04000 | u480300350 | 1589678645 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38256 | 7563 | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter # itemgetter(1), itemgetter('key')
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict # subclass of dict. defaultdict(facroty)
# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate # accumulate(iter[, f])
# from functools import reduce # reduce(f, iter[, init])
# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy # to copy multi-dimentional matrix without reference
# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)
from random import shuffle
def main():
mod = 1000000007 # 10^9+7
inf = float('inf') # sys.float_info.max = 1.79...e+308
# inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19
sys.setrecursionlimit(10**6) # 1000 -> 1000000
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def mi_0(): return map(lambda x: int(x)-1, input().split())
def lmi(): return list(map(int, input().split()))
def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
def li(): return list(input())
class TwoDimNode:
def __init__(self, x=None, y=None, parent=None, left=None, right=None):
self.x = x
self.y = y
self.parent = parent
self.left = left
self.right = right
self.flag = True
class TwoDimTree:
def __init__(self):
self.nil = TwoDimNode()
self.nil.parent = self.nil
self.nil.left = self.nil
self.nil.right = self.nil
self.root = self.nil
def preorder_traverse(self, node=None):
if node is None:
node = self.root
if node != self.nil:
print(f"({node.x},{node.y})", end=' ')
self.preorder_traverse(node=node.left)
self.preorder_traverse(node=node.right)
def post_order_traverse(self, node=None):
if node is None:
node = self.root
if node != self.nil:
self.post_order_traverse(node=node.left)
self.post_order_traverse(node=node.right)
print(f"({node.x},{node.y})", end=' ')
def insert(self, x, y):
trailer = self.nil
pos = self.root
depth = 0
while pos != self.nil:
trailer = pos
if depth % 2 == 0:
k, pos_k = x, pos.x
else:
k, pos_k = y, pos.y
if k < pos_k:
pos = pos.left
elif pos_k < k:
pos = pos.right
else:
pos.flag ^= pos.flag
pos = pos.left if pos.flag else pos.right
depth += 1
inserted_node = TwoDimNode(x, y, trailer, self.nil, self.nil)
# trailer の depth
depth -= 1
if depth % 2 == 0:
k, trailer_k = x, trailer.x
else:
k, trailer_k = y, trailer.y
# tree is empty
if trailer == self.nil:
self.root = inserted_node
elif k < trailer_k or (k == trailer_k and trailer.flag):
trailer.left = inserted_node
else:
trailer.right = inserted_node
def two_dim_search(self, sx, tx, sy, ty, node=None, depth=0):
buf = []
if node is None:
node = self.root
# print(f"{node.x} {node.y}")
if depth % 2 == 0:
if node.left != self.nil and sx <= node.x:
buf += self.two_dim_search(sx, tx, sy, ty, node.left, depth+1)
if sx <= node.x <= tx and sy <= node.y <= ty:
buf.append((node.x, node.y))
if node.right != self.nil and tx >= node.x:
buf += self.two_dim_search(sx, tx, sy, ty, node.right, depth+1)
else:
if node.left != self.nil and sy <= node.y:
buf += self.two_dim_search(sx, tx, sy, ty, node.left, depth+1)
if sx <= node.x <= tx and sy <= node.y <= ty:
buf.append((node.x, node.y))
if node.right != self.nil and ty >= node.y:
buf += self.two_dim_search(sx, tx, sy, ty, node.right, depth+1)
return buf
def unvisited_p(d, i, j):
if i in d:
if j in d[i]:
return False
return True
def register(d, i, j):
if i not in d:
d[i] = set()
d[i].add(j)
else:
d[i].add(j)
h, w, n = mi()
points = [lmi() for _ in range(n)]
shuffle(points)
num_of_grids_contains_black = [0] * 10
# kD tree 処理
kd_tree = TwoDimTree()
for x, y in points:
kd_tree.insert(x, y)
# kd_tree.preorder_traverse()
# print('')
# kd_tree.post_order_traverse()
# print('')
d = dict()
for x, y in points:
# print(f"{x} {y} {kd_tree.two_dim_search(x-1, x+1, y-1, y+1)}")
for i in range(x-1, x+2):
for j in range(y-1, y+2):
if 2 <= i <= h-1 and 2 <= j <= w-1 and unvisited_p(d, i, j): # 探索する 3*3 grid のセンター
# print(f"{i} {j}")
# print(kd_tree.two_dim_search(i-1, i+1, j-1, j+1))
num_of_grids_contains_black[len(kd_tree.two_dim_search(i-1, i+1, j-1, j+1))] += 1
register(d, i, j)
num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])
print(*num_of_grids_contains_black, sep='\n')
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmpu5zhrj7c/tmp2bnoluw8.py", line 177, in <module>
main()
File "/tmp/tmpu5zhrj7c/tmp2bnoluw8.py", line 141, in main
h, w, n = mi()
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s769551067 | p04000 | u020604402 | 1589616114 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 783 | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
matrix.append([x-1,y-1])
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + ' ' +str(nowy)
if name in cand : cand[name] += 1
else: cand[name] = 1
tmp = ((H - 2) * (W - 2))
[ans[x]+=1 for x in cand.values()]
ans[0] -= len(cand)
for x in ans:
print(x)
| File "/tmp/tmp4gexgqia/tmpyjz9jtv7.py", line 22
[ans[x]+=1 for x in cand.values()]
^^
SyntaxError: invalid syntax
| |
s440256731 | p04000 | u020604402 | 1589615645 | Python | Python (3.4.3) | py | Runtime Error | 463 | 21984 | 830 | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + ' ' +str(nowy)
if not name in cand : cand[name] += 1
else: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
ans[x] += 1
tmp -= 1
ans[0] = tmp
for x in ans:
print(x)
| Traceback (most recent call last):
File "/tmp/tmpld0rztye/tmp97c0v0i4.py", line 1, in <module>
H, W , N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s879761600 | p04000 | u020604402 | 1589604968 | Python | Python (3.4.3) | py | Runtime Error | 2346 | 143372 | 809 | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) +str(nowy)
try: cand[name] += 1
except: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
ans[x] += 1
tmp -= 1
ans[0] = tmp
for x in ans:
print(x)
| Traceback (most recent call last):
File "/tmp/tmpaamrspfx/tmp6h27qd8e.py", line 1, in <module>
H, W , N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s359297279 | p04000 | u020604402 | 1589604173 | Python | Python (3.4.3) | py | Runtime Error | 3155 | 143376 | 876 | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + str(nowy)
try: cand[name] += 1
except: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
if x == 9:
while True:
print(W)
ans[x] += 1
tmp -= 1
ans[0] = tmp
for x in ans:
print(x)
| Traceback (most recent call last):
File "/tmp/tmpsld0obt6/tmp1p3k0llc.py", line 1, in <module>
H, W , N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s278998716 | p04000 | u020604402 | 1589604047 | Python | Python (3.4.3) | py | Runtime Error | 3162 | 169536 | 910 | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + str(nowy)
print(nowx,nowy,name)
try: cand[name] += 1
except: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
if x == 9:
while True:
print(W)
ans[x] += 1
tmp -= 1
ans[0] = tmp
for x in ans:
print(x)
| Traceback (most recent call last):
File "/tmp/tmpvgasvjio/tmpx_pqfu83.py", line 1, in <module>
H, W , N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s153113993 | p04000 | u020604402 | 1589603141 | Python | Python (3.4.3) | py | Runtime Error | 2331 | 143376 | 913 | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
from bisect import bisect_left
cand = {}
try:
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + str(nowy)
try: cand[name] += 1
except: cand[name] = 1
except: pass
tmp = ((H - 2) * (W - 2))
for x in cand.values():
ans[x] += 1
tmp -= 1
ans[0] = tmp
for x in ans:
print(x)
| Traceback (most recent call last):
File "/tmp/tmplgiu_gww/tmptvuvdegl.py", line 1, in <module>
H, W , N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s652255550 | p04000 | u020604402 | 1589602786 | Python | Python (3.4.3) | py | Runtime Error | 2236 | 143376 | 860 | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
from bisect import bisect_left
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + str(nowy)
try: cand[name] += 1
except: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
ans[x] += 1
tmp -= 1
ans[0] =tmp
for x in ans:
print(x)
| Traceback (most recent call last):
File "/tmp/tmpbmierhdi/tmp0_hm13vs.py", line 1, in <module>
H, W , N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s261845566 | p04000 | u366541443 | 1588551399 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2839 | 222148 | 2932 | import math
import fractions
import sys
input = sys.stdin.readline
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
def ValueToBits(x,digit):
res = [0 for i in range(digit)]
now = x
for i in range(digit):
res[i]=now%2
now = now >> 1
return res
def BitsToValue(arr):
n = len(arr)
ans = 0
for i in range(n):
ans+= arr[i] * 2**i
return ans
def ZipArray(a):
aa = [[a[i],i]for i in range(n)]
aa.sort(key = lambda x : x[0])
for i in range(n):
aa[i][0]=i+1
aa.sort(key = lambda x : x[1])
b=[aa[i][0] for i in range(len(a))]
return b
def ValueToArray10(x, digit):
ans = [0 for i in range(digit)]
now = x
for i in range(digit):
ans[digit-i-1] = now%10
now = now //10
return ans
def Zeros(a,b):
if(b<=-1):
return [0 for i in range(a)]
else:
return [[0 for i in range(b)] for i in range(a)]
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
i += i & -i
'''
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 2
N = 10 ** 6 + 2
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1] # factinv 計算用
for i in range(2, N + 1):
fact.append((fact[-1] * i) % p)
inv.append((-inv[p % i] * (p // i)) % p)
factinv.append((factinv[-1] * inv[-1]) % p)
'''
#a = list(map(int, input().split()))
#################################################
#################################################
#################################################
#################################################
h,w,n = list(map(int, input().split()))
painted = []
for i in range(n):
t = list(map(int, input().split()))
for j in range(3):
for k in range(3):
painted.append([t[0]-2+j, t[1]-2+k])
painted.sort(key = lambda x : x[1])
painted.sort(key = lambda x : x[0])
p2 = []
for i in painted:
if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):
p2.append(i)
#print(p2)
ans = [0 for i in range(10)]
before = p2[0]
chain = 1
for ii in range(len(p2)-1):
i = ii+1
if(p2[i][0] == before[0] and p2[i][1] == before[1]):
chain += 1
else:
ans[chain]+=1
chain=1
before[0],before[1] = p2[i]
ans[chain]+=1
ans[0] = (h-2)*(w-2) - sum(ans[1:])
for i in ans:
print(i)
| Traceback (most recent call last):
File "/tmp/tmpam46cskz/tmp4y2xh0g_.py", line 101, in <module>
h,w,n = list(map(int, input().split()))
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s969725851 | p04000 | u366541443 | 1588551357 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3167 | 217548 | 739 |
h,w,n = list(map(int, input().split()))
painted = []
for i in range(n):
t = list(map(int, input().split()))
for j in range(3):
for k in range(3):
painted.append([t[0]-2+j, t[1]-2+k])
painted.sort(key = lambda x : x[1])
painted.sort(key = lambda x : x[0])
p2 = []
for i in painted:
if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):
p2.append(i)
#print(p2)
ans = [0 for i in range(10)]
before = p2[0]
chain = 1
for ii in range(len(p2)-1):
i = ii+1
if(p2[i][0] == before[0] and p2[i][1] == before[1]):
chain += 1
else:
ans[chain]+=1
chain=1
before[0],before[1] = p2[i]
ans[chain]+=1
ans[0] = (h-2)*(w-2) - sum(ans[1:])
for i in ans:
print(i)
| Traceback (most recent call last):
File "/tmp/tmpisozn0fu/tmpyx5ndtjr.py", line 2, in <module>
h,w,n = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s692159861 | p04000 | u366541443 | 1588551215 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3166 | 215604 | 2927 | import math
import fractions
#import sys
#input = sys.stdin.readline
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
def ValueToBits(x,digit):
res = [0 for i in range(digit)]
now = x
for i in range(digit):
res[i]=now%2
now = now >> 1
return res
def BitsToValue(arr):
n = len(arr)
ans = 0
for i in range(n):
ans+= arr[i] * 2**i
return ans
def ZipArray(a):
aa = [[a[i],i]for i in range(n)]
aa.sort(key = lambda x : x[0])
for i in range(n):
aa[i][0]=i+1
aa.sort(key = lambda x : x[1])
b=[aa[i][0] for i in range(len(a))]
return b
def ValueToArray10(x, digit):
ans = [0 for i in range(digit)]
now = x
for i in range(digit):
ans[digit-i-1] = now%10
now = now //10
return ans
def Zeros(a,b):
if(b<=-1):
return [0 for i in range(a)]
else:
return [[0 for i in range(b)] for i in range(a)]
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
i += i & -i
'''
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 2
N = 10 ** 6 + 2
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1] # factinv 計算用
for i in range(2, N + 1):
fact.append((fact[-1] * i) % p)
inv.append((-inv[p % i] * (p // i)) % p)
factinv.append((factinv[-1] * inv[-1]) % p)
'''
#a = list(map(int, input().split()))
#################################################
#################################################
#################################################
#################################################
h,w,n = list(map(int, input().split()))
painted = []
for i in range(n):
t = list(map(int, input().split()))
for j in range(3):
for k in range(3):
painted.append([t[0]-2+j, t[1]-2+k])
painted.sort(key = lambda x : x[1])
painted.sort(key = lambda x : x[0])
p2 = []
for i in painted:
if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):
p2.append(i)
#print(p2)
ans = [0 for i in range(10)]
before = p2[0]
chain = 1
for ii in range(len(p2)-1):
i = ii+1
if(p2[i][0] == before[0] and p2[i][1] == before[1]):
chain += 1
else:
ans[chain]+=1
chain=1
before = list(p2[i])
ans[chain]+=1
ans[0] = (h-2)*(w-2) - sum(ans[1:])
for i in ans:
print(i)
| Traceback (most recent call last):
File "/tmp/tmp2z4qxq1e/tmplspd6jhc.py", line 101, in <module>
h,w,n = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s459826378 | p04000 | u366541443 | 1588551169 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3011 | 217548 | 713 | h,w,n = list(map(int, input().split()))
painted = []
for i in range(n):
t = list(map(int, input().split()))
for j in range(3):
for k in range(3):
painted.append([t[0]-2+j, t[1]-2+k])
painted.sort(key = lambda x : x[1])
painted.sort(key = lambda x : x[0])
p2 = []
for i in painted:
if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):
p2.append(i)
#print(p2)
ans = [0 for i in range(10)]
before = p2[0]
chain = 1
for ii in range(len(p2)-1):
i = ii+1
if(p2[i][0] == before[0] and p2[i][1] == before[1]):
chain += 1
else:
ans[chain]+=1
chain=1
before = list(p2[i])
ans[chain]+=1
ans[0] = (h-2)*(w-2) - sum(ans[1:])
print(ans) | Traceback (most recent call last):
File "/tmp/tmpm8uytiot/tmp7yp2u4cb.py", line 1, in <module>
h,w,n = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s919832070 | p04000 | u922851354 | 1588522645 | Python | Python (3.4.3) | py | Runtime Error | 3161 | 32340 | 474 | import numpy as np
h, w, n=map(int, input().split())
ini_state=np.zeros((h, w))
for i in range(n):
a, b=map(int, input().split())
ini_state[a-1, b-1]=1
counts=[]
for i in range(h-2):
for j in range(w-2):
square=ini_state[i:i+3, j:j+3]
counts.append(np.sum(square))
def count_num(x, a):
count=0
for y in x:
if y==a:
count+=1
return count
for j in range(10):
res=count_num(counts, j)
print(res)
| Traceback (most recent call last):
File "/tmp/tmpver4h9ct/tmpjs7cdm12.py", line 3, in <module>
h, w, n=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s429970862 | p04000 | u578323547 | 1588295324 | Python | Python (3.4.3) | py | Runtime Error | 3327 | 1693556 | 936 | h,w,n = map(int, input().split())
painted = []
for i in range(h):
l = [0] * w
painted.append(l)
first_painted = []
last_painted = []
for i in range(n):
y,x = map(int, input().split())
y,x = y-1,x-1
if (i == 0):
first_painted = [y,x]
if (i == n-1):
last_painted = [y,x]
for n in range(y-1, y+2):
if(n < 0 or n > h-1):
continue
for m in range(x-1, x+2):
if(m < 0 or m > w-1):
continue
painted[n][m] += 1
for j in range(9):
count = 0
if (len(first_painted) > 0):
y_start = max(1, first_painted[y]-1)
y_end = min(h-1, last_painted[y]+1)
x_start = max(1, first_painted[x]-1)
x_end = min(w-1, last_painted[x]+1)
for n in range(y_start, y_end+1):
for m in range(x_start, x_end+1):
if(painted[n][m] == j):
count += 1
print(count) | Traceback (most recent call last):
File "/tmp/tmpp8u1y6aw/tmpk1i23e_0.py", line 1, in <module>
h,w,n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s330435865 | p04000 | u189479417 | 1587743680 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3894 | 1279804 | 628 | H, W, N = map(int,input().split())
ans = [0] * 10
points = []
MAP = [[0] * W for _ in range(H)]
for _ in range(N):
a, b = map(int,input().split())
MAP[a-1][b-1] = 1
points.append([a-1, b-1])
for i in range(N):
a, b = points[i]
for p in range(-1, 2):
for q in range(-1, 2):
cnt = 0
if 1 <= a + p <= H - 2 and 1 <= b + q <= W - 2:
for h in range(-1, 2):
cnt += sum(MAP[a + p + h][b + q - 1: b + q + 2])
ans[cnt] += 1
for i in range(1,10):
ans[i] //= i
SUM = sum(ans[1:])
ans[0] = (H-2) * (W-2) - SUM
for i in ans:
print(i) | Traceback (most recent call last):
File "/tmp/tmpijr9b5ts/tmp30t688hs.py", line 1, in <module>
H, W, N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s318885573 | p04000 | u519923151 | 1587737225 | Python | Python (3.4.3) | py | Runtime Error | 3157 | 27380 | 356 | H,W,N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
dp=[0]*10
for h in range(1,H-1):
for w in range(1,W-1):
s = 0
for i in range(0,N):
if ab[i][0] >= h and ab[i][0] <= h+2 and ab[i][1] >= w and ab[i][1] <=w+2:
s = s+1
dp[s] += 1
for i in dp:
print(dp[i]) | Traceback (most recent call last):
File "/tmp/tmp41a8mlgo/tmpw4v4ctbt.py", line 1, in <module>
H,W,N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s378474643 | p04000 | u437215432 | 1587681602 | Python | Python (3.4.3) | py | Runtime Error | 3163 | 44484 | 691 | import numpy as np
def ABC045D(h, w, n, ab):
board = np.zeros((h, w), dtype=int)
for a, b in ab:
board[a-1, b-1] = 1
ans = np.zeros(10, dtype=int)
if h >= 3 and w >= 3:
for i in range(1, h-1):
for j in range(1, w-1):
count = board[i-1, j-1] + board[i, j-1] + board[i+1, j-1] +\
board[i-1, j] + board[i, j] + board[i+1, j] +\
board[i-1, j+1] + board[i, j+1] + board[i+1, j+1]
ans[count] += 1
for i in ans:
print(i)
h, w, n = map(int, input().split())
ab = [0] * n
for i in range(n):
ab[i] = list(map(int, input().split()))
ABC045D(h, w, n, ab)
| Traceback (most recent call last):
File "/tmp/tmpo4_8icin/tmpu9njgwp9.py", line 18, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s871966472 | p04000 | u559200744 | 1587430275 | Python | PyPy3 (2.4.0) | py | Runtime Error | 574 | 81368 | 445 | H, W, N = input().split(" ")
H, W, N = int(H), int(W), int(N)
A = [input().split(" ") for i in range(N)]
A = [[int(l[0])-1, int(l[1])-1] for l in A]
black_num = [0 for i in range(10)]
import numpy as np
field = np.array([np.array([1 if [i, j] in A else 0 for j in range(W)]) for i in range(H)])
for h in range(H - 3 + 1):
for w in range(W - 3 + 1):
black_num[np.sum(field[h:h+3].T[w:w+3].T)] += 1
for i in black_num:
print(i) | Traceback (most recent call last):
File "/tmp/tmpsb1tqh37/tmpx3blh9hb.py", line 1, in <module>
H, W, N = input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s212110905 | p04000 | u068595072 | 1587031386 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3227 | 1329864 | 1691 | h, w, n = map(int, input().split())
mat = []
for i in range(h+1):
mat += [[0] * (w + 1)]
blacks = []
for i in range(n):
a, b = map(int, input().split())
mat[a][b] = 1
blacks.append([a, b])
d = dict()
def count_blacks(x, y):
b = 0
if mat[x][y] == 1:
b += 1
if mat[x + 1][y] == 1:
b += 1
if mat[x + 2][y] == 1:
b += 1
if mat[x][y+1] == 1:
b += 1
if mat[x + 1][y+1] == 1:
b += 1
if mat[x + 2][y+1] == 1:
b += 1
if mat[x][y+2] == 1:
b += 1
if mat[x + 1][y+2] == 1:
b += 1
if mat[x + 2][y+2] == 1:
b += 1
return b
for i in blacks:
x = i[0]
y = i[1]
if 3 <= y + 2 <= w and 1 <= x <= h - 2:
d[(x, y)] = count_blacks(x, y)
if 3 <= y + 2 <= w and 2 <= x <= h - 1:
d[(x - 1, y)] = count_blacks(x-1, y)
if 3 <= y + 2 <= w and 3 <= x <= h:
d[(x - 2, y)] = count_blacks(x - 2, y)
if 3<=y + 1 <= w and 1 <= x <= h - 2:
d[(x, y - 1)] = count_blacks(x, y - 1)
if 3 <= y + 1 <= w and 2 <= x <= h - 1:
d[(x - 1, y - 1)] = count_blacks(x - 1, y - 1)
if 3 <= y + 1 <= w and 3 <= x <= h:
d[(x - 2, y - 1)] = count_blacks(x - 2, y - 1)
if 3<=y<= w and 1 <= x <= h - 2:
d[(x, y - 2)] = count_blacks(x, y - 2)
if 3 <= y <= w and 2 <= x <= h - 1:
d[(x - 1, y - 2)] = count_blacks(x - 1, y - 2)
if 3 <= y <= w and 3 <= x <= h:
d[(x - 2, y - 2)] = count_blacks(x - 2, y - 2)
l = [0]
sums = 0
for i in range(1, 10):
t = 0
for x in d:
if d[x] == i:
t += 1
sums += t
l.append(t)
l[0] = (h - 2) * (w - 2) - sums
for x in l:
print(x) | Traceback (most recent call last):
File "/tmp/tmp91brkrqw/tmpqaws87j3.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s889769793 | p04000 | u068595072 | 1587031358 | Python | Python (3.4.3) | py | Runtime Error | 3323 | 1693676 | 1691 | h, w, n = map(int, input().split())
mat = []
for i in range(h+1):
mat += [[0] * (w + 1)]
blacks = []
for i in range(n):
a, b = map(int, input().split())
mat[a][b] = 1
blacks.append([a, b])
d = dict()
def count_blacks(x, y):
b = 0
if mat[x][y] == 1:
b += 1
if mat[x + 1][y] == 1:
b += 1
if mat[x + 2][y] == 1:
b += 1
if mat[x][y+1] == 1:
b += 1
if mat[x + 1][y+1] == 1:
b += 1
if mat[x + 2][y+1] == 1:
b += 1
if mat[x][y+2] == 1:
b += 1
if mat[x + 1][y+2] == 1:
b += 1
if mat[x + 2][y+2] == 1:
b += 1
return b
for i in blacks:
x = i[0]
y = i[1]
if 3 <= y + 2 <= w and 1 <= x <= h - 2:
d[(x, y)] = count_blacks(x, y)
if 3 <= y + 2 <= w and 2 <= x <= h - 1:
d[(x - 1, y)] = count_blacks(x-1, y)
if 3 <= y + 2 <= w and 3 <= x <= h:
d[(x - 2, y)] = count_blacks(x - 2, y)
if 3<=y + 1 <= w and 1 <= x <= h - 2:
d[(x, y - 1)] = count_blacks(x, y - 1)
if 3 <= y + 1 <= w and 2 <= x <= h - 1:
d[(x - 1, y - 1)] = count_blacks(x - 1, y - 1)
if 3 <= y + 1 <= w and 3 <= x <= h:
d[(x - 2, y - 1)] = count_blacks(x - 2, y - 1)
if 3<=y<= w and 1 <= x <= h - 2:
d[(x, y - 2)] = count_blacks(x, y - 2)
if 3 <= y <= w and 2 <= x <= h - 1:
d[(x - 1, y - 2)] = count_blacks(x - 1, y - 2)
if 3 <= y <= w and 3 <= x <= h:
d[(x - 2, y - 2)] = count_blacks(x - 2, y - 2)
l = [0]
sums = 0
for i in range(1, 10):
t = 0
for x in d:
if d[x] == i:
t += 1
sums += t
l.append(t)
l[0] = (h - 2) * (w - 2) - sums
for x in l:
print(x) | Traceback (most recent call last):
File "/tmp/tmp3477q7ht/tmp410w2yr9.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s217015551 | p04000 | u068595072 | 1587031226 | Python | Python (3.4.3) | py | Runtime Error | 3327 | 1693676 | 1682 | h, w, n = map(int, input().split())
mat = []
for i in range(h+1):
mat += [[0] * (w + 1)]
blacks = []
for i in range(n):
a, b = map(int, input().split())
mat[a][b] = 1
blacks.append([a, b])
d = dict()
def count_blacks(x, y):
b = 0
if mat[x][y] == 1:
b += 1
if mat[x + 1][y] == 1:
b += 1
if mat[x + 2][y] == 1:
b += 1
if mat[x][y+1] == 1:
b += 1
if mat[x + 1][y+1] == 1:
b += 1
if mat[x + 2][y+1] == 1:
b += 1
if mat[x][y+2] == 1:
b += 1
if mat[x + 1][y+2] == 1:
b += 1
if mat[x + 2][y+2] == 1:
b += 1
return b
for i in blacks:
x = i[0]
y = i[1]
if 3 <= y + 2 <= w and 1 <= x <= h - 2:
d[(x, y)] = count_blacks(x, y)
if 3 <= y + 2 <= w and 2 <= x <= h - 1:
d[(x - 1, y)] = count_blacks(x-1, y)
if 3 <= y + 2 <= w and 3 <= x <= h:
d[(x - 2, y)] = count_blacks(x - 2, y)
if 3<=y + 1 <= w and 1 <= x <= h - 2:
d[(x, y - 1)] = count_blacks(x, y - 1)
if 3 <= y + 1 <= w and 2 <= x <= h - 1:
d[(x - 1, y - 1)] = count_blacks(x - 1, y - 1)
if 3 <= y + 1 <= w and 3 <= x <= h:
d[(x - 2, y - 1)] = count_blacks(x - 2, y - 1)
if 3<=y<= w and 1 <= x <= h - 2:
d[(x, y - 2)] = count_blacks(x, y - 2)
if 3 <= y <= w and 2 <= x <= h - 1:
d[(x - 1, y - 2)] = count_blacks(x - 1, y - 2)
if 3 <= y <= w and 3 <= x <= h:
d[(x - 2, y - 2)] = count_blacks(x - 2, y - 2)
l = [0]
for i in range(1, 10):
t = 0
for x in d:
if d[x] == i:
t += 1
l.append(t)
sums = sum(l)
l[0] = (h - 2) * (w - 2) - sums
for x in l:
print(x) | Traceback (most recent call last):
File "/tmp/tmphyn81i_9/tmpropr_8yi.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s189508334 | p04000 | u939198091 | 1586461329 | Python | Python (3.4.3) | py | Runtime Error | 1239 | 108384 | 886 | def solve(h,w,n,black_list):
if len(black_list) == 0:
return [(h-2)*(w-2)]+[0]*9
idx_list = []
for idx, (a,b) in enumerate(black_list):
left = max(0, b-3)
top = max(0, a-3)
bottom = min(top+3, h-a)
for row in range(top, a):
if row+2 >= h:
continue
for col in range(left, b):
if col+2 >= w:
continue
idx_list.append(row*h+col)
set_count = set(idx_list)
idx_list = sorted(idx_list)
ans = [0]*9
now = idx_list[0]
count = 0
for item in idx_list:
if item == now:
count += 1
else:
now = item
ans[count-1] += 1
count = 1
ans[count-1] += 1
return [(h-2)*(w-2)-len(set_count)]+ans
if __name__ == "__main__":
h,w,n = map(int,input().split())
black_list = [tuple(map(int,input().split())) for _ in range(n)]
ret = solve(h,w,n,black_list)
for i in ret:
print(i)
| Traceback (most recent call last):
File "/tmp/tmpm2kd6nop/tmpdj5wytv7.py", line 35, in <module>
h,w,n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s877281856 | p04000 | u613858382 | 1586384703 | Python | Python (3.4.3) | py | Runtime Error | 3329 | 1693428 | 704 | def sub_matrix(i, j):
list_ = []
for n in [i, i+1, i+2]:
for m in [j, j+1, j+2]:
list_.append((n, m))
return list_
inp = input().split(' ')
H = int(inp[0])
W = int(inp[1])
N = int(inp[2])
matrix = [[0]*W for i in range(H)]
for _ in range(N):
i, j = [int(inp) for inp in input().split(' ')]
matrix[i-1][j-1] = 1
counter = [0]*10
for i in range(H-2):
for j in range(W-2):
sum_ = 0
square = sub_matrix(i, j)
for coord in square:
if matrix[coord[0]][coord[1]] == 1:
sum_ += 1
else:
pass
counter[sum_] += 1
for i in counter:
print(i) | Traceback (most recent call last):
File "/tmp/tmpt6cqgmb_/tmpmz5ci1de.py", line 9, in <module>
inp = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s136567826 | p04000 | u292978925 | 1586048516 | Python | Python (3.4.3) | py | Runtime Error | 349 | 21108 | 1445 | #in1 = '10 10 20'
#in2 = ['1 1', '1 4', '1 9', '2 5', '3 10', '4 2', '4 7', '5 9', '6 4', '6 6', '6 7', '7 1', '7 3', '7 7', '8 1', '8 5', '8 10', '9 2', '10 4', '10 9']
#in1 = '1000000000 1000000000 0'
h, w, n = map(int, input().split())
#h, w, n = map(int, in1.split())
idx1 = 0
ab = [[0 for i in range(2)] for j in range(n)]
black_cnt = [0] * 10
black_cnt[0] = (h - 2) * (w - 2)
if n != 0:
while idx1 < n:
x = input().split()
#x = in2[idx1].split()
ab[idx1][0] = int(x[0])
ab[idx1][1] = int(x[1])
idx1 += 1
for idx1 in range(len(in2)):
if ab[idx1][0] < 3:
s = 0
else:
s = ab[idx1][0] - 3
if ab[idx1][0] > h - 2:
l = h - 2
else:
l = ab[idx1][0]
Rrange = range(s, l)
if ab[idx1][1] < 3:
s = 0
else:
s = ab[idx1][1] - 3
if ab[idx1][1] > w - 2:
l = h - 2
else:
l = ab[idx1][1]
Crange = range(s, l)
for nowRow in Rrange:
for nowCol in Crange:
w_black = 0
for idx2 in range(idx1):
if nowRow < ab[idx2][0] <= nowRow + 3 and nowCol < ab[idx2][1] <= nowCol + 3:
w_black += 1
black_cnt[w_black] -= 1
black_cnt[w_black + 1] += 1
for idx1 in range(len(black_cnt)):
print(black_cnt[idx1])
| Traceback (most recent call last):
File "/tmp/tmpxi2joc8i/tmpia3z1gzg.py", line 4, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s943671638 | p04000 | u292978925 | 1586048252 | Python | Python (3.4.3) | py | Runtime Error | 357 | 21108 | 1268 | #in1 = '10 10 20'
#in2 = ['1 1', '1 4', '1 9', '2 5', '3 10', '4 2', '4 7', '5 9', '6 4', '6 6', '6 7', '7 1', '7 3', '7 7', '8 1', '8 5', '8 10', '9 2', '10 4', '10 9']
h, w, n = map(int, input().split())
#h, w, n = map(int, in1.split())
idx1 = 0
ab = [[0 for i in range(2)] for j in range(n)]
while idx1 < n:
x = input().split()
#x = in2[idx1].split()
ab[idx1][0] = int(x[0])
ab[idx1][1] = int(x[1])
idx1 += 1
black_cnt = [0] * 10
black_cnt[0] = (h - 2) * (w - 2)
for idx1 in range(len(in2)):
if ab[idx1][0] < 3:
s = 0
else:
s = ab[idx1][0] - 3
if ab[idx1][0] > h - 2:
l = h - 2
else:
l = ab[idx1][0]
Rrange = range(s, l)
if ab[idx1][1] < 3:
s = 0
else:
s = ab[idx1][1] - 3
if ab[idx1][1] > w - 2:
l = h - 2
else:
l = ab[idx1][1]
Crange = range(s, l)
for nowRow in Rrange:
for nowCol in Crange:
w_black = 0
for idx2 in range(idx1):
if nowRow < ab[idx2][0] <= nowRow + 3 and nowCol < ab[idx2][1] <= nowCol + 3:
w_black += 1
black_cnt[w_black] -= 1
black_cnt[w_black + 1] += 1
for idx1 in range(len(black_cnt)):
print(black_cnt[idx1])
| Traceback (most recent call last):
File "/tmp/tmpg5oi7fhe/tmpjmvfedbq.py", line 3, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s810715414 | p04000 | u292978925 | 1586048170 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1274 | #in1 = '10 10 20'
#in2 = ['1 1', '1 4', '1 9', '2 5', '3 10', '4 2', '4 7', '5 9', '6 4', '6 6', '6 7', '7 1', '7 3', '7 7', '8 1', '8 5', '8 10', '9 2', '10 4', '10 9']
h, w, n = lambda:map(int, input().split())
h, w, n = map(int, in1.split())
idx1 = 0
ab = [[0 for i in range(2)] for j in range(n)]
while idx1 < n:
x = input().split()
#x = in2[idx1].split()
ab[idx1][0] = int(x[0])
ab[idx1][1] = int(x[1])
idx1 += 1
black_cnt = [0] * 10
black_cnt[0] = (h - 2) * (w - 2)
for idx1 in range(len(in2)):
if ab[idx1][0] < 3:
s = 0
else:
s = ab[idx1][0] - 3
if ab[idx1][0] > h - 2:
l = h - 2
else:
l = ab[idx1][0]
Rrange = range(s, l)
if ab[idx1][1] < 3:
s = 0
else:
s = ab[idx1][1] - 3
if ab[idx1][1] > w - 2:
l = h - 2
else:
l = ab[idx1][1]
Crange = range(s, l)
for nowRow in Rrange:
for nowCol in Crange:
w_black = 0
for idx2 in range(idx1):
if nowRow < ab[idx2][0] <= nowRow + 3 and nowCol < ab[idx2][1] <= nowCol + 3:
w_black += 1
black_cnt[w_black] -= 1
black_cnt[w_black + 1] += 1
for idx1 in range(len(black_cnt)):
print(black_cnt[idx1])
| Traceback (most recent call last):
File "/tmp/tmpe06yarzt/tmpfsno8m4v.py", line 3, in <module>
h, w, n = lambda:map(int, input().split())
^^^^^^^
TypeError: cannot unpack non-iterable function object
| |
s222790490 | p04000 | u292978925 | 1586030425 | Python | Python (3.4.3) | py | Runtime Error | 3156 | 5748 | 305 |
f = lambda:map(int, input().split())
h, w, n = f()
d={}
while n:
n -= 1
x, y = f()
for i in range(9):
a = (x + i % 3, y + i // 3)
d[a] = d.get(a, 0) + (h >= a[0] > 2 <a[1] <= w)
c = [list(d.values()).count(i + 1) for i in range(9)]
print((h - 2) * (w - 2) - sum(c), *c)
| Traceback (most recent call last):
File "/tmp/tmptsb5o031/tmpce1p75w3.py", line 4, in <module>
h, w, n = f()
^^^
File "/tmp/tmptsb5o031/tmpce1p75w3.py", line 2, in <lambda>
f = lambda:map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s659599861 | p04000 | u503228842 | 1585955160 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3554 | 1420032 | 917 | H,W,N = map(int,input().split())
g = [[0]*(W+2) for _ in range(H+2)] # 0:white 1:black
a = [0]*N
b = [0]*N
seen = [[False]*(W+2) for _ in range(H+2)]
ans = [0]*10
for i in range(N):
a[i], b[i] = map(int,input().split())
g[a[i]][b[i]] = 1
# 黒マスの周り9領域を探索する
for y,x in zip(a,b):
for dy in range(-1,2):
for dx in range(-1,2):
if 2 <= x + dx <= W-1 and 2 <= y + dy <= H-1:
cy = y+dy # 中心を決める
cx = x+dx
if seen[cy][cx]:
continue
seen[cy][cx] = True
black_cnt = 0
for ddx in range(-1,2):
for ddy in range(-1,2):
black_cnt += g[cy+ddy][cx+ddx]
ans[black_cnt] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])
# for i in range(H+2):
# print(g[i])
for i in range(10):
print(ans[i]) | Traceback (most recent call last):
File "/tmp/tmphldemhq4/tmpn5ibq_18.py", line 1, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s121303985 | p04000 | u503228842 | 1585955137 | Python | Python (3.4.3) | py | Runtime Error | 3324 | 1694708 | 917 | H,W,N = map(int,input().split())
g = [[0]*(W+2) for _ in range(H+2)] # 0:white 1:black
a = [0]*N
b = [0]*N
seen = [[False]*(W+2) for _ in range(H+2)]
ans = [0]*10
for i in range(N):
a[i], b[i] = map(int,input().split())
g[a[i]][b[i]] = 1
# 黒マスの周り9領域を探索する
for y,x in zip(a,b):
for dy in range(-1,2):
for dx in range(-1,2):
if 2 <= x + dx <= W-1 and 2 <= y + dy <= H-1:
cy = y+dy # 中心を決める
cx = x+dx
if seen[cy][cx]:
continue
seen[cy][cx] = True
black_cnt = 0
for ddx in range(-1,2):
for ddy in range(-1,2):
black_cnt += g[cy+ddy][cx+ddx]
ans[black_cnt] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])
# for i in range(H+2):
# print(g[i])
for i in range(10):
print(ans[i]) | Traceback (most recent call last):
File "/tmp/tmp6kj0fyi6/tmp_9zkri0h.py", line 1, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s488963213 | p04000 | u284854859 | 1585077702 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3165 | 169460 | 2009 | import sys
input = sys.stdin.readline
def main():
h,w,n = map(int,input().split())
dg = 10**10
d = dict()
def f(z):
x,y = divmod(z,dg)
if 2 <= x <= h-1 and 2 <= y <= w-1:
return True
else:
False
for i in range(n):
a,b = map(int,input().split())
if f((a-1)*dg + b-1):
if (a-1)*dg + b-1 in d:
d[(a-1)*dg + b-1] += 1
else:
d[(a-1)*dg + b-1] = 1
if f((a-1)*dg + b):
if (a-1)*dg + b in d:
d[(a-1)*dg + b] += 1
else:
d[(a-1)*dg + b] = 1
if f((a-1)*dg + b+1):
if (a-1)*dg + b+1 in d:
d[(a-1)*dg + b+1] += 1
else:
d[(a-1)*dg + b+1] = 1
if f((a)*dg + b-1):
if (a)*dg + b-1 in d:
d[(a)*dg + b-1] += 1
else:
d[(a)*dg + b-1] = 1
if f(a*dg + b):
if a*dg + b in d:
d[a*dg + b] += 1
else:
d[a*dg + b] = 1
if f((a)*dg + b+1):
if (a)*dg + b+1 in d:
d[(a)*dg + b+1] += 1
else:
d[(a)*dg + b+1] = 1
if f((a+1)*dg + b+1):
if (a+1)*dg + b+1 in d:
d[(a+1)*dg + b+1] += 1
else:
d[(a+1)*dg + b+1] = 1
if f((a+1)*dg + b):
if (a+1)*dg + b in d:
d[(a+1)*dg + b] += 1
else:
d[(a+1)*dg + b] = 1
if f((a+1)*dg + b-1):
if (a+1)*dg + b-1 in d:
d[(a+1)*dg + b-1] += 1
else:
d[(a+1)*dg + b-1] = 1
res = [0]*10
cnt = 0
for e in d:
cnt += 1
if cnt > 65535:
d[-1] += 1
else:
print(10)
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmpa3yxn_k3/tmpqc1yvkrc.py", line 89, in <module>
main()
File "/tmp/tmpa3yxn_k3/tmpqc1yvkrc.py", line 5, in main
h,w,n = map(int,input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s539718907 | p04000 | u423585790 | 1585077016 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 1150 | import sys
from collection import defaultdict
input = sys.stdin.readline
def main():
h,w,n = map(int,input().split())
dg = 10**10
d = defaultdict(int)
def f(z):
x,y = divmod(z,dg)
if 2 <= x <= h-1 and 2 <= y <= w-1:
return True
else:
False
for i in range(n):
a,b = map(int,input().split())
if f((a-1)*dg + b-1):
d[(a-1)*dg + b-1] += 1
if f((a-1)*dg + b):
d[(a-1)*dg + b] += 1
if f((a-1)*dg + b+1):
d[(a-1)*dg + b+1] += 1
if f((a)*dg + b-1):
d[(a)*dg + b-1] += 1
if f(a*dg + b):
d[a*dg + b] += 1
if f((a)*dg + b+1):
d[(a)*dg + b+1] += 1
if f((a+1)*dg + b+1):
d[(a+1)*dg + b+1] += 1
if f((a+1)*dg + b):
d[(a+1)*dg + b] += 1
if f((a+1)*dg + b-1):
d[(a+1)*dg + b-1] += 1
res = [0]*10
for e in d:
res[d[e]] += 1
res[0] = (h-2)*(w-2)-sum(res)
for e in res:
print(e)
if __name__ == "__main__":
main()
| File "/tmp/tmp7tmhfz52/tmpmi0v097i.py", line 21
d[(a-1)*dg + b-1] += 1
TabError: inconsistent use of tabs and spaces in indentation
| |
s971919662 | p04000 | u284854859 | 1585075430 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3164 | 160260 | 1591 | import sys
input = sys.stdin.readline
h,w,n = map(int,input().split())
dg = 10**10
d = dict()
def f(z):
x,y = z//dg,z%dg
if 2 <= x <= h-1 and 2 <= y <= w-1:
return True
else:
False
for i in range(n):
a,b = map(int,input().split())
if f(a*dg + b):
if a*dg + b in d:
d[a*dg + b] += 1
else:
d[a*dg + b] = 1
if f((a-1)*dg + b-1):
if (a-1)*dg + b-1 in d:
d[(a-1)*dg + b-1] += 1
else:
d[(a-1)*dg + b-1] = 1
if f((a-1)*dg + b):
if (a-1)*dg + b in d:
d[(a-1)*dg + b] += 1
else:
d[(a-1)*dg + b] = 1
if f((a)*dg + b-1):
if (a)*dg + b-1 in d:
d[(a)*dg + b-1] += 1
else:
d[(a)*dg + b-1] = 1
if f((a+1)*dg + b+1):
if (a+1)*dg + b+1 in d:
d[(a+1)*dg + b+1] += 1
else:
d[(a+1)*dg + b+1] = 1
if f((a+1)*dg + b):
if (a+1)*dg + b in d:
d[(a+1)*dg + b] += 1
else:
d[(a+1)*dg + b] = 1
if f((a)*dg + b+1):
if (a)*dg + b+1 in d:
d[(a)*dg + b+1] += 1
else:
d[(a)*dg + b+1] = 1
if f((a-1)*dg + b+1):
if (a-1)*dg + b+1 in d:
d[(a-1)*dg + b+1] += 1
else:
d[(a-1)*dg + b+1] = 1
if f((a+1)*dg + b-1):
if (a+1)*dg + b-1 in d:
d[(a+1)*dg + b-1] += 1
else:
d[(a+1)*dg + b-1] = 1
res = [0]*9
for e in d:
res[d[e]] += 1
for e in res:
print(e) | Traceback (most recent call last):
File "/tmp/tmpnt9g37m3/tmp5exwexua.py", line 4, in <module>
h,w,n = map(int,input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s883154281 | p04000 | u955251526 | 1584947168 | Python | Python (3.4.3) | py | Runtime Error | 3161 | 109200 | 670 | h, w, n = map(int, input().split())
a = {tuple(map(int, input().split())) for _ in range(n)}
d = {}
c = [0] * 9
def next(x, y):
ret = []
for i in range(max(0, x-2), min(h-2, x+1)):
for j in range(max(0, y-2), min(w-2, y+1)):
ret.append((i, j))
return ret
for x, y in a:
x -= 1
y -= 1
for s, t in next(x, y):
if (s, t) not in d:
count = 0
for i in range(3):
for j in range(3):
if (s + i + 1, t + j + 1) in a:
count += 1
d[(s, t)] = count
c[count] += 1
c[0] = (h-2) * (w-2) - sum(c)
for x in c:
print(x) | Traceback (most recent call last):
File "/tmp/tmps90zs2dc/tmp8zfokpjg.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s178339723 | p04000 | u764401543 | 1584060356 | Python | Python (3.4.3) | py | Runtime Error | 3305 | 1579848 | 597 | h, w, n = map(int, input().split())
lst = [tuple(input().split()) for i in range(n)]
ans = [0] * 10
if n == 0:
ans[0] = 999999996000000004
ans = map(str, ans)
print('\n'.join(ans))
exit(0)
stage = [[0] * w for i in range(h)]
for t in lst:
stage[int(t[0]) - 1][int(t[1]) - 1] = 1
tmp = []
for col in range(h - 3 + 1):
for row in range(w - 3 + 1):
tmp = []
for cc in range(3):
tmp.append(stage[col + cc][row:row+3])
one_list = sum(tmp, [])
c = one_list.count(1)
ans[c] += 1
[print(ans[i]) for i in range(len(ans))]
| Traceback (most recent call last):
File "/tmp/tmp0t2nzdyd/tmpkt541j0e.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s772541186 | p04000 | u893063840 | 1583935700 | Python | Python (3.4.3) | py | Runtime Error | 1754 | 176472 | 447 | from collections import defaultdict
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
d = defaultdict(int)
for a, b in ab:
for hi in range(a - 2, a + 1):
for wi in range(b - 2, b + 1):
if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:
d[(hi, wi)] += 1
cnt = [0] * 9
for v in d.values():
cnt[v] += 1
cnt[0] = (h - 2) * (w - 2) - sum(cnt[1:])
print(*cnt, sep="\n")
| Traceback (most recent call last):
File "/tmp/tmpvjdlm2x4/tmp3ow8r_8y.py", line 3, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s762899253 | p04000 | u350997995 | 1583534025 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3217 | 1241324 | 424 | H,W,N = map(int,input().split())
H,W = H-2,W-2
A = [0]*10
A[0] = W*H
S = [[0]*W for i in range(H)]
for i in range(N):
a,b = map(lambda x:int(x)-1,input().split())
for j in [-1,0,1]:
for k in [-1,0,1]:
h,w = a+j,b+k
if min(h,w)<1 or h>H or w>W:continue
S[h-1][w-1]+=1
s = S[h-1][w-1]
A[s]+=1
A[s-1]-=1
for i in range(10):
print(A[i]) | Traceback (most recent call last):
File "/tmp/tmppo9fsvb3/tmpum7hsqo5.py", line 1, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s256347427 | p04000 | u350997995 | 1583533682 | Python | Python (3.4.3) | py | Runtime Error | 1288 | 12916 | 386 | from collections import Counter
H,W,N = map(int,input().split())
H,W = H-2,W-2
A = [0]*(H*W)
for i in range(N):
a,b = map(lambda x:int(x)-1,input().split())
for j in [-1,0,1]:
for k in [-1,0,1]:
h,w = a+j,b+k
if min(h,w)<1 or h>H or w>W:continue
p = (h-1)*W+(w-1)
A[p]+=1
C = Counter(A)
for i in range(10):
print(C[i]) | Traceback (most recent call last):
File "/tmp/tmpxqd1cv06/tmpyyn58jnf.py", line 2, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s320900506 | p04000 | u476604182 | 1582690275 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 347 | H, W, N, *L = map(int, open('0').read().split())
dic = {}
for a, b in zip(*[iter(L)]*2):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if 0<i and i+2<=H and 0<j and j+2<=W:
dic[i*W+j] = dic.get(i*W+j,0)+1
ans = [0]*10
ans[0] = (W-2)*(H-2)
for k in dic.keys():
ans[dic[k]] += 1
ans[0] -= 1
print('\n'.join(map(str,ans))) | Traceback (most recent call last):
File "/tmp/tmpquh_6qy5/tmpww0bgs05.py", line 1, in <module>
H, W, N, *L = map(int, open('0').read().split())
^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '0'
| |
s861990154 | p04000 | u476604182 | 1582689428 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38512 | 380 | from collections import defaultdict
H, W, N, *L = map(int, open('0').read().split())
dic = defaultdict(int)
for a, b in zip(*[iter(L)]*2):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if 0<i and i+2<=H and 0<j and j+2<=W:
dic[(i,j)] += 1
ans = [0]*10
ans[0] = (W-2)*(H-2)
for k in dic.keys():
ans[dic[k]] += 1
ans[0] -= 1
print(*ans,sep='\n')
| Traceback (most recent call last):
File "/tmp/tmpbz2gx668/tmpnbhr1uoh.py", line 2, in <module>
H, W, N, *L = map(int, open('0').read().split())
^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '0'
| |
s406976255 | p04000 | u760794812 | 1582129695 | Python | Python (3.4.3) | py | Runtime Error | 1978 | 170460 | 322 | from collections import *
h,w,n = map(int,input().split())
dic = defaultdict(int)
for _ in range(n):
a,b = map(int,input().split())
for i in range(9):
dic[a - i //3,b - i % 3] += 1
ans =[0]*n
for i, j in dic:
ans[dic[i,j]] += h-1 > i > 0 < j < w -1
ans[0] = (h -2)*(w-2) - sum(ans)
for item in ans:
print(item) | Traceback (most recent call last):
File "/tmp/tmp9fo0x8dm/tmpsq5zqkpi.py", line 2, in <module>
h,w,n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s692202636 | p04000 | u557494880 | 1579955112 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 521 | dx = [-1,-1,-1,0,0,1,1,1]
dy = [-1,0,1,-1,1,-1,0,1]
H,W,N = map(int,input().split())
s = []
d = {}
for i in range(N):
x,y = map(int,input().split())
if (x,y) not in s:
d[(x,y)] = 0
s.append((x,y))
d[(x,y)] += 1
for j in range(8):
X = x + dx[j]
Y = y + dx[j]
if (X,Y) not in s:
d[(x,y)] = 0
s.append((X,Y))
d[(X,Y)] += 1
ans = [H*W-len(s),0,0,0,0,0,0,0,0,0]
for (x,y) in s:
ans[d[(x,y)]] += 1
for i in range(10):
print(ans[i]) | Traceback (most recent call last):
File "/tmp/tmpey1wix9e/tmpxmfvlqcq.py", line 3, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s524804512 | p04000 | u614550445 | 1577871875 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 2526 | // abc045_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()
#define INF ((1 << 29)-1)
#define MOD (1000000007)
#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;
int dx[9]={ 0, 1, 0, -1, 0, -1, 1, -1, 1};
int dy[9]={ 0, 0, 1, 0, -1, -1, -1, 1, 1};
int main() {
#ifdef LOCAL
ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif
ll H, W, N;
cin >> H >> W >> N;
if (N == 0){
print((H-2)*(W-2));
REP(i, 9) print(0);
return 0;
}
vector<P> AB(N);
REP(i, N) {
cin >> AB[i].first >> AB[i].second;
AB[i].first--; AB[i].second--;
}
sort(ALL(AB));
ll h_margin = min(3ll, H-1 - AB[N-1].first);
ll prev_x = 0;
REP(i, N){
AB[i].first = prev_x + min(3ll, AB[i].first - prev_x);
prev_x = AB[i].first;
}
ll h = AB[N-1].first + 1 + h_margin;
sort(ALL(AB), [](const P& a, const P& b) {return a.second < b.second;});
ll w_margin = min(3ll, W-1 - AB[N-1].second);
ll prev_y = 0;
REP(i, N){
AB[i].second = prev_y + min(3ll, AB[i].second - prev_y);
prev_y = AB[i].second;
}
ll w = AB[N-1].second + 1 + w_margin;
// print(h, w);
// print(AB);
vector<vector<int>> S(h, vector<int>(w, 0));
REP(i, N){
ll a = AB[i].first;
ll b = AB[i].second;
S[a][b] = 1;
}
// REP(i, h) print(S[i]);
vector<ll> ans(10);
REPN(i, 1, h-1) REPN(j, 1, w-1){
int cnt=0;
REP(k, 9) cnt += S[i+dx[k]][j+dy[k]];
if (cnt > 0) ans[cnt]++;
}
ans[0] = (H-2)*(W-2) - accumulate(ALL(ans), 0ll);
REP(i, 10) print(ans[i]);
return 0;
}
| File "/tmp/tmp_fvlr_1c/tmpnpqb_pii.py", line 51
ll h_margin = min(3ll, H-1 - AB[N-1].first);
^
SyntaxError: invalid decimal literal
| |
s836646813 | p04000 | u532966492 | 1577557399 | Python | Python (3.4.3) | py | Runtime Error | 517 | 48756 | 2100 | def main():
from sys import stdin
#input = stdin.readline
import numpy as np
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in [0]*n]
ab_d = {(a, b) for a, b in ab}
ans = [set() for _ in range(9)]
for a, b in ab:
temp = np.full((5, 5), None, dtype=np.int64)
for i in range(max(0, 3-a), min(5, h-a+3)):
for j in range(max(0, 3-b), min(5, w-b+3)):
if (a+i-2, b+j-2) in ab_d:
temp[i, j] = 1
else:
temp[i, j] = 0
# print(temp)
flag_yoko = [0, 5]
flag_tate = [0, 5]
if np.all(temp[:, 0] == np.full((1, 5), None, dtype=np.int64)):
if np.all(temp[:, 1] == np.full((1, 5), None, dtype=np.int64)):
flag_yoko[0] = 2
else:
flag_yoko[0] = 1
if np.all(temp[:, 4] == np.full((1, 5), None, dtype=np.int64)):
if np.all(temp[:, 3] == np.full((1, 5), None, dtype=np.int64)):
flag_yoko[1] = 3
else:
flag_yoko[1] = 4
if np.all(temp[0, :] == np.full(5, None, dtype=np.int64)):
if np.all(temp[1, :] == np.full(5, None, dtype=np.int64)):
flag_tate[0] = 2
else:
flag_tate[0] = 1
if np.all(temp[4, :] == np.full(5, None, dtype=np.int64)):
if np.all(temp[3, :] == np.full(5, None, dtype=np.int64)):
flag_tate[1] = 3
else:
flag_tate[1] = 4
new_temp = temp[flag_tate[0]:flag_tate[1], flag_yoko[0]:flag_yoko[1]]
# print(new_temp)
for i in range(flag_tate[1]-flag_tate[0]-2):
for j in range(flag_yoko[1]-flag_yoko[0]-2):
cnt = [new_temp[i+k, j+l] for k in range(3) for l in range(3)]
if None not in cnt:
ans[sum(cnt)-1].add((a+i-2+flag_tate[0], b+j-2+flag_yoko[0]))
for i in range(9):
ans[i] = len(ans[i])
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i)
main()
| Traceback (most recent call last):
File "/tmp/tmp7ctc54jn/tmpgws89u4j.py", line 57, in <module>
main()
File "/tmp/tmp7ctc54jn/tmpgws89u4j.py", line 5, in main
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s810473421 | p04000 | u532966492 | 1577557327 | Python | Python (3.4.3) | py | Runtime Error | 604 | 50796 | 2100 | def main():
from sys import stdin
#input = stdin.readline
import numpy as np
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in [0]*n]
ab_d = {(a, b) for a, b in ab}
ans = [set() for _ in range(9)]
for a, b in ab:
temp = np.full((5, 5), None, dtype=np.int64)
for i in range(max(0, 3-a), min(5, h-a+3)):
for j in range(max(0, 3-b), min(5, w-b+3)):
if (a+i-2, b+j-2) in ab_d:
temp[i, j] = 1
else:
temp[i, j] = 0
# print(temp)
flag_yoko = [0, 5]
flag_tate = [0, 5]
if np.all(temp[:, 0] == np.full((1, 5), None), dtype=np.int64):
if np.all(temp[:, 1] == np.full((1, 5), None), dtype=np.int64):
flag_yoko[0] = 2
else:
flag_yoko[0] = 1
if np.all(temp[:, 4] == np.full((1, 5), None), dtype=np.int64):
if np.all(temp[:, 3] == np.full((1, 5), None), dtype=np.int64):
flag_yoko[1] = 3
else:
flag_yoko[1] = 4
if np.all(temp[0, :] == np.full(5, None), dtype=np.int64):
if np.all(temp[1, :] == np.full(5, None), dtype=np.int64):
flag_tate[0] = 2
else:
flag_tate[0] = 1
if np.all(temp[4, :] == np.full(5, None), dtype=np.int64):
if np.all(temp[3, :] == np.full(5, None), dtype=np.int64):
flag_tate[1] = 3
else:
flag_tate[1] = 4
new_temp = temp[flag_tate[0]:flag_tate[1], flag_yoko[0]:flag_yoko[1]]
# print(new_temp)
for i in range(flag_tate[1]-flag_tate[0]-2):
for j in range(flag_yoko[1]-flag_yoko[0]-2):
cnt = [new_temp[i+k, j+l] for k in range(3) for l in range(3)]
if None not in cnt:
ans[sum(cnt)-1].add((a+i-2+flag_tate[0], b+j-2+flag_yoko[0]))
for i in range(9):
ans[i] = len(ans[i])
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i)
main()
| Traceback (most recent call last):
File "/tmp/tmp_u1zz5uj/tmp73r8792a.py", line 57, in <module>
main()
File "/tmp/tmp_u1zz5uj/tmp73r8792a.py", line 5, in main
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s391869522 | p04000 | u532966492 | 1577557229 | Python | Python (3.4.3) | py | Runtime Error | 359 | 48716 | 1955 | def main():
from sys import stdin
input = stdin.readline
import numpy as np
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in [0]*n]
ab_d = {(a, b) for a, b in ab}
ans = [set() for _ in range(9)]
for a, b in ab:
temp = np.full((5, 5), None)
for i in range(max(0, 3-a), min(5, h-a+3)):
for j in range(max(0, 3-b), min(5, w-b+3)):
if (a+i-2, b+j-2) in ab_d:
temp[i, j] = 1
else:
temp[i, j] = 0
# print(temp)
flag_yoko = [0, 5]
flag_tate = [0, 5]
if np.all(temp[:, 0] == np.full((1, 5), None)):
if np.all(temp[:, 1] == np.full((1, 5), None)):
flag_yoko[0] = 2
else:
flag_yoko[0] = 1
if np.all(temp[:, 4] == np.full((1, 5), None)):
if np.all(temp[:, 3] == np.full((1, 5), None)):
flag_yoko[1] = 3
else:
flag_yoko[1] = 4
if np.all(temp[0, :] == np.full(5, None)):
if np.all(temp[1, :] == np.full(5, None)):
flag_tate[0] = 2
else:
flag_tate[0] = 1
if np.all(temp[4, :] == np.full(5, None)):
if np.all(temp[3, :] == np.full(5, None)):
flag_tate[1] = 3
else:
flag_tate[1] = 4
new_temp = temp[flag_tate[0]:flag_tate[1], flag_yoko[0]:flag_yoko[1]]
# print(new_temp)
for i in range(flag_tate[1]-flag_tate[0]-2):
for j in range(flag_yoko[1]-flag_yoko[0]-2):
cnt = [new_temp[i+k, j+l] for k in range(3) for l in range(3)]
if None not in cnt:
ans[sum(cnt)-1].add((a+i-2+flag_tate[0], b+j-2+flag_yoko[0]))
for i in range(9):
ans[i] = len(ans[i])
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i)
main()
| Traceback (most recent call last):
File "/tmp/tmpufk1b177/tmpfq0o9do1.py", line 57, in <module>
main()
File "/tmp/tmpufk1b177/tmpfq0o9do1.py", line 5, in main
h, w, n = map(int, input().split())
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s055164829 | p04000 | u532966492 | 1577557078 | Python | Python (3.4.3) | py | Runtime Error | 482 | 51044 | 1907 | def main():
from sys import stdin
input = stdin.readline
import numpy as np
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in [0]*n]
ab_d = {(a, b) for a, b in ab}
ans = [set() for _ in range(9)]
for a, b in ab:
temp = np.full((5, 5), None)
for i in range(max(0, 3-a), min(5, h-a+3)):
for j in range(max(0, 3-b), min(5, w-b+3)):
if (a+i-2, b+j-2) in ab_d:
temp[i, j] = 1
else:
temp[i, j] = 0
flag_yoko = [0, 5]
flag_tate = [0, 5]
if np.all(temp[:, 0] == np.full((1, 5), None)):
if np.all(temp[:, 1] == np.full((1, 5), None)):
flag_yoko[0] = 2
else:
flag_yoko[0] = 1
if np.all(temp[:, 4] == np.full((1, 5), None)):
if np.all(temp[:, 3] == np.full((1, 5), None)):
flag_yoko[1] = 3
else:
flag_yoko[1] = 4
if np.all(temp[0, :] == np.full(5, None)):
if np.all(temp[1, :] == np.full(5, None)):
flag_tate[0] = 2
else:
flag_tate[0] = 1
if np.all(temp[4, :] == np.full(5, None)):
if np.all(temp[3, :] == np.full(5, None)):
flag_tate[1] = 3
else:
flag_tate[1] = 4
new_temp = temp[flag_tate[0]:flag_tate[1], flag_yoko[0]:flag_yoko[1]]
for i in range(flag_tate[1]-flag_tate[0]-2):
for j in range(flag_yoko[1]-flag_yoko[0]-2):
cnt = [new_temp[i+k, j+l] for k in range(3) for l in range(3)]
if None not in cnt:
ans[sum(cnt)-1].add((a+i-2+flag_tate[0], b+j-2+flag_yoko[0]))
for i in range(9):
ans[i] = len(ans[i])
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i)
main()
| Traceback (most recent call last):
File "/tmp/tmpn_t868zl/tmpx_rgwzfg.py", line 55, in <module>
main()
File "/tmp/tmpn_t868zl/tmpx_rgwzfg.py", line 5, in main
h, w, n = map(int, input().split())
^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s071969088 | p04000 | u470542271 | 1576910058 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1106 | 78936 | 794 | h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
d = dict()
for i in range(len(ab)):
a = ab[i][0] - 1
b = ab[i][0] - 1
d[a] = set()
dp = [0] * 10
dp[0] = (h - 2) * (w - 2)
for i in range(n):
a = ab[i][0] - 1
b = ab[i][1] - 1
for dx in [-1, 0, 1]:
for dy in [-1, 0, 1]:
nx, ny = a + dx, b + dy # center
if nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2:
# print(nx, ny)
tmp = 0
for dx2 in [-1, 0, 1]:
for dy2 in [-1, 0, 1]:
if ny + dy2 in d[nx + dx2]:
tmp += 1
dp[tmp] -= 1
dp[tmp + 1] += 1
d[a].add(b)
for x in dp:
print(x)
| Traceback (most recent call last):
File "/tmp/tmpiisl7y9z/tmpi23a4huc.py", line 1, in <module>
h, w, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s473458876 | p04000 | u309141201 | 1576622345 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 1285 | import numpy as np
H, W, N = map(int, input().split())
table = np.zeros((H, W), dtype='int64')
print(type(table))
for _ in range(N): # 黒なら1と更新する
a, b = map(int, input().split())
table[a-1][b-1] = 1
count_0 = 0
count_1 = 0
count_2 = 0
count_3 = 0
count_4 = 0
count_5 = 0
count_6 = 0
count_7 = 0
count_8 = 0
count_9 = 0
for y in range(H-2):
for x in range(W-2):
count = 0
for i in range(3): # 1の数を数える
for j in range(3):
if table[y + i][x + j] == 1:
count += 1
if count == 0:
count_0 += 1
elif count == 1:
count_1 += 1
elif count == 2:
count_2 += 1
elif count == 3:
count_3 += 1
elif count == 4:
count_4 += 1
elif count == 5:
count_5 += 1
elif count == 6:
count_6 += 1
elif count == 7:
count_7 += 1
elif count == 8:
count_8 += 1
elif count == 9:
count_9 += 1
# print('y = {0}, x = {1}, count = {2}'.format(y, x, count))
print(count_0)
print(count_1)
print(count_2)
print(count_3)
print(count_4)
print(count_5)
print(count_6)
print(count_7)
print(count_8)
print(count_9)
| Traceback (most recent call last):
File "/tmp/tmp10uapkii/tmpz4mucuug.py", line 2, in <module>
H, W, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s029076483 | p04000 | u309141201 | 1576612120 | Python | Python (3.4.3) | py | Runtime Error | 3161 | 21812 | 1266 | import numpy as np
H, W, N = map(int, input().split())
table = np.zeros((H, W), dtype='int64')
for _ in range(N): # 黒なら1と更新する
a, b = map(int, input().split())
table[a-1][b-1] = 1
count_0 = 0
count_1 = 0
count_2 = 0
count_3 = 0
count_4 = 0
count_5 = 0
count_6 = 0
count_7 = 0
count_8 = 0
count_9 = 0
for y in range(H-2):
for x in range(W-2):
count = 0
for i in range(3): # 1の数を数える
for j in range(3):
if table[y + i][x + j] == 1:
count += 1
if count == 0:
count_0 += 1
elif count == 1:
count_1 += 1
elif count == 2:
count_2 += 1
elif count == 3:
count_3 += 1
elif count == 4:
count_4 += 1
elif count == 5:
count_5 += 1
elif count == 6:
count_6 += 1
elif count == 7:
count_7 += 1
elif count == 8:
count_8 += 1
elif count == 9:
count_9 += 1
# print('y = {0}, x = {1}, count = {2}'.format(y, x, count))
print(count_0)
print(count_1)
print(count_2)
print(count_3)
print(count_4)
print(count_5)
print(count_6)
print(count_7)
print(count_8)
print(count_9)
| Traceback (most recent call last):
File "/tmp/tmpb17c8291/tmptq2fcprf.py", line 2, in <module>
H, W, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s007869090 | p04000 | u309141201 | 1576611440 | Python | Python (3.4.3) | py | Runtime Error | 3160 | 22088 | 1855 | import numpy as np
H, W, N = map(int, input().split())
table = np.zeros((H, W))
for _ in range(N): # 黒なら1と更新する
a, b = map(int, input().split())
table[a-1][b-1] = 1
# print(table)
count_0 = 0
count_1 = 0
count_2 = 0
count_3 = 0
count_4 = 0
count_5 = 0
count_6 = 0
count_7 = 0
count_8 = 0
count_9 = 0
for y in range(H-2):
# print('y = ' + str(y))
for x in range(W-2):
# print('x = ' + str(x))
count = 0
for i in range(3): # 1の数を数える
for j in range(3):
if table[y + i][x + j] == 1:
count += 1
if count == 0:
count_0 += 1
elif count == 1:
count_1 += 1
elif count == 2:
count_2 += 1
elif count == 3:
count_3 += 1
elif count == 4:
count_4 += 1
elif count == 5:
count_5 += 1
elif count == 6:
count_6 += 1
elif count == 7:
count_7 += 1
elif count == 8:
count_8 += 1
elif count == 9:
count_9 += 1
# print('y = {0}, x = {1}, count = {2}'.format(y, x, count))
print(count_0)
print(count_1)
print(count_2)
print(count_3)
print(count_4)
print(count_5)
print(count_6)
print(count_7)
print(count_8)
print(count_9)
# count_0 = 0
# count_1 = 0
# count_2 = 0
# count_3 = 0
# count_4 = 0
# count_5 = 0
# count_6 = 0
# count_7 = 0
# count_8 = 0
# count_9 = 0
# if count == 0:
# count_0 += 1
# elif count == 1:
# count_1 += 1
# elif count == 2:
# count_2 += 1
# elif count == 3:
# count_3 += 1
# elif count == 4:
# count_4 += 1
# elif count == 5:
# count_5 += 1
# elif count == 6:
# count_6 += 1
# elif count == 7:
# count_7 += 1
# elif count == 8:
# count_8 += 1
# elif count == 9:
# count_9 += 1
| Traceback (most recent call last):
File "/tmp/tmp6vytn3nh/tmpd3j0sqml.py", line 2, in <module>
H, W, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s176933130 | p04000 | u141786930 | 1576555099 | Python | Python (3.4.3) | py | Runtime Error | 3161 | 33116 | 340 | import numpy as np
import collections
H, W, N = map(int,input().split())
C = np.zeros((H, W),dtype=int)
for _ in range(N):
a, b = map(int, input().split())
C[a-1,b-1] = 1
ans = []
for i in range(H-2):
for j in range(W-2):
ans.append(np.sum(C[i:i+3,j:j+3]))
for j in range(10):
print(collections.Counter(ans)[j]) | Traceback (most recent call last):
File "/tmp/tmpswq0ci9f/tmppzmt4wz1.py", line 4, in <module>
H, W, N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s340325358 | p04000 | u735069283 | 1573620981 | Python | Python (3.4.3) | py | Runtime Error | 3160 | 22068 | 270 | import numpy as np
H,W,N = map(int,input().split())
X=np.array([[0]*W]*H)
c=[0]*10
for i in range(N):
x,y=map(int,input().split())
X[x-1,y-1]=1
for i in range(H-2):
for j in range(W-2):
p=sum(sum(X[i:i+3,j:j+3]))
c[p] += 1
for i in range(10):
print(c[i]) | Traceback (most recent call last):
File "/tmp/tmp5oqlqa4b/tmpgxt9e86m.py", line 2, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s780693415 | p04000 | u285443936 | 1572488285 | Python | Python (3.4.3) | py | Runtime Error | 3326 | 1692404 | 399 | H,W,N = map(int,input().split())
count = [[0]*(W-2) for i in range(H-2)]
for i in range(N):
a,b = map(int, input().split())
a -= 1
b -= 1
for i in range(max(0,a-2),min(a+1,H-2)):
for j in range(max(0,b-2),min(b+1,W-2)):
count[i][j] += 1
ans = [0]*10
for i in range(H-2):
for j in range(W-2):
ans[count[i][j]] += 1
for i in range(10):
print(ans[i]) | Traceback (most recent call last):
File "/tmp/tmprinreq8h/tmprp7k2wvq.py", line 1, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s467944010 | p04000 | u474423089 | 1570764813 | Python | Python (3.4.3) | py | Runtime Error | 2443 | 135988 | 748 | def main():
h,w,n=map(int,input().split(' '))
draw_list=[]
for i in range(n):
draw=tuple(map(int,input().split(' ')))
for j in range(3):
for k in range(3):
if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:
draw_list.append((draw[0]-j,draw[1]-k))
ans = [0]*9
sorted_draw = sorted(draw_list)
for n,i in enumerate(sorted_draw):
if not n:
ans_num=0
tmp = i
continue
if tmp == i:
ans_num+=1
else:
ans[ans_num] += 1
tmp = i
ans_num = 0
ans[ans_num] += 1
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i)
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmphp7ozq_u/tmph_bcjjaa.py", line 31, in <module>
main()
File "/tmp/tmphp7ozq_u/tmph_bcjjaa.py", line 2, in main
h,w,n=map(int,input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s216800960 | p04000 | u474423089 | 1570763537 | Python | Python (3.4.3) | py | Runtime Error | 2361 | 135832 | 735 | def main():
h,w,n=map(int,input().split(' '))
draw_list=[]
for i in range(n):
draw=tuple(map(int,input().split(' ')))
for j in range(3):
for k in range(3):
if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:
draw_list.append((draw[0]-j,draw[1]-k))
ans = [0]*9
sorted_draw = sorted(draw_list)
tmp = sorted_draw[0]
ans_num = 0
for i in range(len(sorted_draw)-1):
if sorted_draw[i] == sorted_draw[i+1]:
ans_num += 1
else:
ans[ans_num] += 1
ans_num = 0
if ans_num:
ans[ans_num]+=1
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i)
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmppn2m2k62/tmppktmvb9y.py", line 29, in <module>
main()
File "/tmp/tmppn2m2k62/tmppktmvb9y.py", line 2, in main
h,w,n=map(int,input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s201689252 | p04000 | u474423089 | 1570763461 | Python | Python (3.4.3) | py | Runtime Error | 2320 | 135220 | 739 | def main():
h,w,n=map(int,input().split(' '))
draw_list=[]
for i in range(n):
draw=tuple(map(int,input().split(' ')))
for j in range(3):
for k in range(3):
if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:
draw_list.append((draw[0]-j,draw[1]-k))
ans = [0]*9
sorted_draw = sorted(draw_list)
tmp = sorted_draw[0]
ans_num = 0
for i in range(len(sorted_draw)-1):
if sorted_draw[i] == sorted_draw[i+1]:
ans_num += 1
else:
ans[ans_num] += 1
ans_num = 0
if ans_num:
ans[ans_num]+=1
print((h-2)*(w-2)-sum(ans))
for i in ans[1:]:
print(i)
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpif6omm1a/tmpyvk2p_fj.py", line 29, in <module>
main()
File "/tmp/tmpif6omm1a/tmpyvk2p_fj.py", line 2, in main
h,w,n=map(int,input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s339332132 | p04000 | u118642796 | 1570192540 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2602 | 284144 | 355 | H,W,N = map(int,input().split())
dic={}
for _ in range(N):
a,b = [int(x)-1 for x in input().split()]
for h in range(a-2,a+3):
for w in range(b-2,b+3):
if 0<=h<H and 0<=w<W:
dic[10**10*h+w] = dic.get(10**10*h+w,0)+1
ans = [0]*10
for x in dic.values():
ans[x] += 1
ans[0] = (H-2)*(W-2)-sum(ans[1:])
for x in ans:
print(x)
| Traceback (most recent call last):
File "/tmp/tmpmsolnues/tmpiyx1wlhh.py", line 1, in <module>
H,W,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s856296432 | p04000 | u404794295 | 1570022388 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3436 | 592 | inp=input().split(" ")
H=int(inp[0])
W=int(inp[1])
N=int(inp[2])
square=[]
plot=[]
times=[0 for i in range(10)]
times[0]=(H-2)*(W-2)
from collections import defaultdict
count=defaultdict(lambda:0)
def check(a,b,count):
for i in range(3):
for j in range(3):
if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:
count[str([a-i,b-j])]+=1
for i in range(N):
plot.append(list(map(int,input().split(" "))))
check(plot[i][0]-1,plot[i][1]-1,square)
for i in count.values():
times[i]+=1
times[0]-=1
for i in range(len(times)):
print(times[i]) | Traceback (most recent call last):
File "/tmp/tmp0iugehng/tmpa__b7911.py", line 1, in <module>
inp=input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s555656459 | p04000 | u762540523 | 1569616711 | Python | Python (3.4.3) | py | Runtime Error | 3198 | 795124 | 299 | from collections import Counter
h,w,n=map(int,input().split())
x=[0 for _ in range((h-2)*(w-2))]
for _ in range(n):
a,b=map(int,input().split())
for i in range(max(0,a-3),min(h-2,a)):
for j in range(max(0,b-3),min(w-2,b)):
x[i*(h-2)+j]+=1
c=Counter(x)
for i in range(10):
print(c[i]) | Traceback (most recent call last):
File "/tmp/tmpj3p4d7w0/tmptru79bji.py", line 2, in <module>
h,w,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s705936971 | p04000 | u924374652 | 1569464027 | Python | Python (3.4.3) | py | Runtime Error | 3161 | 21988 | 419 | import numpy as np
h, w, n = map(int, input().split(" "))
board = np.zeros((h, w))
for i in range(n):
a, b = map(int, input().split(" "))
board[a - 1][b - 1] = 1
result = [0 for _ in range(10)]
for start_h in range(h - 2):
for start_w in range(w - 2):
sum_black = np.count_nonzero(board[start_h:(start_h+3), start_w:(start_w + 3)] > 0)
result[sum_black] += 1
for one_result in result:
print(one_result) | Traceback (most recent call last):
File "/tmp/tmphcunrms_/tmpm9lq7pfo.py", line 2, in <module>
h, w, n = map(int, input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s464876358 | p04000 | u736729525 | 1568411418 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 898 |
def main():
import sys
input = sys.readline
H, W, N = map(int, input().split())
grid = set()
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
grid.add((a,b))
total = ((H-3)+1)*((W-3)+1)
count = [0] * 10
offset = [-2, -1, 0]
for a, b in grid:
for x in offset:
ax = a+x
if not (0 <= ax and ax+2 < H):
continue
for y in offset:
by = b + y
if 0 <= by and by+2 < W:
c = sum(1 if (ax+i, by+j) in grid else 0 for i in range(3)
for j in range(3))
count[c] += 1
for i in range(1, 10):
count[i] //= i
print(total-sum(count))
for i in range(1, 10):
#print(i, len(count[i])//i)#, count[i])
print(count[i])#, count[i])
main()
| Traceback (most recent call last):
File "/tmp/tmpxqilk9sb/tmpovuj9hf_.py", line 35, in <module>
main()
File "/tmp/tmpxqilk9sb/tmpovuj9hf_.py", line 4, in main
input = sys.readline
^^^^^^^^^^^^
AttributeError: module 'sys' has no attribute 'readline'
| |
s031752184 | p04000 | u842689614 | 1567454479 | Python | Python (3.4.3) | py | Runtime Error | 3164 | 38708 | 3399 | import sys
import numpy as np
import time
input = sys.stdin.readline
H,W,N=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
r_b_app=r_b.append
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b_app(i)
if N>0:
r_b_app(N)
rows=tuple(ab[b][0] for b in r_b if b<N)
cols=tuple(tuple(ab[j][1] for j in range(r_b[i],r_b[i+1])) for i in range(len(r_b)-1))
rN=len(cols)
ched_box0=np.zeros(((len(cols[0]) if 0<rN else 0),3,3),dtype=bool)
ched_box1=np.zeros(((len(cols[1]) if 1<rN else 0),3,3),dtype=bool)
ched_box2=np.zeros(((len(cols[2]) if 1<rN else 0),3,3),dtype=bool)
dic_cn0=dict(zip(cols[0],list(range(len(cols[0]))))) if 0<rN else {}
dic_cn1=dict(zip(cols[1],list(range(len(cols[1]))))) if 1<rN else {}
dic_cn2=dict(zip(cols[2],list(range(len(cols[2]))))) if 2<rN else {}
area_n=[0]*9
count=[[1]*3 for i in range(3)]
find_cn=[0]*12
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box0=ched_box1
dic_cn0=dic_cn1
ched_box1=ched_box2
dic_cn1=dic_cn2
if rn<rN-2:
cN2_range=range(len(cols[rn+2]))
ched_box2=np.zeros((len(cols[rn+2]),3,3),dtype=bool)
dic_cn2=dict(zip(cols[rn+2],list(cN2_range)))
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
row2=None
else:
row1=None
row2=None
find_rowcol=np.zeros((5,5),dtype=int)
for cn in range(cN):
col=cols[rn][cn]
ched_box=ched_box0[cn]
for box_row,box_col in zip(*np.where(ched_box==False)):
if col-2+box_col<1 or col+box_col>W or row-2+box_row<1 or row+box_row>H:
ched_box[box_row,box_col]=True
for ch_row in range(5):
for ch_col in range(5):
find_rowcol[ch_row,ch_col]=0
find_cn=[[0]*5 for _ in range(3)]
find_rowcol[2,2]=1
find_cn[0][2]=cn
if (col+1 in dic_cn0 if col+1<=W else False):
find_rowcol[2,3]=1
find_cn[0][3]=dic_cn0[col+1]
if (col+2 in dic_cn0 if col+2<=W else False):
find_rowcol[2,4]=1
find_cn[0][4]=dic_cn0[col+2]
if (row1<=H if row1 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn1:
find_rowcol[row1-row+2,ch_col-col+2]=1
find_cn[row1-row][ch_col-col+2]=dic_cn1[ch_col]
if (row2<=H if row2 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn2:
find_rowcol[row2-row+2,ch_col-col+2]=1
find_cn[row2-row][ch_col-col+2]=dic_cn2[ch_col]
for box_row,box_col in zip(*np.where(ched_box==False)):
area_n[find_rowcol[box_row:box_row+3,box_col:box_col+3].sum()-1]+=1
for ch_row,ch_col in zip(*np.where(find_rowcol)):
for box_row in range(5-ch_row):
for box_col in range((0 if ch_col>=2 else 2-ch_col),(5-ch_col if ch_col>=2 else 3)):
if ch_row==2:
ched_box0[find_cn[ch_row-2][ch_col],box_row,box_col]=True
elif ch_row==row1-row+2:
ched_box1[find_cn[ch_row-2][ch_col],box_row,box_col]=True
elif ch_row==row2-row+2:
ched_box2[find_cn[ch_row-2][ch_col],box_row,box_col]=True
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmp39w_6ntb/tmpea7bla4t.py", line 6, in <module>
H,W,N=map(int,input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s775423386 | p04000 | u842689614 | 1567220985 | Python | Python (3.4.3) | py | Runtime Error | 3156 | 64020 | 3978 | import sys
input = sys.stdin.readline
H,W,N=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
r_b_app=r_b.append
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b_app(i)
if N>0:
r_b_app(N)
rows=tuple(ab[b][0] for b in r_b if b<N)
cols=tuple(tuple(ab[j][1] for j in range(r_b[i],r_b[i+1])) for i in range(len(r_b)-1))
rN=len(cols)
ched_box0=[[[False]*3 for k in range(3)] for j in range((len(cols[0]) if 0<rN else 0))]
ched_box1=[[[False]*3 for k in range(3)] for j in range((len(cols[1]) if 1<rN else 0))]
ched_box2=[[[False]*3 for k in range(3)] for j in range((len(cols[2]) if 2<rN else 0))]
dic_cn0=dict(zip(cols[0],list(range(len(cols[0]))))) if 0<rN else {}
dic_cn1=dict(zip(cols[1],list(range(len(cols[1]))))) if 1<rN else {}
dic_cn2=dict(zip(cols[2],list(range(len(cols[2]))))) if 2<rN else {}
area_n=[0]*9
count=[[1]*3 for i in range(3)]
find_cn=[0]*12
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box0=ched_box1
dic_cn0=dic_cn1
ched_box1=ched_box2
dic_cn1=dic_cn2
if rn<rN-2:
cN2_range=range(len(cols[rn+2]))
ched_box2=[[[False]*3 for k in range(3)] for j in cN2_range]
dic_cn2=dict(zip(cols[rn+2],list(cN2_range)))
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
ched_box=ched_box0[cn]
box_row_0_cols=[]
box_row_1_cols=[]
box_row_2_cols=[]
for box_col in range(3):
if not ched_box[0][box_col]:
if col-2+box_col>=1 and col+box_col<=W and row-2>=1 and row<=H:
box_row_0_cols.append(box_col)
else:
ched_box[0][box_col]=True
if not ched_box[1][box_col]:
if col-2+box_col>=1 and col+box_col<=W and row-1>=1 and row+1<=H:
box_row_1_cols.append(box_col)
else:
ched_box[1][box_col]=True
if not ched_box[2][box_col]:
if col-2+box_col>=1 and col+box_col<=W and row>=1 and row+2<=H:
box_row_2_cols.append(box_col)
else:
ched_box[2][box_col]=True
find_rowcol=[0]*15
find_cn=[[0]*5 for _ in range(3)]
find_rowcol[2]=1
find_cn[0][2]=cn
if (col+1 in dic_cn0 if col+1<=W else False):
find_rowcol[3]=1
find_cn[0][3]=dic_cn0[col+1]
if (col+2 in dic_cn0 if col+2<=W else False):
find_rowcol[4]=1
find_cn[0][4]=dic_cn0[col+2]
if (row1<=H if row1 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn1:
find_rowcol[5*(row1-row)+ch_col-col+2]=1
find_cn[row1-row][ch_col-col+2]=dic_cn1[ch_col]
if (row2<=H if row2 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn2:
find_rowcol[5*(row2-row)+ch_col-col+2]=1
find_cn[row2-row][ch_col-col+2]=dic_cn2[ch_col]
for box_row in range(3):
for box_col in range(3):
if not ched_box[box_row][box_col]:
area_n[sum(find_rowcol[5*box_row+box_col:5*(box_row+2)+box_col+3])-1]+=1
for ch_row in range(0,3):
for ch_col in range((0 if ch_row!=0 else 3),5):
if find_rowcol[5*ch_row+ch_col]:
for box_row in range(3-ch_row):
for box_col in range((0 if ch_col>=2 else 2-ch_col),(5-ch_col if ch_col>=2 else 3)):
if ch_row==0:
ched_box0[find_cn[ch_row][ch_col]][box_row][box_col]=True
elif ch_row==row1-row:
ched_box1[find_cn[ch_row][ch_col]][box_row][box_col]=True
elif ch_row==row2-row:
ched_box2[find_cn[ch_row][ch_col]][box_row][box_col]=True
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmpa1mi766w/tmp0__0fobc.py", line 4, in <module>
H,W,N=map(int,input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s223565923 | p04000 | u842689614 | 1567053654 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3320 | 4579 | import sys
input = sys.stdin.readline
H,W,N=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
r_b_app=r_b.append
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b_app(i)
if N>0:
r_b_app(N)
rows=tuple(ab[b][0] for b in r_b if b<N)
cols=tuple(tuple(ab[j][1] for j in range(r_b[i],r_b[i+1])) for i in range(len(r_b)-1))
rN=len(cols)
ched_box0=[[[False]*3 for k in range(3)] for j in range((len(cols[0]) if 0<rN else 0))]
ched_box1=[[[False]*3 for k in range(3)] for j in range((len(cols[1]) if 1<rN else 0))]
ched_box2=[[[False]*3 for k in range(3)] for j in range((len(cols[2]) if 2<rN else 0))]
dic_cn0=dict(zip(cols[0],list(range(len(cols[0]))))) if 0<rN else {}
dic_cn1=dict(zip(cols[1],list(range(len(cols[1]))))) if 1<rN else {}
dic_cn2=dict(zip(cols[2],list(range(len(cols[2]))))) if 2<rN else {}
area_n=[0]*9
count=[[1]*3 for i in range(3)]
find_cn=[0]*12
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box0=ched_box1
dic_cn0=dic_cn1
ched_box1=ched_box2
dic_cn1=dic_cn2
if rn<rN-2:
cN2_range=range(len(cols[rn+2]))
ched_box2=[[[False]*3 for k in range(3)] for j in cN2_range]
dic_cn2=dict(zip(cols[rn+2],list(cN2_range)))
if (rows[rn+1] is row+1 if rn<rN-1 else False):
row1=row+1
if (rows[rn+2] is row+2 if rn<rN-2 else False):
row2=row+2
else:
row2=None
elif (rows[rn+1] is row+2 if rn<rN-1 else False):
row1=row+2
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
ched_box=ched_box0[cn]
box_row_0_col=[]
box_row_1_col=[]
box_row_2_col=[]
for box_col in range(3):
if not ched_box[0][box_col]:
if col-2+box_col>=1 and col+box_col<=W and row-2>=1 and row<=H:
box_row_0_col.append(box_col)
else:
ched_box[0][box_col]=True
if not ched_box[1][box_col]:
if col-2+box_col>=1 and col+box_col<=W and row-2+1>=1 and row+1<=H:
box_row_1_col.append(box_col)
else:
ched_box[1][box_col]=True
if not ched_box[2][box_col]:
if col-2+box_col>=1 and col+box_col<=W and row-2+2>=1 and row+2<=H:
box_row_2_col.append(box_col)
else:
ched_box[2][box_col]=True
find_rowcol=[]
find_rowcol_app=find_rowcol.append
find_cn_n=0
if (col+1 in dic_cn0 if col+1<=W else False):
find_rowcol_app((row,col+1))
find_cn[find_cn_n]=dic_cn0[col+1]
find_cn_n+=1
if (col+2 in dic_cn0 if col+2<=W else False):
find_rowcol_app((row,col+2))
find_cn[find_cn_n]=dic_cn0[col+2]
find_cn_n+=1
if (row1<=H if row1 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn1:
find_rowcol_app((row1,ch_col))
find_cn[find_cn_n]=dic_cn1[ch_col]
find_cn_n+=1
if (row2<=H if row2 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn2:
find_rowcol_app((row2,ch_col))
find_cn[find_cn_n]=dic_cn2[ch_col]
find_cn_n+=1
#del dic_cn0[col]
for i,(find_row,find_col) in enumerate(find_rowcol):
if find_row is row:
ch_rn=0
ch_cn=find_cn[i]
elif find_row is row1:
ch_rn=1
ch_cn=find_cn[i]
elif find_row is row2:
ch_rn=2
ch_cn=find_cn[i]
for box_row in range(find_row-row,3):
for box_col in range(max(find_col-col,0),min(3,3+find_col-col)):
if not ched_box[box_row][box_col]:
count[box_row][box_col]+=1
if ch_rn is 0:
ched_box0[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
elif ch_rn is 1:
ched_box1[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
else:
ched_box2[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
for box_row in range(3):
for box_col in range(3):
if not ched_box[box_row][box_col]:
area_n[count[box_row][box_col]-1]+=1
count[box_row][box_col]=1
#for box_col in box_row_0_col:
# area_n[count[0][box_col]-1]+=1
# count[0][box_col]=1
#for box_col in box_row_1_col:
# area_n[count[1][box_col]-1]+=1
# count[1][box_col]=1
#for box_col in box_row_2_col:
# area_n[count[2][box_col]-1]+=1
# count[2][box_col]=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| File "/tmp/tmpae25g26b/tmpr98b19yu.py", line 132
for box_row in range(find_row-row,3):
^
IndentationError: unindent does not match any outer indentation level
| |
s379851776 | p04000 | u842689614 | 1567052833 | Python | Python (3.4.3) | py | Runtime Error | 1912 | 64020 | 4225 | import sys
input = sys.stdin.readline
H,W,N=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
r_b_app=r_b.append
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b_app(i)
if N>0:
r_b_app(N)
rows=tuple(ab[b][0] for b in r_b if b<N)
cols=tuple(tuple(ab[j][1] for j in range(r_b[i],r_b[i+1])) for i in range(len(r_b)-1))
rN=len(cols)
ched_box0=[[[False]*3 for k in range(3)] for j in range((len(cols[0]) if 0<rN else 0))]
ched_box1=[[[False]*3 for k in range(3)] for j in range((len(cols[1]) if 1<rN else 0))]
ched_box2=[[[False]*3 for k in range(3)] for j in range((len(cols[2]) if 2<rN else 0))]
dic_cn0=dict(zip(cols[0],list(range(len(cols[0]))))) if 0<rN else {}
dic_cn1=dict(zip(cols[1],list(range(len(cols[1]))))) if 1<rN else {}
dic_cn2=dict(zip(cols[2],list(range(len(cols[2]))))) if 2<rN else {}
area_n=[0]*9
count=[[1]*3 for i in range(3)]
find_cn=[0]*12
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box0=ched_box1
dic_cn0=dic_cn1
ched_box1=ched_box2
dic_cn1=dic_cn2
if rn<rN-2:
cN2_range=range(len(cols[rn+2]))
ched_box2=[[[False]*3 for k in range(3)] for j in cN2_range]
dic_cn2=dict(zip(cols[rn+2],list(cN2_range)))
if (rows[rn+1] is row+1 if rn<rN-1 else False):
row1=row+1
if (rows[rn+2] is row+2 if rn<rN-2 else False):
row2=row+2
else:
row2=None
elif (rows[rn+1] is row+2 if rn<rN-1 else False):
row1=row+2
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
ched_box=ched_box0[cn]
box_row_0_col=[]
box_row_1_col=[]
box_row_2_col=[]
for box_col in range(3):
if not ched_box[0][box_col] and col-2+box_col>=1 and col+box_col<=W and row-2>=1 and row<=H:
box_row_0_col.append(box_col)
if not ched_box[1][box_col] and col-2+box_col>=1 and col+box_col<=W and row-2+1>=1 and row+1<=H:
box_row_1_col.append(box_col)
if not ched_box[2][box_col] and col-2+box_col>=1 and col+box_col<=W and row-2+2>=1 and row+2<=H:
box_row_2_col.append(box_col)
find_rowcol=[]
find_rowcol_app=find_rowcol.append
find_cn_n=0
if (col+1 in dic_cn0 if col+1<=W else False):
find_rowcol_app((row,col+1))
find_cn[find_cn_n]=dic_cn0[col+1]
find_cn_n+=1
if (col+2 in dic_cn0 if col+2<=W else False):
find_rowcol_app((row,col+2))
find_cn[find_cn_n]=dic_cn0[col+2]
find_cn_n+=1
if (row1<=H if row1 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn1:
find_rowcol_app((row1,ch_col))
find_cn[find_cn_n]=dic_cn1[ch_col]
find_cn_n+=1
if (row2<=H if row2 is not None else False):
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn2:
find_rowcol_app((row2,ch_col))
find_cn[find_cn_n]=dic_cn2[ch_col]
find_cn_n+=1
#del dic_cn0[col]
for i,(find_row,find_col) in enumerate(find_rowcol):
if find_row is row:
ch_rn=0
ch_cn=find_cn[i]
elif find_row is row1:
ch_rn=1
ch_cn=find_cn[i]
elif find_row is row2:
ch_rn=2
ch_cn=find_cn[i]
for box_row in range(find_row-row,3):
for box_col in range(max(find_col-col,0),min(3,3+find_col-col)):
if not ched_box[box_row][box_col]:
count[box_row][box_col]+=1
if ch_rn is 0:
ched_box0[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
elif ch_rn is 1:
ched_box1[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
else:
ched_box2[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
for box_col in box_row_0_col:
area_n[count[0][box_col]-1]+=1
count[0][box_col]=1
for box_col in box_row_1_col:
area_n[count[1][box_col]-1]+=1
count[1][box_col]=1
for box_col in box_row_2_col:
area_n[count[2][box_col]-1]+=1
count[2][box_col]=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| /tmp/tmp0ljtdopx/tmpnq8vfin2.py:129: SyntaxWarning: "is" with a literal. Did you mean "=="?
if ch_rn is 0:
/tmp/tmp0ljtdopx/tmpnq8vfin2.py:131: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif ch_rn is 1:
Traceback (most recent call last):
File "/tmp/tmp0ljtdopx/tmpnq8vfin2.py", line 4, in <module>
H,W,N=map(int,input().split())
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s654069813 | p04000 | u842689614 | 1566938708 | Python | Python (3.4.3) | py | Runtime Error | 3158 | 69320 | 3735 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
rows=[]
rows_app=rows.append
r_b_app=r_b.append
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b_app(i)
rows_app(ab[i-1][0])
if N>0:
rows.append(ab[N-1][0])
r_b.append(N)
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box0=[[[False]*3 for k in range(3)] for j in range((len(cols[0]) if 0<rN else 0))]
ched_box1=[[[False]*3 for k in range(3)] for j in range((len(cols[1]) if 1<rN else 0))]
ched_box2=[[[False]*3 for k in range(3)] for j in range((len(cols[2]) if 2<rN else 0))]
dic_cn0=dict(zip(cols[0],list(range(len(cols[0]))))) if 0<rN else {}
dic_cn1=dict(zip(cols[1],list(range(len(cols[1]))))) if 1<rN else {}
dic_cn2=dict(zip(cols[2],list(range(len(cols[2]))))) if 2<rN else {}
area_n=[0]*9
count=[[1]*3 for i in range(3)]
find_cn=[0]*12
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box0=ched_box1
dic_cn0=dic_cn1
ched_box1=ched_box2
dic_cn1=dic_cn2
if rn<rN-2:
ched_box2=[[[False]*3 for k in range(3)] for j in range(len(cols[rn+2]))]
dic_cn2=dict(zip(cols[rn+2],list(range(len(cols[rn+2])))))
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
ched_box=ched_box0[cn]
if cn<cN-1:
list_ch_col0=cols[rn][cn+1:min(cN,cn+3)]
for box_row in range(3):
for box_col in range(3):
if col-2+box_col<1 or col+box_col>W or row-2+box_row<1 or row+box_row>H:
ched_box[box_row][box_col]=True
find_rowcol=[]
find_rowcol_app=find_rowcol.append
find_cn_n=0
for ch_row in range(row,min(row+3,H+1)):
if ch_row==row:
for ch_col in range(col+1,min(col+3,W+1)):
if ch_col in list_ch_col0:
find_rowcol_app([row,ch_col])
find_cn[find_cn_n]=list_ch_col0.index(ch_col)+cn+1
find_cn_n+=1
elif ch_row==row1:
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn1:
find_rowcol_app([row1,ch_col])
find_cn[find_cn_n]=dic_cn1[ch_col]
find_cn_n+=1
elif ch_row==row2:
for ch_col in range(max(col-2,1),min(col+3,W+1)):
if ch_col in dic_cn2:
find_rowcol_app([row2,ch_col])
find_cn[find_cn_n]=dic_cn2[ch_col]
find_cn_n+=1
for i,[find_row,find_col] in enumerate(find_rowcol):
if find_row==row:
ch_rn=0
ch_cn=find_cn[i]
elif find_row==row1:
ch_rn=1
ch_cn=find_cn[i]
elif find_row==row2:
ch_rn=2
ch_cn=find_cn[i]
for box_row in range(find_row-row,3):
for box_col in range(max(find_col-col,0),min(3,3+find_col-col)):
if not ched_box[box_row][box_col]:
count[box_row][box_col]+=1
if ch_rn==0:
ched_box0[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
elif ch_rn==1:
ched_box1[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
else:
ched_box2[ch_cn][box_row-find_row+row][box_col-find_col+col]=True
for box_row in range(3):
for box_col in range(3):
if not ched_box[box_row][box_col]:
area_n[count[box_row][box_col]-1]+=1
count[box_row][box_col]=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmpdn890u53/tmpwq3llwst.py", line 1, in <module>
H,W,N=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s633539082 | p04000 | u842689614 | 1566883954 | Python | Python (3.4.3) | py | Runtime Error | 3158 | 41492 | 2670 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
#ab.sort()
r_b=[0]
rows=[]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
rows.append(ab[i-1][0])
if N>0:
rows.append(ab[N-1][0])
r_b.append(N)
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box=[[[[False]*3 for k in range(3)] for j in range((len(cols[i]) if i<rN else 0))] for i in range(3)]
area_n=[0]*9
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box[0]=ched_box[1]
ched_box[1]=ched_box[2]
if rn<rN-2:
ched_box[2]=[[[False]*3 for k in range(3)] for j in range(len(cols[rn+2]))]
diccol=[dict(zip(cols[rn],list(range(cN))))]
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
cN1=len(cols[rn+1])
diccol.append(dict(zip(cols[rn+1],list(range(cN1)))))
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
cN2=len(cols[rn+2])
diccol.append(dict(zip(cols[rn+2],list(range(cN2)))))
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
diccol.append(dict(zip(cols[rn+1],list(range(len(cols[rn+1]))))))
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
for boxr in range(3):
for boxc in range(3):
if col-2+boxc<1 or col+boxc>W or row-2+boxr<1 or row+boxr>H:
ched_box[0][cn][boxr][boxc]=True
find_ab=[set([]) for i in range(3)]
for chr in range(row,min(row+3,H+1)):
if chr==row:
for chc in range(col+1,min(col+3,W+1)):
if chc in diccol[0]:
find_ab[0].add(chc)
elif chr==row1:
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in diccol[1]:
find_ab[1].add(chc)
elif chr==row2:
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in diccol[2]:
find_ab[2].add(chc)
for boxr in range(3):
for boxc in range(3):
if not ched_box[0][cn][boxr][boxc]:
count=1
for i in range(3):
for j in range(3):
if (col-2+boxc+j in find_ab[-2+boxr+i] if -2+boxr+i>=0 else False):
count+=1
if row-2+boxr+i==row1:
ched_box[1][diccol[1][col-2+boxc+j]][2-i][2-j]=True
elif row-2+boxr+i==row2:
ched_box[2][diccol[2][col-2+boxc+j]][2-i][2-j]=True
else:
ched_box[0][diccol[0][col-2+boxc+j]][2-i][2-j]=True
area_n[count-1]+=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmpz8heej9z/tmpq2nfthx4.py", line 1, in <module>
H,W,N=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s195555829 | p04000 | u842689614 | 1566883706 | Python | Python (3.4.3) | py | Runtime Error | 3158 | 69324 | 2654 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
rows=[]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
rows.append(ab[i-1][0])
if N>0:
rows.append(ab[N-1][0])
r_b.append(N)
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box=[[[[False]*3 for k in range(3)] for j in range((len(cols[i]) if i<rN else 0))] for i in range(3)]
area_n=[0]*9
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box[0]=ched_box[1]
ched_box[1]=ched_box[2]
if rn<rN-2:
ched_box[2]=[[[False]*3 for k in range(3)] for j in range(len(cols[rn+2]))]
diccol=[dict(zip(cols[rn],list(range(len(cols[rn])))))]
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
diccol.append(dict(zip(cols[rn+1],list(range(len(cols[rn+1]))))))
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
diccol.append(dict(zip(cols[rn+2],list(range(len(cols[rn+2]))))))
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
diccol.append(dict(zip(cols[rn+1],list(range(len(cols[rn+1]))))))
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
for boxr in range(3):
for boxc in range(3):
if col-2+boxc<1 or col+boxc>W or row-2+boxr<1 or row+boxr>H:
ched_box[0][cn][boxr][boxc]=True
find_ab=[set([]) for i in range(3)]
for chr in range(row,min(row+3,H+1)):
if chr==row:
for chc in range(col+1,min(col+3,W+1)):
if chc in diccol[0]:
find_ab[0].add(chc)
elif chr==row1:
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in diccol[1]:
find_ab[1].add(chc)
elif chr==row2:
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in diccol[2]:
find_ab[2].add(chc)
for boxr in range(3):
for boxc in range(3):
if not ched_box[0][cn][boxr][boxc]:
count=1
for i in range(3):
for j in range(3):
if (col-2+boxc+j in find_ab[-2+boxr+i] if -2+boxr+i>=0 else False):
count+=1
if row-2+boxr+i==row1:
ched_box[1][diccol[1][col-2+boxc+j]][2-i][2-j]=True
elif row-2+boxr+i==row2:
ched_box[2][diccol[2][col-2+boxc+j]][2-i][2-j]=True
else:
ched_box[0][diccol[0][col-2+boxc+j]][2-i][2-j]=True
area_n[count-1]+=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmp5akybmr3/tmpnq10y9vy.py", line 1, in <module>
H,W,N=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s781771521 | p04000 | u842689614 | 1566883300 | Python | Python (3.4.3) | py | Runtime Error | 3158 | 69320 | 2661 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
rows=[]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
rows.append(ab[i-1][0])
if i==N-1:
r_b.append(N)
rows.append(ab[N-1][0])
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box=[[[[False]*3 for k in range(3)] for j in range((len(cols[i]) if i<rN else 0))] for i in range(3)]
area_n=[0]*9
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box[0]=ched_box[1]
ched_box[1]=ched_box[2]
if rn<rN-2:
ched_box[2]=[[[False]*3 for k in range(3)] for j in range(len(cols[rn+2]))]
diccol=[dict(zip(cols[rn],list(range(len(cols[rn])))))]
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
diccol.append(dict(zip(cols[rn+1],list(range(len(cols[rn+1]))))))
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
diccol.append(dict(zip(cols[rn+2],list(range(len(cols[rn+2]))))))
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
diccol.append(dict(zip(cols[rn+1],list(range(len(cols[rn+1]))))))
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
for boxr in range(3):
for boxc in range(3):
if col-2+boxc<1 or col+boxc>W or row-2+boxr<1 or row+boxr>H:
ched_box[0][cn][boxr][boxc]=True
find_ab=[set([]) for i in range(3)]
for chr in range(row,min(row+3,H+1)):
if chr==row:
for chc in range(col+1,min(col+3,W+1)):
if chc in diccol[0]:
find_ab[0].add(chc)
elif chr==row1:
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in diccol[1]:
find_ab[1].add(chc)
elif chr==row2:
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in diccol[2]:
find_ab[2].add(chc)
for boxr in range(3):
for boxc in range(3):
if not ched_box[0][cn][boxr][boxc]:
count=1
for i in range(3):
for j in range(3):
if (col-2+boxc+j in find_ab[-2+boxr+i] if -2+boxr+i>=0 else False):
count+=1
if row-2+boxr+i==row1:
ched_box[1][diccol[1][col-2+boxc+j]][2-i][2-j]=True
elif row-2+boxr+i==row2:
ched_box[2][diccol[2][col-2+boxc+j]][2-i][2-j]=True
else:
ched_box[0][diccol[0][col-2+boxc+j]][2-i][2-j]=True
area_n[count-1]+=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmp7xh6pmx0/tmp_5wvlm9_.py", line 1, in <module>
H,W,N=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s182559499 | p04000 | u842689614 | 1566878183 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3192 | 2510 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
rows=[]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
rows.append(ab[i-1][0])
if i==N-1:
r_b.append(N)
rows.append(ab[N-1][0])
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box=[[[[False]*3 for k in range(3)] for j in range((len(cols[i]) if i<rN else 0))] for i in range(3)]
area_n=[0]*9
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box[0]=ched_box[1]
ched_box[1]=ched_box[2]
if rn<rN-2:
ched_box[2]=[[[False]*3 for k in range(3)] for j in range(len(cols[rn+2]))]
setcol=[]
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
setcol.append(set(cols[rn+1]))
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
setcol.append(set(cols[rn+2]))
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
setcol.append(set(cols[rn+1]))
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
for boxr in range(3):
for boxc in range(3):
if col-2+boxc<1 or col+boxc>W or row-2+boxr<1 or row+boxr>H:
ched_box[0][cn][boxr][boxc]=True
find_ab=[]
for chr in range(row,min(row+3,H+1)):
if chr==row:
ch_col=set(cols[rn][cn+1:min(cn+3,cN)])
for chc in range(min(col+1,W),min(col+3,W+1)):
if chc in ch_col:
find_ab.append([row,chc])
elif: chr in [row+1,row+2]:
if chr==row1:
ch_col=setcol[0]
elif chr==row2:
ch_col=setcol[1]
else:
ch_col=[]
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in ch_col:
find_ab.append([chr,chc])
for boxr in range(3):
for boxc in range(3):
if not ched_box[0][cn][boxr][boxc]:
count=1
for i in range(3):
for j in range(3):
if [row-2+boxr+i,col-2+boxc+j] in find_ab:
count+=1
if row-2+boxr+i==row1:
rn_tmp=rn+1
elif row-2+boxr+i==row2:
rn_tmp=rn+2
else:
rn_tmp=rn
ched_box[rn_tmp-rn][cols[rn_tmp].index(col-2+boxc+j)][2-i][2-j]=True
area_n[count-1]+=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| File "/tmp/tmpc18al0ib/tmpjoum9jyv.py", line 64
elif: chr in [row+1,row+2]:
^
SyntaxError: invalid syntax
| |
s996229932 | p04000 | u842689614 | 1566868803 | Python | Python (3.4.3) | py | Runtime Error | 3159 | 64452 | 2489 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
rows=[]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
rows.append(ab[i-1][0])
if i==N-1:
r_b.append(N)
rows.append(ab[N-1][0])
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box=[[[[False]*3 for k in range(3)] for j in range((len(cols[i]) if i<rN else 0))] for i in range(3)]
area_n=[0]*9
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box[0]=ched_box[1]
ched_box[1]=ched_box[2]
if rn<rN-2:
ched_box[2]=[[[False]*3 for k in range(3)] for j in range(len(cols[rn+2]))]
setcol=[]
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
setcol.append(set(cols[rn+1]))
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
setcol.append(set(cols[rn+2]))
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
setcol.append(set(cols[rn+1]))
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
for boxr in range(3):
for boxc in range(3):
if col-2+boxc<1 or col+boxc>W or row-2+boxr<1 or row+boxr>H:
ched_box[0][cn][boxr][boxc]=True
find_ab=[]
for chr in range(rn,min(rn+3,rN)):
if chr==rn:
ch_col=set(cols[chr][cn+1:min(cn+3,cN)])
for chc in range(min(col+1,W),min(col+3,W+1)):
if chc in ch_col:
find_ab.append([row,chc])
else:
if rows[chr] in [row+1,row+2]:
if rows[chr]==row1:
ch_col=setcol[0]
else:
ch_col=setcol[1]
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in ch_col:
find_ab.append([row+chr-rn,chc])
for boxr in range(3):
for boxc in range(3):
if not ched_box[0][cn][boxr][boxc]:
count=1
for i in range(3):
for j in range(3):
if [row-2+boxr+i,col-2+boxc+j] in find_ab:
count+=1
if row-2+boxr+i==row1:
rn_tmp=rn+1
elif row-2+boxr+i==row2:
rn_tmp=rn+2
else:
rn_tmp=rn
ched_box[rn_tmp-rn][cols[rn_tmp].index(col-2+boxc+j)][2-i][2-j]=True
area_n[count-1]+=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmpngpta4yw/tmpbmpgd9qi.py", line 1, in <module>
H,W,N=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s256178610 | p04000 | u842689614 | 1566867719 | Python | Python (3.4.3) | py | Runtime Error | 3163 | 64500 | 1652 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
rows=[]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
rows.append(ab[i-1][0])
if i==N-1:
r_b.append(N)
rows.append(ab[N-1][0])
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box=[[[[False]*3 for k in range(3)] for j in range((len(cols[i]) if i<rN else 0))] for i in range(3)]
area_n=[0]*9
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if rn!=0:
ched_box[0]=ched_box[1]
ched_box[1]=ched_box[2]
if rn<rN-2:
ched_box[2]=[[[False]*3 for k in range(3)] for j in range(len(cols[rN+2]))]
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
for boxr in range(3):
for boxc in range(3):
if col-2+boxc<1 or col+boxc>W or row-2+boxr<1 or row+boxr>H:
ched_box[rn][cn][boxr][boxc]=True
find_ab=[]
for chr in range(rn,min(rn+3,rN)):
if chr==rn:
ch_col=set(cols[chr][cn+1:min(cn+3,cN)])
for chc in range(min(col+1,W),min(col+3,W+1)):
if chc in ch_col:
find_ab.append([row,chc])
else:
if rows[chr] in [row+1,row+2]:
ch_col=set(cols[chr])
for chc in range(max(col-2,1),min(col+3,W+1)):
if chc in ch_col:
find_ab.append([row+chr-rn,chc]) | Traceback (most recent call last):
File "/tmp/tmppdz3kjcl/tmps18z0o1d.py", line 1, in <module>
H,W,N=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s315579039 | p04000 | u842689614 | 1566866430 | Python | Python (3.4.3) | py | Runtime Error | 3161 | 90556 | 2072 | def p_range(start,end,max_n):
ss=max(start,0)
ee=min(max_n+1,end)
return range(ss,ee)
H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
rows=[]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
rows.append(ab[i-1][0])
rows.append(ab[N-1][0])
r_b.append(N)
cols=[[ab[j][1] for j in range(r_b[i],r_b[i+1])] for i in range(len(r_b)-1)]
rN=len(cols)
ched_box=[[[[False]*3 for k in range(3)] for j in range(len(cols[i]))] for i in range(rN)]
area_n=[0]*9
for rn in range(rN):
cN=len(cols[rn])
row=rows[rn]
if (rows[rn+1]==row+1 if rn<rN-1 else False):
row1=row+1
if (rows[rn+2]==row+2 if rn<rN-2 else False):
row2=row+2
else:
row2=None
elif (rows[rn+1]==row+2 if rn<rN-1 else False):
row1=row+2
row2=None
else:
row1=None
row2=None
for cn in range(cN):
col=cols[rn][cn]
for boxr in range(3):
for boxc in range(3):
if col-2+boxc<1 or col+boxc>W or row-2+boxr<1 or row+boxr>H:
ched_box[rn][cn][boxr][boxc]=True
find_ab=[]
for chr in range(rn,min(rn+3,rN)):
if chr==rn:
ch_col=set(cols[chr][cn+1:min(cn+3,cN)])
else:
if rows[chr] in [row+1,row+2]:
ch_col=set(cols[chr])
else:
ch_col=set([])
for chc in range(col-2,col+3):
if chc in ch_col:
find_ab.append([row+chr-rn,chc])
for boxr in range(3):
for boxc in range(3):
if not ched_box[rn][cn][boxr][boxc]:
count=1
for i in range(3):
for j in range(3):
if [row-2+boxr+i,col-2+boxc+j] in find_ab:
count+=1
if row-2+boxr+i==row1:
rn_tmp=rn+1
elif row-2+boxr+i==row2:
rn_tmp=rn+2
else:
rn_tmp=rn
ched_box[rn_tmp][cols[rn_tmp].index(col-2+boxc+j)][2-i][2-j]=True
area_n[count-1]+=1
print((W-2)*(H-2)-sum(area_n))
for i in range(9):
print(area_n[i])
| Traceback (most recent call last):
File "/tmp/tmpjfsn28ud/tmpuzpls1ko.py", line 6, in <module>
H,W,N=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.