s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s646592486 | p03944 | u423665486 | 1587241777 | Python | PyPy3 (2.4.0) | py | Runtime Error | 189 | 40560 | 529 | def resolve():
w, h, n = map(int, input().split())
r = [[True]*w for _ in range(h)]
for _ in range(n):
ix, iy, a = map(int, input().split())
if a == 1:
for row in r:
row[:ix] = [False]*ix
elif a == 2:
for row in r:
row[ix:] = [False]*ix if ix > 0 else [False]*w
elif a == 3:
for i in range(iy):
for j in range(w):
r[i][j] = False
else:
for i in range(iy, h):
for j in range(w):
r[i][j] = False
ans = 0
for row in r:
for i in row:
if i:
ans += 1
print(ans)
resolve() |
s334714101 | p03944 | u423665486 | 1587241370 | Python | PyPy3 (2.4.0) | py | Runtime Error | 188 | 40560 | 504 | def resolve():
w, h, n = map(int, input().split())
r = [[True]*w for _ in range(h)]
for _ in range(n):
ix, iy, a = map(int, input().split())
if a == 1:
for row in r:
row[:ix] = [False]*ix
elif a == 2:
for row in r:
row[ix:] = [False]*ix
elif a == 3:
for i in range(iy):
for j in range(w):
r[i][j] = False
else:
for i in range(iy, h):
for j in range(w):
r[i][j] = False
ans = 0
for row in r:
for i in row:
if i:
ans += 1
print(ans)
resolve() |
s291715304 | p03944 | u519939795 | 1586986194 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 92 | w,h,n=map(int,input().split())
s=w*h
while n>0:
x,y,a=map(int,input().split())
if |
s738786170 | p03944 | u823885866 | 1586479506 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 319 | import numpy as np
w,h,n=map(int,raw_input().split())
mp = np.zeros((w,h))
for i in range(n):
xi,yi,ai=map(int,raw_input().split())
if ai==1: # x < xi
mp[:xi,:] = 1
elif ai==2: # x > xi
mp[xi:,:] = 1
elif ai==3: # y < yi
mp[:,:yi] = 1
elif ai==4: # y > yi
mp[:,yi:] = 1
print w*h - np.sum(mp)
|
s093499662 | p03944 | u686036872 | 1586317883 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 298 | W, H, N = map(int,input().split())
Wmin = 0
Wmax = W
Hmin = 0
Hmax = H
for i in range(N):
x, y, z = map(int,input().split())
if z == 1:
Wmin = x
if z == 2:
Wmax = x
if z == 3:
Hmin = y
if z == 4:
Hmax = y
print(min((Wmax-Wmin)*(Hmax-Hmin)), 0) |
s155238521 | p03944 | u479638406 | 1585930072 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 404 | w, h, n = map(int, input().split())
a =[list(map(int, input().split())) for _ in range(n)]
g = [1*h]*w
for i in range(n):
if a[i][2] == 1:
g[:a[i][0]] = [0]*a[i][0]
elif a[i][2] == 2:
g[a[i][0]:] = [0]*a[i][0]
elif a[i][2] == 3:
g = [0 if g[j] == 0 else g[j]-a[i][1] for j in range(w)]
elif a[i][2] == 4:
g = [0 if g[j] == 0 else a[i][1] for j in range(w)]
print(sum(g)) |
s586190055 | p03944 | u395816772 | 1585694341 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 466 | w,h,n = map(int,input().split())
x = [int(i) for i in range(w+1)]
y = [int(i) for i in range(h+1)]
for i in range(n):
x_i, y_i, a = map(int,input().split())
if a == 1:
x = [int(j) for j in x if j >= int(x_i)]
elif a == 2:
x = [int(j) for j in x if j <= int(x_i)]
elif a == 3:
y = [int(j) for j in y if j >= int(y_i)]
elif a == 4:
y = [int(j) for j in y if j <= int(y_i)]
print((max(x)-min(x)) * (max(y)-min(y))) |
s519457273 | p03944 | u440129511 | 1585612408 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 347 | w,h,n=map(int,input().split())
xya = [list(map(int, input().split())) for _ in range(n)]
w1=w
h1=h
for i in range(n):
if xya[i][2]==1:w1=w-int(xya[i][0])
elif xya[i][2]==2:w1-=(w-int(xya[i][0])
elif xya[i][2]==3:h1=h-int(xya[i][1])
elif xya[i][2]==4:h1-=(h-int(xya)[i][1])
else:pass
if w1>0 and h1>0:print(w1*h1)
else:print(0)
|
s665514135 | p03944 | u440129511 | 1585612377 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 359 | w,h,n=map(int,input().split())
xya = [list(map(int, input().split())) for _ in range(n)]
xya.sort(a)
w1=w
h1=h
for i in range(n):
if xya[i][2]==1:w1=w-int(xya[i][0])
elif xya[i][2]==2:w1-=(w-int(xya[i][0])
elif xya[i][2]==3:h1=h-int(xya[i][1])
elif xya[i][2]==4:h1-=(h-int(xya)[i][1])
else:pass
if w1>0 and h1>0:print(w1*h1)
else:print(0)
|
s161470158 | p03944 | u857759499 | 1585452464 | Python | Python (3.4.3) | py | Runtime Error | 342 | 21676 | 293 | import numpy as np
w,h,n = map(int,input().split())
d = np.zeros(w-1,h-1)
for i in range(n):
x,y,a = map(int,input().split())
if a == 1:
d[:w] = 1
elif a == 2:
d[w:] = 1
elif a ==3:
d[:,:h] = 1
else:
d[:,h:] = 1
print(np.count_nonzero(d==0)) |
s381024467 | p03944 | u702786238 | 1585063921 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38384 | 283 | import numpy as np
W, H, N = map(int, input().split())
l = np.zeros((H,W))
for i in range(N):
x, y, a = map(int, input().split())
if a==1:
l[:,:x] = 1
elif a==2:
l[:,x:] = 1
elif a==3:
l[:y,:] = 1
elif a==4:
l[y:,:] = 1
print(H*W-int(l.sum().sum()))
|
s686474944 | p03944 | u702786238 | 1585063881 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 282 | import numpy as np
W, H, N = map(int, input().split())
l = np.zeros((H,W))
for i in range(N):
x, y, a = map(int, input().split())
if a==1:
l[:,:x] = 1
elif a==2:
l[:,x:] = 1
elif a==3:
l[:y,:] = 1
elif a==4:
l[y:,:] = 1
print(H*W-int(l.sum().sum())) |
s037611160 | p03944 | u702786238 | 1585063854 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38384 | 282 | import numpy as np
W, H, N = map(int, input().split())
l = np.zeros((H,W))
for i in range(N):
x, y, a = map(int, input().split())
if a==1:
l[:,:x] = 1
elif a==2:
l[:,x:] = 1
elif a==3:
l[:y,:] = 1
elif a==4:
l[y:,:] = 1
print(H*W-int(l.sum().sum())) |
s113415291 | p03944 | u016323272 | 1584901327 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 443 | #ABC047.B
w,h,n = map(int,input().split())
#座標を作る
right = w
left = 0
upper = h
under = 0
for _ in range(n):
x,y,a = map(int,input().split())
if a ==1:
left = max(x,left)
elif a ==2:
right = min (x,right)
elif a ==3:
under = max(y,under)
elif a ==4:
upper = min(y,upper)
if (upper-under)>0 and (right-left)>0:
c = (upper-under)*(right-left)
print(c)
else:
print(0) |
s638219030 | p03944 | u016323272 | 1584900879 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 411 | #ABC047.B
w,h,n = map(int,input().split())
#座標を作る
right = w
left = 0
upper = h
under = 0
for _ in range(n):
x,y,a = map(int,input().split())
if a ==1:
left = max(x,left)
elif a ==2:
right = min (x,right)
elif a ==3:
under = max(y,under)
elif a ==4:
upper = min(y,upper)
if (upper-under)>0 and (right-left)>0:
c = (upper-under)*(right-left)
print(c)
else:
print(0) |
s469096273 | p03944 | u886142147 | 1584638390 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 374 | w, h, n = map(int, input().split())
T = [list(map(int, input().split())) for i in range(n)]
xr = w
xl = 0
yu = h
yl = 0
for i in range(n):
if T[i][2] == 2:
xr = min(xr, T[i][0])
elif T[i][2] == 1:
xl = max(xl, T[i][0])
elif T[i][2] == 4:
yu = min(yu, T[i][1])
else:
yl = max(yl, T[i][1])
print(max((xr - xl) * (yu - yl), 0) |
s028983509 | p03944 | u341736906 | 1583968577 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 324 | W,H,N=map(int,input().split())
x1=0
x2=W
y1=0
y2=H
for i in range(N):
x,y,a=map(int,input().split())
if a==1:
x1=max(x1,x)
elif a==2:
x2=min(x,x2)
elif a==3:
y1=max(y1,y)
elif a==4:
y2=min(y,y2)
if x2<x1 or y2<y1:
print(0)
sys.exit()
xx=x2-x1
yy=y2-y1
print(xx*yy) |
s506345563 | p03944 | u341736906 | 1583968548 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 343 | W,H,N=map(int,input().split())
x1=0
x2=W
y1=0
y2=H
for i in range(N):
x,y,a=map(int,input().split())
if a==1:
x1=max(x1,x)
elif a==2:
x2=min(x,x2)
elif a==3:
y1=max(y1,y)
elif a==4:
y2=min(y,y2)
if x2<x1 or y2<y1:
print(0)
sys.exit()
print(x1,x2,y1,y2)
xx=x2-x1
yy=y2-y1
print(xx*yy) |
s344502026 | p03944 | u576917603 | 1583692674 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 207 | x,y=0,0
for s,t,u in a:
if u==1:
x=max(x,s)
elif u==2:
w=min(w,s)
elif u==3:
y=max(y,t)
else:
h=min(h,t)
height=max(0,h-y)
width=max(0,w-x)
print(height*width) |
s599242905 | p03944 | u105302073 | 1583519949 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 480 | w, h, n = [int(i) for i in input().split()]
w2, h2 = w, h
wb, hb = [False] * w, [False] * h
for i in range(n):
x, y, a = [int(i) for i in input().split()]
if a == 1 and not wb[x]:
w2 -= x
wb[x] = True
elif a == 2 and not wb[x]:
w2 -= w - x
wb[x] = True
elif a == 3 and not hb[y]:
h2 -= y
hb[y] = True
elif a == 4 and not hb[y]:
h2 -= h - y
hb[y] = True
ans = w2 * h2
print(ans if ans > 0 else 0)
|
s406783089 | p03944 | u829796346 | 1583339406 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 386 | W,H,N = map(int,input().split())
c = [0]*N
max_x,min_x = 0,W
max_y,min_y = 0,H
for _ in range(M):
x,y,a = map(int,input().split())
if a == 1:
max_x = max(max_x,x)
elif a == 2:
min_x = min(min_x,x)
elif a == 3:
max_y = max(max_y,y)
else:
min_y = min(min_y,y)
if min_x <= max_x or min_y <= max_y:
print(0)
exit()
print((min_x-max_x)*(min_y-max_y))
|
s413298133 | p03944 | u506858457 | 1583069125 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 377 | W,H,N=map(int,input().split())
x=[0]*N
y=[0]*N
a=[0]*N
minX=0
maxX=W
minY=0
maxY=H
for i in range(N):
x[i],y[i],a[i]=map(int,input().split())
if a[i]==1:
minX=max(minX,x[i])
if a[i]==2:
maxX=min(maxX,x[i])
if a[i]==3:
minY=max(minY,y[i])
if a[i]==4:
maxY=min(maxY,y[i])
ans=(maxX-minX)*(maxY-minY)
if maxX<minX or maxY<minY:
ans=0
print(max(ans)
|
s577195471 | p03944 | u620157187 | 1582677809 | Python | Python (3.4.3) | py | Runtime Error | 148 | 12508 | 538 | import numpy as np
W, H, N = map(int, input().split())
x = [0] * N
y = [0] * N
a = [0] * N
for i in range(N):
x[i], y[i], a[i] = map(int, input().split())
total = W*H
x_list = np.arange(0, W+1)
y_list = np.arange(0, H+1)
for i in range(len(a)):
if a[i] == 1:
x_list = x_list[x[i]:]
elif a[i] == 2:
x_list = x_list[:x[i]+1]
elif a[i] == 3:
y_list = y_list[y[i]:]
else:
y_list = y_list[:y[i]+1]
x_len = x_list[-1]-x_list[0]
y_len = y_list[-1]-y_list[0]
print(x_len*y_len) |
s123226307 | p03944 | u223663729 | 1582677802 | Python | Python (3.4.3) | py | Runtime Error | 156 | 12864 | 320 | import numpy as np
W, H, N = map(int, input().split())
ze = np.ones(W+1, H+1)
for i in range(N):
x, y, a = map(int, input().split())
if a == 1:
ze[:x, :] = 0
elif a == 2:
ze[x+1:, :] = 0
elif a == 3:
ze[:, :y] = 0
elif a == 4:
ze[:, y+1:] = 0
print(np.sum(ze)) |
s978537685 | p03944 | u223663729 | 1582677735 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 387 | W, H, N = map(int, input().split())
for Nimport numpy as np
W, H, N = map(int, input().split())
ze = np.ones(W+1, H+1)
for i in range(N):
li = [x, y, a = map(int, input().split()) for i in range(N)]
if a == 1:
ze[:x, :] = 0
elif a == 2:
ze[x+1:, :] = 0
elif a == 3:
ze[:, :y] = 0
elif a == 4:
ze[:, y+1:] = 0
print(np.sum(ze)) |
s631700705 | p03944 | u346812984 | 1582432477 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 319 | W, H, N = map(int, input().split())
min_H = 0
min_W = 0
max_H = H
max_W = W
for _ in range(N):
x, y, a = map(int, input().split())
if a == 1:
min_W = x
elif a == 2:
max_W = x
elif a == 3:
min_H = y
else:
max_H = y
print(max(((max_H - min_H) * (max_W - min_W)), 0)
|
s654712263 | p03944 | u630027862 | 1581977554 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 1 | a |
s088696456 | p03944 | u796708718 | 1581879000 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 404 | W, H, N = [int(i) for i in input().split(" ")]
a1 = [0,0]
a2 = [W,0]
a3 = [0,0]
a4 = [0,H]
for i in range(0,N):
lst = [int(i) for i in input().split(" ")]
if lst[2] == 1:
a1[0] = max(a1[0],lst[0])
elif lst[2] == 2:
a2[0] = max(a2[0],lst[0])
elif lst[2] == 3:
a3[1] = max(a3[1],lst[1])
elif lst[2] == 4:
a4[1] = max(a4[1],lst[1])
print(max(0,a2[0]-a1[0])*max(0,(a4[1]-a3[1]))
|
s578973864 | p03944 | u796708718 | 1581878962 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 405 | W, H, N = [int(i) for i in input().split(" ")]
a1 = [0,0]
a2 = [W,0]
a3 = [0,0]
a4 = [0,H]
for i in range(0,N):
lst = [int(i) for i in input().split(" ")]
if lst[2] == 1:
a1[0] = max(a1[0],lst[0])
elif lst[2] == 2:
a2[0] = max(a2[0],lst[0])
elif lst[2] == 3:
a3[1] = max(a3[1],lst[1])
elif lst[2] == 4:
a4[1] = max(a4[1]1,lst[1])
print(max(0,a2[0]-a1[0])*max(0,(a4[1]-a3[1]))
|
s555051954 | p03944 | u796708718 | 1581878935 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 404 | W, H, N = [int(i) for i in input().split(" ")]
a1 = [0,0]
a2 = [W,0]
a3 = [0,0]
a4 = [0,H]
for i in range(0,N):
lst = [int(i) for i in input().split(" ")]
if lst[2] == 1:
a1[0] = max(a1[0],lst[0])
elif lst[2] == 2:
a2[0] = max(a2[0],lst[0])
elif lst[2] == 3:
a3[1] = max(a3[1],lst[1])
elif lst[2] == 4:
a4[1] = max(a4[]1,lst[1])
print(max(0,a2[0]-a1[0])*max(0,(a4[1]-a3[1]))
|
s089938111 | p03944 | u595064211 | 1581781844 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 459 | W, H, N = map(int, input().split())
right = W
left = 0
top = H
bottom = 0
for i in range(N):
x, y, a = map(int, input().split())
if a == 1 and left <= x:
left = x
elif a == 2 and right >= x:
right = x
elif a == 3 and bottom <= y:
bottom = y
elif a == 4 and top >= y:
top = y
if (top-bottom)*(right-left) > 0 and (top-bottom)>0 and (rightt-left)>0:
print((top-bottom)*(right-left))
else:
print(0)
|
s457537923 | p03944 | u268792407 | 1580846219 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 377 | w,h,n=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(n)]
xya1=[i[0] for i in xya if i[2]==1]
xya2=[i[0] for i in xya if i[2]==2]
xya3=[i[1] for i in xya if i[2]==3]
xya4=[i[1] for i in xya if i[2]==4]
left=max(xya1)
right=min(xya2)
lower=max(xya3)
upper=min(xya4)
if left>=right or lower>=upper:
print(0)
else:
print((right-left)*(upper-lower)) |
s421291732 | p03944 | u268792407 | 1580845425 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 377 | w,h,n=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(n)]
xya1=[i[0] for i in xya if i[2]==1]
xya2=[i[0] for i in xya if i[2]==2]
xya3=[i[1] for i in xya if i[2]==3]
xya4=[i[1] for i in xya if i[2]==4]
left=max(xya1)
right=min(xya2)
lower=max(xyz3)
upper=min(xyz4)
if left>=right or lower>=upper:
print(0)
else:
print((right-left)*(upper-lower)) |
s321938216 | p03944 | u354847446 | 1580508419 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 534 | import math
import sys
import numpy as np
#n, a, b= map(int, input().split())
w, h, n = map(int, input().split())
#s = list(str(input()))
#n = int(input())
#a = list(map(int, input().split()))
x = [0]*n
y = [0]*n
a = [0]*n
for i in range(n):
x[i], y[i], a[i] = map(int, input().split())
area = np.ones([w,h])
for i in range(n):
if(a[i] == 1):
area[:x[i],:] = 0
if(a[i] == 2):
area[w-x[i]-1:w,:] = 0
if(a[i] == 3):
area[:,:y[i]] = 0
if(a[i] == 4):
area[:,h-y[i]-1] = 0
print(np.count_nonzero(area == 1)) |
s751368097 | p03944 | u843722521 | 1580014333 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 232 | w,h,n=map(int,input().split())
p,s,r,s=0,w,0,h
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
p=max(p,x)
elif a==2:
q=min(q,x)
elif a==3:
r=max(r,y)
elif a==4:
s=min(s,y)
print((p-q)*(r-s))
|
s918408010 | p03944 | u995062424 | 1579922052 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 474 | w, h, n=map(int,input().split())
mat = [list(map(int, input().split())) for _ in range(n)]
w1 = 0
w2 = w
h1 = 0
h2 = h
for i in range(n):
if(mat[i][2] == 1 and w1 < mat[i][0]):
w1 = mat[i][0]
elif(mat[i][2] == 2 and w2 > mat[i][0]):
w2 = mat[i][0]
elif(mat[i][2] == 3 and w3 < mat[i][1]):
h1 = mat[i][1]
elif(mat[i][2] == 4 and w4 > mat[i][1]):
h2 = mat[i][1]
print((w2-w1)*(h2-h1) if w2 >= w1 and h2 >= h1 else 0) |
s276546157 | p03944 | u867848444 | 1579550611 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 369 | #abc047-b
w,h,n=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
#x,y,a
x_min=0
y_min=0
for i in l:
if i[-1]==1:
x_min=max(i[0],x_min)
elif i[-1]==2:
w=min(i[0],w)
elif i[-1]==3:
y_min=max(i[1],y_min)
else:
h=min(i[1],h)
s=
print((w-x_min)*(h-y_min) if (w-x_min)>0 and (h-y_min)>0 else 0) |
s025249153 | p03944 | u072717685 | 1579457986 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 543 | W, H, N = map(int, input().split())
paint_dot = {}
for _ in range(N):
t1, t2, t3 = map(int,input().split())
paint_dot[(t1, t2)] = t3
pattern_H = [1]*H
pattern_W = [1]*W
for key in paint_dot:
if paint_dot[key] == 1:
for i in range(key[0]):
pattern_W[i] = 0
elif paint_dot[key] == 2:
for i in range(key[0],W):
pattern_W[i] = 0
elif paint_dot[key] == 3:
for i in range(key[1]):
pattern_H[i] = 0
else:
for i in range(key[1],W):
pattern_H[i] = 0
print(sum(pattern_W) * sum(pattern_H))
|
s760278842 | p03944 | u633450100 | 1579408774 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 485 | xmax,ymax,N = [int(i) for i in input().split()]
x,y,a = list(map(int,input().split()))
xmin = 0
ymin = 0
for i in range(N):
if a[i] == 1:
if xmin < x[i]:
xmin = x[i]
elif a[i] == 2:
if xmax > x[i]:
xmax = x[i]
elif a[i] == 3:
if ymin < y[i]:
ymin = y[i]
elif a[i] == 4:
if ymax > y[i]:
ymax = y[i]
if ymax > ymin and xmax > xmin:
print((ymax - ymin)*(xmax - xmin))
else:
print(0) |
s381272770 | p03944 | u508405635 | 1579035575 | Python | Python (3.4.3) | py | Runtime Error | 62 | 3188 | 1077 | W, H, N = map(int, input().split())
X = []
Y = []
A = []
for i in range(N):
x, y, a = map(int, input().split())
X.append(x)
Y.append(y)
A.append(a)
## 長方形のマスを塗りつぶしていって残ったマス目を数えるイメージ
# 0: 白, 1: 黒
square = []
for i in range(H):
horizonatlArea = []
for j in range(W):
horizonatlArea.append(0)
square.append(horizonatlArea)
# Aの要素の番号に応じてsquareに1を埋めていく
for n in range(N):
if A[n] == 1:
for i in range(X[n]):
for j in range(H):
square[j][i] = 1
elif A[n] == 2:
for i in range(X[n], W):
for j in range(H):
square[j][i] = 1
elif A[n] == 3:
for i in range(W):
for j in range(y[n]):
square[j][i] = 1
elif A[n] == 4:
for i in range(W):
for j in range(Y[n], H):
square[j][i] = 1
# square内の要素の数を数えて出力
cnt = 0
for j in range(H):
cnt += square[j].count(0)
print(cnt) |
s852569405 | p03944 | u508405635 | 1579035532 | Python | Python (3.4.3) | py | Runtime Error | 63 | 3188 | 1091 | W, H, N = map(int, input().split())
X = []
Y = []
A = []
for i in range(N):
x, y, a = map(int, input().split())
X.append(x)
Y.append(y)
A.append(a)
## 長方形のマスを塗りつぶしていって残ったマス目を数えるイメージ
# 0: 白, 1: 黒
square = []
for i in range(H):
horizonatlArea = []
for j in range(W):
horizonatlArea.append(0)
square.append(horizonatlArea)
# Aの要素の番号に応じてsquareに1を埋めていく
for n in range(N):
if A[n] == 1:
for i in range(X[n]):
for j in range(H):
square[j][i] = 1
elif A[n] == 2:
for i in range(X[n], W):
for j in range(H):
square[j][i] = 1
elif A[n] == 3:
for i in range(W):
for j in range(y[n]):
square[j][i] = 1
elif A[n] == 4:
for i in range(W):
for j in range(Y[n], H):
square[j][i] = 1
print(square)
# square内の要素の数を数えて出力
cnt = 0
for j in range(H):
cnt += square[j].count(0)
print(cnt) |
s747731899 | p03944 | u609814378 | 1577235778 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1 | a |
s027714910 | p03944 | u311669106 | 1577220415 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 231 | w,h,n=map(int,input().split())
ln=[0]*4
for i in range(n):
x,y,a=map(int,input().split())
if a==1 or a==2:
ln[a-1].append(x)
else:
ln[a-1].append(y)
print((min(ln[1])-max(ln[0]))*(min(ln[3])-max(ln[2]))) |
s740284152 | p03944 | u311669106 | 1577220377 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 230 | w,h,n=map(int,input().split())
ln=[0]*4
for i in range(n):
x,y,a=map(int,input().split())
if a==1 or a==2:
ln[a-1].append(x)
else:
ln[a-1].append(y)
print((min(ln[1])-max(ln[0]))*(min(ln[3])-max(ln[2])) |
s711286842 | p03944 | u469700628 | 1577081410 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 488 | W,H,N = list(map(int,input().split()))
points = [list(map(int, input().split())) for _ in range(N)]
# res = [[0 for _ in range(W)] for _ in range(H)]
res = 0
minx, maxx, miny, maxy = [0,W,0,H]
x = 0
y = 0
for x,y,a in points:
if a == 1:
minx = x
if a == 2:
maxx = x
if a == 3:
miny = y
if a == 4:
maxy = y
if maxx - minx <= 0 or maxy - miny <=0:
res = 0
else:
res = (maxx-minx) * (maxy - miny)
print(res)
~ |
s411472050 | p03944 | u006425112 | 1577025686 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 471 | import sys
w,h,n = map(int, sys.stdin.readline().split())
x_min = 0
x_max = w
y_min = 0
y_max = h
for i in range(n):
x,y,a = map(int, input().split())
if a == 1:
x_min = max(x, x_min)
elif a == 2:
x_max = min(x, x_max)
elif a == 3:
y_min = max(y, y_min)
else:
y_max = mix(y, y_max)
print(x_min, x_max, y_min, y_max)
if x_min >= x_max or y_min >= y_max:
print(0)
else:
print((x_max - x_min) * (y_max - y_min)) |
s835939558 | p03944 | u651593570 | 1576788446 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1541 | #include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;
const int mod = 1e9+7;
int toint(string s) {
int ans = 0;
for(char x: s) ans = ans*10 + (x - '0');
return ans;
}
int lcs(string a, string b) {
int n = a.size(), m = b.size();
int dp[2][m+1];
for(int i = 0;i <= n;i++) {
for(int j = 0;j <= m;j++) {
if(i==0||j==0) dp[i%2][j] = 0;
else {
if(a[i-1] == b[j-1]) dp[i%2][j] = 1 + dp[1-i%2][j-1];
else dp[i%2][j] = max(dp[i%2][j-1], dp[1-i%2][j]);
}
}
}
return dp[n%2][m];
}
int sum(int x) {
int s = 0;
while(x) {
s += x%10;
x /= 10;
}
return s;
}
bool equal(string s) {
for(int i = 0,j = s.size()/2;j < s.size();i++,j++) {
if(s[i] != s[j]) return false;
}
return true;
}
ll fact(int n) {
ll ans = 1;
fr(i,2,n+1) ans = (ans*i)%mod;
return ans;
}
ull f(ll a, ll x) {
if(a < 0) return 0;
return (a/x+1);
}
int main() {
int w,h,n;
cin>>w>>h>>n;
int minx = 0, maxx = w, miny = 0, maxy = h; // white area
while(n--) {
int x,y,a;
cin>>x>>y>>a;
if(a==1) {
minx = max(minx, x);
}else if(a==2) {
maxx = min(maxx, x);
}else if(a==3) {
miny = max(miny,y);
}else if(a==4){
maxy = min(maxy,y);
}
}
int ans = max(0,(maxx-minx)*(maxy-miny));
cout<<ans;
}
|
s466522812 | p03944 | u760802228 | 1576272239 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 489 | W, H, N = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(N)]
x_black = [0] * W
y_black = [0] * H
def get_area(x, y, a):
if a == 1:
x_black[:x] = [1] * x
if a == 2:
x_black[x:W] = [1] * (W - x)
if a == 3:
y_black[y] = [1] * y
if a == 4:
y_black[y:H] = [1] * (H - y)
for i in xy:
get_area(i[0], i[1], i[2])
print(x_black.count(0) * y_black.count(0)) |
s892834617 | p03944 | u934052933 | 1576019940 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 496 |
def main()->None:
W, H, N = map(int, input().split())
range_N = range(N)
xl, xr, yd, yu = 0, w, 0, h
for i in range_N:
x, y, a = map(int, input().split())
if a == 1:
xl = max(x, xl)
if a == 2:
xr = min(x, xr)
if a == 3:
yd = max(y, yd)
else:
yu = min(y, yu)
if xl >= xr or yd >= yu:
print(0)
else:
print((xr - xl) * (yu - yd))
if __name__ == "__main__":
main() |
s906101502 | p03944 | u934052933 | 1576019255 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 495 |
def main()->None:
W, H, N = map(int, input().split())
range_N = range(N)
xl, xr, yd, yu = 0, w, 0, h
for i in range_N:
x, y, a = map(int, input().split()
if a == 1:
xl = max(x, xl)
if a == 2:
xr = min(x, xr)
if a == 3:
yd = max(y, yd)
else:
yu = min(y, yu)
if xl >= xr or yd >= yu:
print(0)
else:
print((xr - xl) * (yu - yd))
if __name__ == "__main__":
main() |
s610157808 | p03944 | u934052933 | 1576013642 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 591 |
def main()->None:
W, H, N = map(int, input().split())
range_N = range(N)
xy = []
a_i = []
for i in range_N:
x, y, a = map(int, input().split())
xy.append([x, y])
a_i.append(a)
flag = False
for x, y, a in zip(xy, a_i):
if a % 4 == 1:
W -= x
if a % 4 == 2:
W -= x
if a % 4 == 3:
H -= y
else:
H -= y
if W <= 0 or H <= 0:
flag = True
break
if flag: print(0)
else: print(W*H)
if __name__ == "__main__":
main() |
s921791418 | p03944 | u355371431 | 1575396851 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38384 | 761 | W,H,N = map(int,input().split())
zero = [0,0]
X = [W,H]
ans = True
for i in range(N):
x,y,a = map(int,input().split())
if(a == 1):
if zero[0] < x < X[0]:
zero[0] = x
elif X[0] =< x:
ans = False
break
elif(a == 2):
if zero[0] < x < X[0]:
X[0] = x
elif zero[0] => x:
ans = False
break
elif(a == 3):
if zero[1] < y < X[1]:
zero[1] = y
elif X[1] =< y:
ans = False
break
elif(a == 4):
if zero[1] < y < X[1]:
X[1] = y
elif zero[0] => y:
ans = False
break
if(ans):
S = (X[1] - zero[1]) * (X[0] - zero[0])
print(S)
else:
print(0) |
s833364504 | p03944 | u836737505 | 1574368946 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 414 | W, H, N = map(int, input().split())
maxX,minX,maxY,minY = W, 0, H ,0
for i in range(N):
x, y, a = map(int, input().split())
if a == 1 and x > minX:
minX = x
elif a == 2 and x < maxX:
maxX = x
elif a == 3 and y > minY:
minY = y
elif a == 4 and y < maxY:
maxY = y
xl = maxX - minX
yl = maxY - minY
if x1 > 0 and y1 > 0:
print(x1*y1)
else:
print(0) |
s305121458 | p03944 | u991619971 | 1573880077 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 767 | W,H,N=map(int,input().split())
x=[]
y=[]
a=[]
w=[i for i in range(W+1)]
h=[i for i in range(H+1)]
S=W*H
for _ in range(N):
X, Y, A = map(int, input().split())
x.append(X)
y.append(Y)
a.append(A)
for i in range(len(x)):
if a[i]==1 and x[i] > w[0]:
for j in range(x[i]):
if j in w: w.remove(j)
if a[i]==2 and x[i] < w[-1]:
for j in reversed(range(x[i]+1,w[-1]+1)):
if j in w: w.remove(j)
if a[i]==3 and y[i] > h[0]:
for j in range(y[i]):
if j in h: h.remove(j)
if a[i]==4 and y[i] < h[-1]:
for j in reversed(range(y[i]+1,h[-1]+1)):
if j in h: h.remove(j)
if len(w)==0 or len(h)==0:
print(0)
else:
S_f = (w[-1]-w[0]) * (h[-1]-h[0])
print(S_f)
|
s106536999 | p03944 | u991619971 | 1573879957 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 701 | W,H,N=map(int,input().split())
x=[]
y=[]
a=[]
w=[i for i in range(W+1)]
h=[i for i in range(H+1)]
S=W*H
for _ in range(N):
X, Y, A = map(int, input().split())
x.append(X)
y.append(Y)
a.append(A)
for i in range(len(x)):
if a[i]==1:
for j in range(x[i]):
if j in w: w.remove(j)
if a[i]==2:
for j in reversed(range(x[i]+1,w[-1]+1)):
if j in w: w.remove(j)
if a[i]==3:
for j in range(y[i]):
if j in h: h.remove(j)
if a[i]==4:
for j in reversed(range(y[i]+1,h[-1]+1)):
if j in h: h.remove(j)
if len(w)==0 or len(h)==0:
print(0)
else:
S_f = (w[-1]-w[0]) * (h[-1]-h[0])
print(S_f)
|
s651103855 | p03944 | u991619971 | 1573878942 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 749 | W,H,N=map(int,input().split())
x=[]
y=[]
a=[]
w=[i for i in range(W+1)]
h=[i for i in range(H+1)]
S=W*H
for _ in range(N):
X, Y, A = map(int, input().split())
x.append(X)
y.append(Y)
a.append(A)
for i in range(len(x)):
if a[i]==1 and x[i] > w[0]:
for j in range(x[i]):
w.remove(j)
if a[i]==2 and x[i] < w[-1]:
for j in reversed(range(x[i]+1,w[-1]+1)):
w.remove(j)
if a[i]==3 and y[i] > h[0]:
for j in range(y[i]):
h.remove(j)
if a[i]==4 and y[i] < h[-1]:
for j in reversed(range(y[i]+1,h[-1]+1)):
h.remove(j)
if len(w)==0 or len(h)==0 or len(w)==1 or len(h)==1:
print(0)
else:
S_f = (w[-1]-w[0]) * (h[-1]-h[0])
print(S_f)
|
s259251935 | p03944 | u991619971 | 1573877795 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 723 | W,H,N=map(int,input().split())
x=[]
y=[]
a=[]
w=[i for i in range(W+1)]
h=[i for i in range(H+1)]
S=W*H
for _ in range(N):
X, Y, A = map(int, input().split())
x.append(X)
y.append(Y)
a.append(A)
for i in range(len(x)):
if a[i]==1 and x[i] > w[0]:
for j in range(x[i]):
w.remove(j)
if a[i]==2 and x[i] < w[-1]:
for j in reversed(range(x[i]+1,w[-1]+1)):
w.remove(j)
if a[i]==3 and y[i] > h[0]:
for j in range(y[i]):
h.remove(j)
if a[i]==4 and y[i] < h[-1]:
for j in reversed(range(y[i]+1,h[-1]+1)):
h.remove(j)
if len(w)==0 or len(h)==0:
print(0)
else:
S_f = (w[-1]-w[0]) * (h[-1]-h[0])
print(S_f)
|
s713044231 | p03944 | u991619971 | 1573872241 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 723 | W,H,N=map(int,input().split())
x=[]
y=[]
a=[]
w=[i for i in range(W+1)]
h=[i for i in range(H+1)]
S=W*H
for _ in range(N):
X, Y, A = map(int, input().split())
x.append(X)
y.append(Y)
a.append(A)
for i in range(len(x)):
if a[i]==1 and x[i] > w[0]:
for j in range(x[i]):
w.remove(j)
if a[i]==2 and x[i] < w[-1]:
for j in reversed(range(x[i]+1,w[-1]+1)):
w.remove(j)
if a[i]==3 and y[i] > h[0]:
for j in range(y[i]):
h.remove(j)
if a[i]==4 and y[i] < h[-1]:
for j in reversed(range(y[i]+1,h[-1]+1)):
h.remove(j)
if len(w)==0 or len(h)==0:
print(0)
else:
S_f = (w[-1]-w[0]) * (h[-1]-h[0])
print(S_f)
|
s593467991 | p03944 | u215315599 | 1571752776 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 311 | W, H, N = map(int,input().split())
#白い領域の端
l = 0
r = W
u = H
d = 0
for i in range(N):
x, y, a = map(int,input().split())
if a == 1:
l = max(x,l)
elif a == 2:
r = min(x,r)
elif a == 3:
d = max(y,d)
else:
u = min(y,u)
print(max((r-l),0)*max((u-d),0) |
s337867210 | p03944 | u862757671 | 1571348663 | Python | Python (3.4.3) | py | Runtime Error | 137 | 3316 | 1690 | W,H,N = map(int,input().split())
CoordinateList = []
for i in range(N):
x,y,a = map(int, input().split())
CoordinateList.append([x,y,a])
# raw White & Black
AllArea = []
for numline in range(H):
rawWhite = []
rawBlack = []
for numraw in range(W):
rawWhite.append("W")
rawBlack.append("B")
AllArea.append(rawWhite)
# coloring from white to Black
for n in range(N):
if CoordinateList[n][2] == 1:
if CoordinateList[n][0] == 0:
pass
else:
for i in range(H):
del AllArea[i][:(CoordinateList[n][0])]
for numX in range(CoordinateList[n][0]):
AllArea[i].insert(0,"B")
elif CoordinateList[n][2] == 2:
if CoordinateList[n][0] == 0:
print(0)
exit()
else:
for i in range(H):
del AllArea[i][(CoordinateList[n][0]):]
for numX in range(CoordinateList[n][0]):
AllArea[i].append("B")
elif CoordinateList[n][2] == 3:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
print(0)
exit()
else:
del AllArea[changeY:]
for changeRaw in range(changeY):
AllArea.append(rawBlack)
elif CoordinateList[n][2] == 4:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
pass
else:
del AllArea[:changeY]
for changeRaw in range(changeY):
AllArea.insert(0,rawBlack)
# counting
AreaWhite = 0
for i in range(H):
AreaWhite += AllArea[i].count("W")
print(AreaWhite) |
s850542910 | p03944 | u578049848 | 1571345578 | Python | Python (3.4.3) | py | Runtime Error | 138 | 3316 | 1703 | W,H,N = map(int,input().split())
CoordinateList = []
for i in range(N):
x,y,a = map(int, input().split())
CoordinateList.append([x,y,a])
# raw White & Black
AllArea = []
for numline in range(H):
rawWhite = []
rawBlack = []
for numraw in range(W):
rawWhite.append("W")
rawBlack.append("B")
AllArea.append(rawWhite)
# coloring from white to Black
for n in range(N):
if CoordinateList[n][2] == 1:
if CoordinateList[n][0] == 0:
pass
else:
for i in range(H):
del AllArea[i][:(CoordinateList[n][0])]
for numX in range(CoordinateList[n][0]):
AllArea[i].insert(0,"B")
elif CoordinateList[n][2] == 2:
if CoordinateList[n][0] == 0:
print(0)
exit()
else:
for i in range(H):
del AllArea[i][(CoordinateList[n][0]):]
for numX in range(CoordinateList[n][0]):
AllArea[i].append("B")
elif CoordinateList[n][2] == 3:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
print(0)
exit()
else:
del AllArea[changeY:]
for changeRaw in range(changeY):
AllArea.append(rawBlack)
elif CoordinateList[n][2] == 4:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
pass
else:
del AllArea[:changeY]
for changeRaw in range(changeY):
AllArea.insert(0,rawBlack)
# counting
AreaWhite = 0
for i in range(H):
AreaWhite += AllArea[i].count("W")
print(AreaWhite)
|
s395862540 | p03944 | u578049848 | 1571345217 | Python | Python (3.4.3) | py | Runtime Error | 140 | 3316 | 1510 | W,H,N = map(int,input().split())
CoordinateList = []
for i in range(N):
x,y,a = map(int, input().split())
CoordinateList.append([x,y,a])
# raw White & Black
AllArea = []
for numline in range(H):
rawWhite = []
rawBlack = []
for numraw in range(W):
rawWhite.append("W")
rawBlack.append("B")
AllArea.append(rawWhite)
# coloring from white to Black
for n in range(N):
if CoordinateList[n][2] == 1:
for i in range(H):
del AllArea[i][:(CoordinateList[n][0])]
for numX in range(CoordinateList[n][0]):
AllArea[i].insert(0,"B")
elif CoordinateList[n][2] == 2:
for i in range(H):
del AllArea[i][(CoordinateList[n][0]):]
for numX in range(CoordinateList[n][0]):
AllArea[i].append("B")
elif CoordinateList[n][2] == 3:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
print(0)
exit()
else:
del AllArea[changeY:]
for changeRaw in range(changeY):
AllArea.append(rawBlack)
elif CoordinateList[n][2] == 4:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
pass
else:
del AllArea[:changeY]
for changeRaw in range(changeY):
AllArea.insert(0,rawBlack)
# counting
AreaWhite = 0
for i in range(H):
AreaWhite += AllArea[i].count("W")
print(AreaWhite)
|
s836726830 | p03944 | u578049848 | 1571345122 | Python | Python (3.4.3) | py | Runtime Error | 139 | 3316 | 1543 | W,H,N = map(int,input().split())
CoordinateList = []
for i in range(N):
x,y,a = map(int, input().split())
CoordinateList.append([x,y,a])
# raw White & Black
AllArea = []
for numline in range(H):
rawWhite = []
rawBlack = []
for numraw in range(W):
rawWhite.append("W")
rawBlack.append("B")
AllArea.append(rawWhite)
# coloring from white to Black
for n in range(N):
if CoordinateList[n][2] == 1:
for i in range(H):
del AllArea[i][:(CoordinateList[n][0])]
for numX in range(CoordinateList[n][0]):
AllArea[i].insert(0,"B")
elif CoordinateList[n][2] == 2:
for i in range(H):
del AllArea[i][(CoordinateList[n][0]):]
for numX in range(CoordinateList[n][0]):
AllArea[i].append("B")
elif CoordinateList[n][2] == 3:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
print(0)
exit()
else:
del AllArea[changeY:]
for changeRaw in range(changeY):
AllArea.append(rawBlack)
elif CoordinateList[n][2] == 4:
changeY = H - int(CoordinateList[n][1])
if changeY == 0:
pass
else:
del AllArea[:changeY]
print(range(changeY))
for changeRaw in range(changeY):
AllArea.insert(0,rawBlack)
# counting
AreaWhite = 0
for i in range(H):
AreaWhite += AllArea[i].count("W")
print(AreaWhite)
|
s570465468 | p03944 | u578049848 | 1571342643 | Python | Python (3.4.3) | py | Runtime Error | 140 | 3316 | 1431 | W,H,N = map(int,input().split())
CoordinateList = []
for i in range(N):
x,y,a = map(int, input().split())
CoordinateList.append([x,y,a])
# raw White & Black
AllArea = []
for numline in range(H):
rawWhite = []
rawBlack = []
for numraw in range(W):
rawWhite.append("W")
rawBlack.append("B")
AllArea.append(rawWhite)
# coloring from white to Black
for n in range(N):
if CoordinateList[n][2] == 1:
for i in range(H):
del AllArea[i][:(CoordinateList[n][0])]
for numX in range(CoordinateList[n][0]):
AllArea[i].insert(0,"B")
#print(AllArea)
elif CoordinateList[n][2] == 2:
for i in range(H):
del AllArea[i][(CoordinateList[n][0]):]
for numX in range(CoordinateList[n][0]):
AllArea[i].append("B")
#print(AllArea)
elif CoordinateList[n][2] == 3:
changeY = H - int(CoordinateList[n][1])
del AllArea[changeY:]
for changeRaw in range(changeY):
AllArea.append(rawBlack)
#print(AllArea)
elif CoordinateList[n][2] == 4:
changeY = H - int(CoordinateList[n][1])
del AllArea[:changeY]
for changeRaw in range(changeY):
AllArea.insert(0,rawBlack)
#print(AllArea)
# counting
AreaWhite = 0
for i in range(H):
AreaWhite += AllArea[i].count("W")
#print(AllArea)
print(AreaWhite)
|
s926179772 | p03944 | u578049848 | 1571341618 | Python | Python (3.4.3) | py | Runtime Error | 139 | 3316 | 1431 | W,H,N = map(int,input().split())
CoordinateList = []
for i in range(N):
x,y,a = map(int, input().split())
CoordinateList.append([x,y,a])
# raw White & Black
AllArea = []
for numline in range(H):
rawWhite = []
rawBlack = []
for numraw in range(W):
rawWhite.append("W")
rawBlack.append("B")
AllArea.append(rawWhite)
# coloring from white to Black
for n in range(N):
if CoordinateList[n][2] == 1:
for i in range(H):
del AllArea[i][:(CoordinateList[n][0])]
for numX in range(CoordinateList[n][0]):
AllArea[i].insert(0,"B")
#print(AllArea)
elif CoordinateList[n][2] == 2:
for i in range(H):
del AllArea[i][(CoordinateList[n][0]):]
for numX in range(CoordinateList[n][0]):
AllArea[i].append("B")
#print(AllArea)
elif CoordinateList[n][2] == 3:
changeY = H - int(CoordinateList[n][1])
del AllArea[changeY:]
for changeRaw in range(changeY):
AllArea.append(rawBlack)
#print(AllArea)
elif CoordinateList[n][2] == 4:
changeY = H - int(CoordinateList[n][1])
del AllArea[:changeY]
for changeRaw in range(changeY):
AllArea.insert(0,rawBlack)
#print(AllArea)
# counting
AreaWhite = 0
for i in range(H):
AreaWhite += AllArea[i].count("W")
#print(AllArea)
print(AreaWhite)
|
s600685149 | p03944 | u578049848 | 1571341155 | Python | Python (3.4.3) | py | Runtime Error | 139 | 3316 | 1449 | W,H,N = map(int,input().split())
CoordinateList = []
for i in range(N):
x,y,a = map(int, input().split())
CoordinateList.append([x,y,a])
# raw White & Black
AllArea = []
for numline in range(H):
rawWhite = []
rawBlack = []
for numraw in range(W):
rawWhite.append("White")
rawBlack.append("Black")
AllArea.append(rawWhite)
# coloring from white to Black
for n in range(N):
if CoordinateList[n][2] == 1:
for i in range(H):
del AllArea[i][:(CoordinateList[n][0])]
for numX in range(CoordinateList[n][0]):
AllArea[i].insert(0,"Black")
#print(AllArea)
elif CoordinateList[n][2] == 2:
for i in range(H):
del AllArea[i][(CoordinateList[n][0]):]
for numX in range(CoordinateList[n][0]):
AllArea[i].append("Black")
#print(AllArea)
elif CoordinateList[n][2] == 3:
changeY = H - int(CoordinateList[n][1])
del AllArea[changeY:]
for changeRaw in range(changeY):
AllArea.append(rawBlack)
#print(AllArea)
elif CoordinateList[n][2] == 4:
changeY = H - int(CoordinateList[n][1])
del AllArea[:changeY]
for changeRaw in range(changeY):
AllArea.insert(0,rawBlack)
#print(AllArea)
# counting
AreaWhite = 0
for i in range(H):
AreaWhite += AllArea[i].count("White")
#print(AllArea)
print(AreaWhite) |
s188146331 | p03944 | u271934630 | 1571106847 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 592 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
w, h, n = map(int, input().split())
px = py = 0
points = [[px, py], [w, h]]
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
points[0][0] = max(px, x)
elif a == 2:
points[1][0] = min(w, x)
elif a == 3:
points[0][1] = max(py, y)
elif a == 4:
points[1][1] = min(h, y)
print(max(0, points[1][0]-points[0][0])) * max(0, points[1][1]-points[0][1])
if __name__ == '__main__':
main()
|
s461793528 | p03944 | u457554982 | 1570981242 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 470 | [w,h,n]=list(map(int,input().split()))
risuto=[]
xmin=0
xmax=w
ymin=0
ymax=h
for i in range n:
risuto.append(list(map(int,input().split())))
for i in range n:
if risuto[i][2]==1 and risuto[i][0]>xmin:
xmin=risuto[i][0]
elif risuto[i][2]==2 and risuto[i][0]<xmax:
xmax=risuto[i][0]
elif risuto[i][2]==3 and risuto[i][1]>ymin:
ymin=risuto[i][1]
elif risuto[i][2]==4 and risuto[i][1]<ymax:
ymax=risuto[i][1]
menseki=int((xmax-xmin)*(ymax-ymin))
print(menseki)
|
s224994244 | p03944 | u931489673 | 1570597242 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 427 | W,H,N=map(int,input().split())
X=[w for w in range(W+1)]
Y=[h for h in range(H+1)]
#print(X,Y)
for n in range(N):
w,h,a=map(int,input().split())
if a==1:
X=[x for x in X if x>=w]
elif a==2:
X=[x for x in X if x<=w]
elif a==3:
Y=[y for y in Y if y>=h]
else:
Y=[y for y in Y if y<=h]
#print(X,Y)
#print(max(0,(len(X)-1)*(len(Y)-1)))
print(max(0,(X[-1]-X[0])*(Y[-1]-Y[0])))
|
s368809643 | p03944 | u862757671 | 1570140257 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 378 | w, h, n = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
x = [x_i for x_i in range(w + 1)]
y = [y_i for y_i in range(h + 1)]
for l_e in l:
if l_e[2] == 1:
x = x[l_e[0]:]
elif l_e[2] == 2:
x = x[:l_e[0]]
elif l_e[2] == 3:
y = y[l_e[1]:]
else:
y = y[:l_e[1]]
print((x[-1] - x[0]) * (x[-1] - x[0])) |
s982645742 | p03944 | u066253157 | 1568402842 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 472 | W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]
X = [0, W]
Y = [0, H]
for l in lst:
if l[2] == 1 and X[0] < l[0]:
X[0] = l[0]
elif l[2] == 2 and l[0] < X[1]:
X[1] = l[0]
elif l[2] == 3 and Y[0] < l[1]:
Y[0] = l[1]
elif lst[2] == 4 and l[1] < Y[1]:
Y[1] = l[1]
width = X[1] - X[0] if X[1] - X[0] > 0 else 0
height = Y[1] - Y[0] if Y[1] - Y[0] > 0 else 0
print(width * height) |
s115266413 | p03944 | u066253157 | 1568402745 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 472 | W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]
X = [0, W]
Y = [0, H]
for l in lst:
if l[2] == 1 and X[0] < l[0]:
X[0] = l[0]
elif l[2] == 2 and l[0] < X[1]:
X[1] = l[0]
elif l[2] == 3 and Y[0] < l[1]:
Y[0] = l[1]
elif lst[2] == 4 and l[1] < Y[1]:
Y[1] = l[1]
width = X[1] - X[0]
height = Y[1] - Y[0]
if width > 0 and height > 0:
print(width * height)
else:
print(0) |
s037683417 | p03944 | u066253157 | 1568402668 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 474 | W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]
X = [0, W]
Y = [0, H]
for l in lst:
if l[2] == 1 and X[0] < l[0]:
X[0] = l[0]
elif l[2] == 2 and l[0] < X[1]:
X[1] = l[0]
elif l[2] == 3 and Y[0] < l[1]:
Y[0] = l[1]
elif lst[2] == 4 and l[1] < Y[1]:
Y[1] = l[1]
width = X[1] - X[0]
height = Y[1] - Y[0]
if width >= 0 and height >= 0:
print(width * height)
else:
print(0) |
s745995570 | p03944 | u396495667 | 1568218028 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 492 | h,n = map(int,input().split())
a = [list(map(int,input().split()))for _ in range(n)]
z1 = [0,0]
z2 = [w,h]
for i in range (n):
if a[i][2] == 1 and z1[0] <= a[i][0]:
z1[0] = a[i][0]
elif a[i][2] == 2 and z2[0] >= a[i][0]:
z2[0] = a[i][0]
elif a[i][2] == 3 and z1[1] <= a[i][1] :
z1[1] = a[i][1]
elif a[i][2] == 4 and z2[1] >= a[i][1] :
z2[1] = a[i][1]
if z2[0] > z1[0] and z2[1] > z1[1]:
print((z2[0]-z1[0])*(z2[1]-z1[1]))
else:
print(0) |
s709780163 | p03944 | u799479335 | 1568216304 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 641 | import numpy as np
W,H,N = map(int, input().split())
x_s,y_s,a_s = [],[],[]
for i in range(N):
x,y,a = map(int, input().split())
x_s.append(x)
y_s.append(y)
a_s.append(a)
x_s = np.array(x_s)
y_s = np.array(y_s)
a_s = np.array(a_s)
if (a_s==1).sum()>=1:
x_min = x_s[a_s==1].max()
else:
x_min = 0
if (a_s==2).sum()>=1:
x_max = x_s[a_s==2].min()
else:
x_max = W
if (a_s==3).sum()>=1:
y_min = y_s[a_s==3].max()
else:
y_min = 0
if (a_s==4).sum()>=1:
y_max = y_s[a_s==4].min()
else:
y_max = H
if (x_min>=x_max)|(y_min>=y_max):
ans = 0
else:
ans = (x_max-x_min)*(y_max-y_min)
print(int(ans))
|
s338394511 | p03944 | u799479335 | 1568215807 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 462 | import numpy as np
W,H,N = map(int, input().split())
x_s,y_s,a_s = [],[],[]
for i in range(N):
x,y,a = map(int, input().split())
x_s.append(x)
y_s.append(y)
a_s.append(a)
x_s = np.array(x_s)
y_s = np.array(y_s)
a_s = np.array(a_s)
x_min = x_s[a_s==1].max()
x_max = x_s[a_s==2].min()
y_min = y_s[a_s==3].max()
y_max = y_s[a_s==4].min()
if (x_min>=x_max)|(y_min>=y_max):
ans = 0
else:
ans = (x_max-x_min)*(y_max-y_min)
print(int(ans))
|
s737798824 | p03944 | u625963200 | 1567515121 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 287 | w,h,n=map(int,input().split())
x1,x2,y1,y2=0,w,0,h
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
x1=max(x1,x)
elif a==2:
x2=min(x2,x)
elif a==3:
y1=max(y1,y)
else:
y2=min(y2,y)
s=(x2-x1)*(y4-y3)
if s<0:
print(0)
else:
print(s) |
s351688284 | p03944 | u540491484 | 1567132898 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 569 | w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]
ans=[0,0,w,h]
for i in range(n):
if xya[i][2] == 1:
if xya[i][0] >= ans[0]:
ans[0] = xya[i][0]
elif xya[i][2] == 2:
if xya[i][0] <= ans[2]:
ans[2] = xya[i][0]
elif xya[i][2] == 3:
if xya[i][1] >= ans[1]:
ans[1] = xya[i][1]
elif xya[i][2] == 4:
if xya[i][1] <= ans[3]:
ans[3] = xya[i][1]
print(0 if ans[2]-ans[0] <= 0 || ans[3]-ans[1] <= 0 else (ans[2]-ans[0])*(ans[3]-ans[1]))
|
s833653653 | p03944 | u952022797 | 1566571793 | Python | PyPy3 (2.4.0) | py | Runtime Error | 186 | 39152 | 1240 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def main():
W,H,N = inputMap()
x_hidari = 0
x_migi = W
y_shita = 0
y_ue = H
for i in range(N):
x,y,a = inputMap()
if a == 1:
if x_hidari < x:
x_hidari = x
elif a == 2:
if x_migi > x:
x_migi = x
elif a == 3:
if y_shita < y:
y_shita = y
else:
if y_ue > y:
y_ue = y
#print("{} {} {} {}".format(x_hidari,x_migi,y_ue,y_shita))
xxx = x_migi-x_hidari
yyy = y_ue-y_shita
if xxx < 0 or yyy < 0:
print(0)
sts.exit()
print(xxx * yyy)
if __name__ == "__main__":
main()
|
s958812634 | p03944 | u830054172 | 1566265591 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 382 | w, h, n = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
x1 = 0
x2 = w
y1 = 0
y2 = h
for i in range(n):
if a[i][2] == 1:
x1 = max(x1, a[i][0])
elif a[i][2] == 2:
x2 = min(x2, a[i][0])
elif a[i][2] == 3:
y1 = max(y1,a[i][1])
elif a[i][2] == 4:
y2 = min(y2, a[i][1])
print(max(0,(x2-x1)*(y2-y1))) |
s940398039 | p03944 | u538956308 | 1564866347 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 373 | P= list(map(int,input().split()))
W = P[0]
H = P[1]
N = P[2]
A = []
B = []
C = []
D = []
for i in range(N):
x,y,a = map(int,input().split())
if a == 1:
A.append(x)
elif a == 2:
x = 10-x
B.append(x)
elif a == 3:
C.append(y)
else:
y = 10-y
D.append(y)
a = max(A)
b = min(B)
c = max(C)
d = min(D)
w = W - (a+b)
h = H - (c+d)
print(w*h) |
s107212208 | p03944 | u538956308 | 1564782133 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 371 | P= list(map(int,input.split()))
W = P[0]
H = P[1]
N = P[2]
A = []
B = []
C = []
D = []
for i in range(N):
x,y,a = map(int,input().split())
if a == 1:
A.append(x)
elif a == 2:
x = 10-x
B.append(x)
elif a == 3:
C.append(y)
else:
y = 10-y
D.append(y)
a = max(A)
b = min(B)
c = max(C)
d = min(D)
w = W - (a+b)
h = H - (c+d)
print(w*h) |
s050680949 | p03944 | u538956308 | 1564780631 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 345 | W,H,N = map(int,input.split())
A = []
B = []
C = []
D = []
for i in range(N):
x,y,a = map(int,input().split())
if a == 1:
A.append(x)
elif a == 2:
x = 10-x
B.append(x)
elif a == 3:
C.append(y)
else:
y = 10-y
D.append(y)
a = max(A)
b = min(B)
c = max(C)
d = min(D)
w = W - (a+b)
h = H - (c+d)
print(w*h)
|
s255343379 | p03944 | u811000506 | 1564626197 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 528 | W,H,N = map(int,input().split())
bo = [[0]*W]*H
li = [list(map(int,input().split())) for i in range(N)]
for i in range(N):
if li[i][2] == 1:
for j in range(li[i][0]):
bo[i][j] = 1
elif li[i][2] == 2:
for j in range(li[i][0],W,1):
bo[i][j] = 1
elif li[i][2] == 3:
for j in range(li[i][1]):
bo[j] = [1]*W
else:
for j in range(H-1,li[i][1]-1,-1):
bo[j] = [1]*W
sum = 0
for i in range(H):
sum += bo[i][:].count(1)
print((W*H)-sum) |
s223522012 | p03944 | u196697332 | 1564007109 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1416 | import sys
W, H, N = map(int, input().split())
area = W * H
right, left, bottom, top = W, 0, 0, H
for n in range(N):
tmp_w, tmp_h, a = map(int, input().split())
if left <= tmp_w <= right and bottom <= tmp_h <= top:
if a == 1:
tmp_area = (tmp_w - left) * (top - bottom)
area -= tmp_area
left = tmp_w
if a == 2:
tmp_area = (right - tmp_w) * (top - bottom)
area -= tmp_area
right = tmp_w
if a == 3:
tmp_area = (tmp_h - bottom) * (right - left)
area -= tmp_area
bottom = tmp_h
if a == 4:
tmp_area = (top - tmp_h) * (right - left)
area -= tmp_area
top = tmp_h
else:
if a == 1:
if tmp_w >= right:
tmp_area = tmp_w * H
else:
tmp_area = 0
if a == 2:
if tmp_w <= left:
tmp_area = (W - tmp_w) * H
else:
tmp_area = 0
if a == 3:
if tmp_h >= top:
tmp_area = tmp_h * W
else:
tmp_area = 0
if a == 4:
if tmp_h <= bottom:
tmp_area = (H - tmp_h) * W
esle:
tmp_area = 0
area -= tmp_area
if area < 0:
print(0)
sys.exit()
print(area)
|
s129121812 | p03944 | u948524308 | 1563762293 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 849 | W,H,N = map(int,input().split())
x=[]
y=[]
a=[]
A1=[]
A2=[]
A3=[]
A4=[]
for n in range(N):
i,j,k = map(int,input().split())
x.append(i)
y.append(j)
a.append(k)
a1,a2,a3,a4 = 0,0,0,0
for n in range(N):
if a[n] == 1:
A1.append(x[n])
a1 = a1 + 1
elif a[n] == 2:
A2.append(x[n])
a2 = a2 + 1
elif a[n] == 3:
A3.append(y[n])
a3 = a3 + 1
else:
A4.append(y[n])
a4 = a4 + 1
if a1 == 0 and a2 == 0:
width = W
elif a1 == 0:
width = min(A2)
elif a2 == 0:
width = W - max(A1)
else:
width = min(A2) - max(A1)
if width <0:
width = 0
if a3 == 0 and a4 == 0:
height == H
elif a3 == 0:
height =min(A4)
elif a4 ==0:
height = H-max(A3)
else:
height =min(A4) - max(A3)
if width <0:
width = 0
print(height*width)
|
s560708804 | p03944 | u423585790 | 1563565998 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38256 | 1723 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')
#A
def A():
a, b, c = LI()
if a == b + c:
print("Yes")
elif b == a + c:
print("Yes")
elif c == a + b:
print("Yes")
else:
print("No")
return
#B
def B():
W, H, n = LI()
wh = [[0, W], [0, H]]
for _ in range(n):
x, y, a = LI()
wha = wh[a > 2]
x = y if a > 2 else x
wha[0] = max(x, wha[0]) * (a % 2) or wha[0]
wha[1] = wha[1] * (a % 2) or min(x, wha[1])
if wha[0] = wha[1]:
print(0)
return
print(max(0, (wh[0][1] - wh[0][0]) * (wh[1][1] - wh[1][0])))
return
#C
def C():
return
#D
def D():
return
#Solve
if __name__ == '__main__':
B()
|
s787105445 | p03944 | u292735000 | 1562788037 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 541 | w, h, n = map(int, input().split())
coord_list = [list(map(int, input().split())) for i in range(n)]
x_list = [i for i in range(w + 1)]
y_list = [i for i in range(h + 1)]
for a in coord_list:
if a[-1] == 1:
x_list = [i for i in x_list if i >= a[0]]
elif a[-1] == 2:
x_list = [i for i in x_list if i <= a[0]]
elif a[-1] == 3:
y_list = [i for i in y_list if i >= a[1]]
elif a[-1] == 4:
y_list = [i for i in y_list if i <= a[1]]
print((max(x_list) - min(x_list)) * (max(y_list) - min(y_list))) |
s737344970 | p03944 | u314050667 | 1562600861 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 364 | w,h,n=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
xmin,ymin=0
xmax=w
ymax=h
for i in range(n):
if a[i][2]==1:
xmin=max([xmin,a[i][0]])
elif a[i][2]==2:
xmax=min([xmax,a[i][0]])
elif a[i][2]==3:
ymin=max([ymin,a[i][1]])
else:
ymax=min([ymax,a[i][1]])
ptint((xmax-xmin)*(ymax-ymin)) |
s176107251 | p03944 | u463655976 | 1562535237 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 326 | W, H, N = map(int, input().split())
left, bottom = 0, 0
right, top = W, H
for x, y, a in map(int, input().split()):
if a == 1:
left = max(left, x)
elif a == 2:
right = min(right, x)
elif a == 3:
bottom = max(bottom, y)
else:
top = min(top, y)
print(max(0, right-left) * max(0, top-bottom))
|
s886195371 | p03944 | u539517139 | 1561952082 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 305 | w,h,n=map(int,input().split())
o=[0,0]
c=[w,h]
for _ in range(n):
x,y,a=map(int,input().split())
if a==1:
o[0]=x if o[0]<x
elif a==2:
c[0]=x if c[0]>x
elif a==3:
o[1]=y if o[1]<y
else:
c[1]=y if c[1]>y
if o[0]<c[0] and o[1]<c[1]:
print((c[0]-o[0])*(c[1]-o[1]))
else:
print(0) |
s559617763 | p03944 | u373499377 | 1561831686 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 1764 | def main():
x_max, y_max, n = map(int, input().split())
x_min, y_min = 0, 0
for n in range(n)def main():
x_max, y_max, n = map(int, input().split())
x_min, y_min = 0, 0
for n in range(n):
x, y, a = map(int, input().split())
if a == 1:
x_min = max(x_min, x)
elif a == 2:
x_max = min(x_max, x)
elif a == 3:
y_min = max(y_min, y)
elif a == 4:
y_max = min(y_max, y)
print(max(0, x_max - x_min) * max(0, y_max - y_min))
# if (a == 1) and (x > x_min):
# x_min = x
# elif (a == 2) and (x < x_max):
# x_max = x
# elif (a == 3) and (y > y_min):
# y_min = y
# elif (a == 4) and (y < y_max):
# y_max = y
#
# if (x_max <= x_min) or (y_max <= y_min):
# print(0)
# return
# print((x_max - x_min) * (y_max - y_min))
if __name__ == "__main__":
main()
:
x, y, a = map(int, input().split())
if a == 1:
x_min = max(x_min, x)
elif a == 2:
x_max = min(x_max, x)
elif a == 3:
y_min = max(y_max, y)
elif a == 4:
y_max = min(y_max, y)
print(max(0, x_max - x_min) * max(0, y_max - y_min))
# if (a == 1) and (x > x_min):
# x_min = x
# elif (a == 2) and (x < x_max):
# x_max = x
# elif (a == 3) and (y > y_min):
# y_min = y
# elif (a == 4) and (y < y_max):
# y_max = y
#
# if (x_max <= x_min) or (y_max <= y_min):
# print(0)
# return
# print((x_max - x_min) * (y_max - y_min))
if __name__ == "__main__":
main()
|
s006645456 | p03944 | u181668771 | 1560797887 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3068 | 366 | import sys
W, H, N = map(int, input().split())
l = d = 0
u = H
r = W
for i in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
l = max(x, l)
if a == 2:
r = min(x, r)
if a == 3:
d = max(y, d)
if a == 4:
u = min(y, u)
ans = (r - l) * (u - d)
if r - l < 0 or u - d < 0
ans = 0
print(max(ans, 0))
|
s136721039 | p03944 | u245870380 | 1560625602 | Python | Python (3.4.3) | py | Runtime Error | 73 | 3188 | 688 | W, H, N = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(N)]
area = [[0]*W for _ in range(H)]
cnt = 0
for i in x:
if i[2] == 1:
for j in range(H):
for k in range(i[0]):
area[j][k] = 1
elif i[2] == 2:
for j in range(H):
for k in range(i[0],H):
area[j][k] = 1
elif i[2] == 3:
for j in range(i[1]):
for k in range(W):
area[j][k] = 1
else:
for j in range(i[1],H):
for k in range(W):
area[j][k] = 1
for i in range(H):
for j in range(W):
if area[i][j] == 0:
cnt += 1
print(cnt) |
s582660852 | p03944 | u245870380 | 1560625574 | Python | Python (3.4.3) | py | Runtime Error | 77 | 3188 | 701 | W, H, N = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(N)]
area = [[0]*W for _ in range(H)]
cnt = 0
for i in x:
if i[2] == 1:
for j in range(H):
for k in range(i[0]):
area[j][k] = 1
elif i[2] == 2:
for j in range(H):
for k in range(i[0],H):
area[j][k] = 1
elif i[2] == 3:
for j in range(i[1]):
for k in range(W):
area[j][k] = 1
else:
for j in range(i[1],H):
for k in range(W):
area[j][k] = 1
print(area)
for i in range(H):
for j in range(W):
if area[i][j] == 0:
cnt += 1
print(cnt) |
s660523243 | p03944 | u454069568 | 1560448674 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2696 | 766 | # -*- coding: utf-8 -*-
W, H, N = map(int, raw_input().split())
x_arr = [0] * N
y_arr = [0] * N
a_arr = [0] * N
for idx in range(0, N):
x_arr[idx], y_arr[idx], a_arr[idx] = map(int, raw_input().split())
x_zero = 0
x_inf = W
y_zero = 0
y_inf = H
a_max_min = [x_zero, x_inf, y_zero, y_inf]
for idx in range(0, N):
a_tmp = a_arr[idx]
if a_tmp == 1:
a_max_min[0] = max(a_max_min[0], x_arr[idx])
elif a_tmp == 2:
a_max_min[1] = min(a_max_min[1], x_arr[idx])
elif a_tmp == 3:
a_max_min[2] = max(a_max_min[2], y_arr[idx])
elif a_tmp == 4:
a_max_min[3] = min(a_max_min[3], y_arr[idx])
answer = min(W*H, max(0, ((a_max_min[1] - a_max_min[0]) * (a_max_min[3] - a_max_min[2])))
print(answer)
# https://atcoder.jp/contests/abc047/tasks/abc047_b |
s888857661 | p03944 | u223646582 | 1560446703 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 298 | xmax,ymax,N=map(int,input().split())
xmin=0
ymin=0
for i in range(N+1):
x,y,a=map(int,input().split())
if a==1:
xmin=max(xmin,x)
elif a==2:
xmax=min(xmax,x)
elif a==3:
ymin=max(ymin,y)
else:
ymax=min(ymax,y)
print(max(0,(xmax-xmin)*(ymax-ymin))) |
s901441095 | p03944 | u063550903 | 1559151187 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 323 | XYA = [[int(i) for i in input().split()] for j in range(N)]
white_l = 0
white_un = 0
white_r = W
white_up = H
for x,y,a in XYA:
if a == 1:
white_l = x
elif a == 2:
white_r = x
elif a == 3:
white_un = y
else:
white_up = y
print(max(0,(white_up-white_un)*(white_r-white_l))) |
s135220574 | p03944 | u844005364 | 1559139580 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 340 | w, h, n = map(int, input().split())
x1, x2, y3, y4 = [], [], [], []
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
x1.append(x)
elif a == 2:
x2.append(x)
elif a == 3:
y3.append(y)
else:
y4.append(y)
print(max(min(w, min(x2)) - max(max(x1), 0), 0) * max(min(h, min(y4)) - max(max(y3), 0), 0))
|
s115744357 | p03944 | u204800924 | 1558152930 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 433 | W, H, N = map(int, input().split())
xya = []
for _ in range(N):
xya.append( list( map(int, input().split() ) ) )
W_0 = H_0 = 0
for i in range(N):
if xya[i][2] == 1
W_0 = xya[i][0]
elif xya[i][2] == 2:
W = xya[i][0]
elif xya[i][2] == 3:
H_0 = xya[i][1]
elif xya[i][2] == 4:
H = xya[i][1]
if (W - W_0 == 0) or (H - H_0 == 0):
break
print(max([(W - W_0)*(H - H_0), 0])) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.