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
s452509407
p03944
u204800924
1558152847
Python
Python (3.4.3)
py
Runtime Error
17
2940
443
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] else if xya[i][2] == 2: W = xya[i][0] else if xya[i][2] == 3: H_0 = xya[i][1] else if 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]))
s662008931
p03944
u059436995
1557926649
Python
Python (3.4.3)
py
Runtime Error
17
3064
299
w,h,n = map(int,input().split()) cl = np.zeros((w, h) , dtype = int) for i in range(n): x, y, a, = map(int,input().split()) if a ==1: cl[:x, :] = 1 if a ==2: cl[x:, :] = 1 if a ==3: cl[:, :y] = 1 if a ==4: cl[:, y:] = 1 print(w * h - np.sum(cl))
s249739551
p03944
u220345792
1557878112
Python
Python (3.4.3)
py
Runtime Error
18
3064
274
W, H, N = map(int, input().split()) X, Y = 0, 0 for i in range(N+1): x, y, a = map(int, input().split()) if a == 1: X = max(X, x) elif a == 2: W = min(W, x) elif a == 3: Y = max(Y, y) elif a == 4: H = min(H, y) ans = max(0, (W-X)*(H-Y)) print(ans)
s058018957
p03944
u416758623
1557765585
Python
Python (3.4.3)
py
Runtime Error
17
2940
243
w,h,n = map(int,input().split()))) for i in range(n): a=list(map(int,input().split())))) if a[-1]==1: w-=a[0] elif a[-1]==2: w = a[0] elif a[-1]==3: h-=a[1] elif a[-1]==4: h = a[1] print(h*w)
s770935463
p03944
u677440371
1557551408
Python
Python (3.4.3)
py
Runtime Error
18
3064
594
W, H, N = map(int, input().split()) L1 = [] L2 = [] L3 = [] L4 = [] for i in range(N): x, y, a = map(int, input().split()) if a == 1: L1.append(x) if a == 2: L2.append(x) if a == 3: L3.append(y) if a == 4: L4.append(y) if L1 != []: x_min = min(L1) else: x_min = 0 if L2 != []: x_max = min(L2) else: x_max = W if L3 != []: y_min = min(L3) else: y_min = 0 if L4 != []: y_min = min(L4) else: y_min = H x_len = min(0, x_max-x_min) y_len = min(0, y_max-y_min) print(x_len * y_len)
s838150121
p03944
u059262067
1557332493
Python
Python (3.4.3)
py
Runtime Error
17
3064
362
W,H,N = (int(i) for i in input().split()) l = [list(map(int, input().split())) for i in range(N)] x_max = max([i[0] for i in l if i[2] == 1]) x_min = min([i[0] for i in l if i[2] == 2]) y_max = max([i[1] for i in l if i[2] == 3]) y_min = min([i[1] for i in l if i[2] == 4]) x = min(x_max+(W-x_min),W) y = min(y_max+(H-y_min),H) print(W*H - x*H - y*W + x*y)
s412613408
p03944
u059262067
1557272734
Python
Python (3.4.3)
py
Runtime Error
18
3064
337
W,H,N = (int(i) for i in input().split()) l = [list(map(int, input().split())) for i in range(N)] x_min = min([i[0] for i in l if i[2] == 1]) x_max = max([i[0] for i in l if i[2] == 2]) y_min = min([i[1] for i in l if i[2] == 3]) y_max = max([i[1] for i in l if i[2] == 4]) print((W - max(0,x_max-x_min)) * (H - max(0,y_max-y_min)))
s700088148
p03944
u300637346
1557179237
Python
Python (3.4.3)
py
Runtime Error
18
3064
659
w,h,n=map(int,input().split()) record=[] xmin=[] xmax=[] ymin=[] ymax=[] for i in range(n): x,y,a=list(map(int,input().split())) record.append([x,y,a]) for i in range(n): if record[i][2] == 1: xmin.append(record[i][0]) elif record[i][2] == 2: xmax.append(record[i][0]) elif record[i][2] == 3: ymin.append(record[i][1]) else: ymax.append(record[i][1]) if xmax==[]: X=w-max(xmin) elif ymax==[]: X=min(xmax)-0 else: X=min(xmax)-max(xmin) if ymax==[]: Y=h-max(ymin) elif ymin==[]: Y=min(ymax)-0 else: Y=min(ymax)-max(ymin) print(X*Y) if (X > 0 and Y > 0) else print(0)
s667138126
p03944
u300637346
1557178891
Python
Python (3.4.3)
py
Runtime Error
18
3064
652
w,h,n=map(int,input().split()) record=[] xmin=[] xmax=[] ymin=[] ymax=[] for i in range(n): x,y,a=list(map(int,input().split())) record.append([x,y,a]) for i in range(n): if record[i][2] == 1: xmin.append(record[i][0]) elif record[i][2] == 2: xmax.append(record[i][0]) elif record[i][2] == 3: ymin.append(record[i][1]) else: ymax.append(record[i][1]) if xmax==[]: X=w-max(xmin) elif ymax==[]: X=min(xmax)-0 else: X=min(xmax)-max(xmin) if ymax==[]: Y=h-max(ymin) elif ymin==[]: Y=min(ymax)-0 else: Y=min(ymax)-max(ymin) print(X*Y) if (X > 0 and Y > 0) else print(0)
s848084538
p03944
u300637346
1557178552
Python
Python (3.4.3)
py
Runtime Error
19
3064
498
w,h,n=map(int,input().split()) record=[] xmin=[] xmax=[] ymin=[] ymax=[] for i in range(n): x,y,a=list(map(int,input().split())) record.append([x,y,a]) for i in range(n): if record[i][2] == 1: xmin.append(record[i][0]) elif record[i][2] == 2: xmax.append(record[i][0]) elif record[i][2] == 3: ymin.append(record[i][1]) else: ymax.append(record[i][1]) X=min(xmax)-max(xmin) Y=min(ymax)-max(ymin) print(X*Y) if (X > 0 and Y > 0) else print(0)
s869350964
p03944
u166621202
1556915468
Python
Python (3.4.3)
py
Runtime Error
18
3064
352
W,H,N=map(int,input().split()) xya=[list(map(int,input().split())) for _ in range(N)] x1 = 0 x2 = W y3 = 0 y4 = H for x,y,a in xya: if a == 1: x1 = max(x1, x) elif a == 2: x2 = min(x2, x) elif a == 3: y3 = max(y3, y) elif a == 4: y4 = min(y4, y) else: if x2 <= x1 or y4 <= y3: print(0) else: print((x2-X1)*(y4-y3))
s398338243
p03944
u767664985
1556609856
Python
Python (3.4.3)
py
Runtime Error
18
3064
427
W, H, N = map(int, input().split()) z = [list(map(int, input().split())) for _ in range(N)] one, two, three, four = [], [], [], [] for i in range(N): if z[i][2] == 1: one.append(z[i][0]) elif z[i][2] == 2: two.append(z[i][0]) elif z[i][2] == 3: three.append(z[i][1]) else: four.append(z[i][1]) w = W - max(one) - (W - min(two)) h = H - max(three) - (H - min(four)) if w > 0 and h > 0: print(w * h) else: print(0)
s588098239
p03944
u457423258
1555274623
Python
Python (3.4.3)
py
Runtime Error
17
3064
389
w,h,n= map(int,input().split()) s=[] for i in range(n): s.append(list(int(input()))) l=0 d=0 for j in range(n): if s[j][2]==1 and s[j][0]>l: l=s[j][0] elif s[j][2]==2 and s[j][0]<w: w=s[j][0] elif s[j][2]==3 and s[j][1]>d: d=s[j][1] elif s[j][2]==4 and s[j][1]<h: h=s[j][1] if h-d>0 and w-l>0: print((h-d)*(w-l)) else: print(0)
s367958764
p03944
u457423258
1555274564
Python
Python (3.4.3)
py
Runtime Error
17
3064
383
w,h,n= map(int,input().split()) s=[] for i in range(n): s.append(int(input())) l=0 d=0 for j in range(n): if s[j][2]==1 and s[j][0]>l: l=s[j][0] elif s[j][2]==2 and s[j][0]<w: w=s[j][0] elif s[j][2]==3 and s[j][1]>d: d=s[j][1] elif s[j][2]==4 and s[j][1]<h: h=s[j][1] if h-d>0 and w-l>0: print((h-d)*(w-l)) else: print(0)
s419969842
p03944
u119983020
1555111451
Python
Python (3.4.3)
py
Runtime Error
17
3064
292
W, H, N = map(int,input().split()) Map = np.ones((H, W),dtype = int) for i in range(N): x,y,a = map(int,input().split()) if a == 1: Map[:,:x] = 0 elif a == 2: Map[:,x:] = 0 elif a == 3: Map[:y,:] = 0 else: Map[y:,:] = 0 print(Map.sum())
s346384879
p03944
u119983020
1555111422
Python
Python (3.4.3)
py
Runtime Error
18
3064
288
W, H, N = map(int,input().split()) Map = np.ones((H, W),dtype = int) for i in range(N): x,y,a = map(int,input().split()) if a == 1: Map[:,:x] = 0 elif a == 2: Map[:,x:] = 0 elif a == 3: Map[:y,:] = 0 else: Map[y:,:] = 0 print(Map.sum())
s345327747
p03944
u451748673
1554933362
Python
Python (3.4.3)
py
Runtime Error
17
3064
267
w,h,n=[int(i) for i in input().split(' ')] x1,x2,y1,y2=0,w,0,h for i in range(n): x,y,a=[int(i) for i in input().split(' ')] if a==1: x1=max(x1,x) if a==2: x2=min(x2,x) if a==3: y1=max(y1,y) if a==4: y2=min(y2,y) print(max(0,(y2-y1)*(x2-x1))
s831262222
p03944
u501643136
1554378581
Python
Python (3.4.3)
py
Runtime Error
17
2940
409
W, H, N = map(int, input().split()) x1 = y1 = a1 = 0 xmin = 0 xmax = W ymin = 0 ymax = H for _ in range(N): x2, y2, a2 = map(int, input().split()) if (a2 = 1): xmin = max(x2, xmin) if (a2 = 2): xmax = min(x2, xmax) if (a2 = 3): ymin = max(y2, ymin) if (a2 = 4): ymax = min(y2, ymax) if (xmax<= xmin or ymax <= ymin): print(0) exit() print((xmax - xmin) * (ymax - ymin))
s137283887
p03944
u514299323
1553990351
Python
Python (3.4.3)
py
Runtime Error
18
3064
433
W,H,N = map(int,input().split(" ")) Lx = [1 for i in range(N)] Ly = [1 for i in range(N)] for i in range(N): xi,yi,ai = map(int,input().split(" ")) if ai ==1: for j in range(xi): Lx[j] = 0 if ai ==2: for j in range(xi,W): Lx[j] = 0 if ai ==3: for j in range(yi): Ly[j] = 0 if ai ==4: for j in range(yi,H): Ly[j] = 0 x = sum(Lx) y = sum(Ly) print(x*y)
s626787966
p03944
u309039873
1553971937
Python
Python (3.4.3)
py
Runtime Error
20
3064
551
W,H,N = map(int,input().split()) limit = {'top': H, 'right': W, 'down': 0, 'left': 0} for _ in range(N): x,y,a = map(int.input().split()) if a == 1: if x > limit['left']: limit['left'] = x elif a == 2: if x < limit['right']: limit['right'] = x elif a == 3: if y > limit['down']: limit['down'] = y elif a == 4: if y < limit['top']: limit['top'] = y height = limit['top'] - limit['down'] width = limit['right'] - limit['left'] if (height > 0) and (width > 0): print(height * width) else: print(0)
s281339347
p03944
u782654209
1553105215
Python
Python (3.4.3)
py
Runtime Error
17
3060
243
W,H,N=map(int,input().split(' ')) info = [[],[],[],[]] #min_x,max_x,min_y,max_y for i in range(N): x,y,a=map(int,input().split(' ')) info[a-1].append((x,y)[(a-1)//2]) print(max(min(info[1])-max(info[0]),0)*max(min(info[3])-max(info[2]),0))
s271475804
p03944
u945418216
1552325034
Python
Python (3.4.3)
py
Runtime Error
19
3060
301
w,h,n = map(int,input().split()) paint = [list(map(int,input().split())) for _ in range(n)] x1,x2,y1,y3 = 0,w,0,h for p in paint: if p[2] == 1: x1 = p[0] elif p[2] == 2: x2 = p[0] elif p[2] == 3: y1 = p[1] else: y2 = p[1] print( max(0,(x2-x1)*(y2-y1)))
s116291548
p03944
u945418216
1552324859
Python
Python (3.4.3)
py
Runtime Error
18
3060
294
w,h,n = map(int,input().split()) paint = [list(map(int,input().split())) for _ in range(n)] x1,x2,y1,y3 = 0,w,0,h for p in paint: if p[2] == 1: x1 = p[0] elif p[2] == 2: x2 = p[0] elif p[2] == 3: y1 = p[1] else: y2 = p[1] print( (x2-x1)*(y2-y1))
s928363090
p03944
u393512980
1552263333
Python
Python (3.4.3)
py
Runtime Error
18
3060
299
W, H, N = map(int, input().split()) x_b, x_u, y_l, y_r = 0, H, 0, W for _ in range(N): x, y, a = map(int, input().split()) if a == 1: x_l = max(x_l, x) elif a == 2: x_r = min(x_r, x) elif a == 3: y_b = max(y_b, y) else: y_u = min(y_u, y) print((x_r - x_l) * (y_u - y_b))
s779690134
p03944
u370331385
1551472500
Python
Python (3.4.3)
py
Runtime Error
18
3064
1031
W,H,N = map(int,input().split()) x1 = 0 x2 = W y1 = 0 y2 = H rectangle_S = W*H black_S = 0 judge = 1 #1:黒部分全部でない,0:黒部分全部 for i in range(N): x,y,a = map(int,input().split()) if(a == 1): if(x < x1): balck_S += 0 x1 = x1 elif(x1 <= x <= x2): black_S += (x-x1)*(y2-y1) x1 = x elif(x2 < x): black_S = W*H break elif(a == 2): if(x < x1): black_S = W*H judge = 0 elif(x1 <= x <= x2): black_S += (x2-x)*(y2-y1) x2 = x elif(x2 < x): black_S += 0 x2 = x2 elif(a == 3): if(y < y1): balck_S += 0 y1 = y1 elif(y1 <= y <= y2): black_S += (y-y1)*(x2-x1) y1 = y elif(y2 < y): black_S = W*H judge = 0 elif(a == 4): if(y < y1): black_S = W*H break elif(y1 <= y <= y2): black_S += (y2-y)*(x2-x1) y2 = y elif(y2 < y): black_S += 0 y2 = y2 #print(x1,x2,y1,y2,black_S) if(judge == 0): print(0) else: print(rectangle_S - black_S)
s781721752
p03944
u370331385
1551472207
Python
Python (3.4.3)
py
Runtime Error
17
3064
937
W,H,N = map(int,input().split()) x1 = 0 x2 = W y1 = 0 y2 = H rectangle_S = W*H black_S = 0 for i in range(N): x,y,a = map(int,input().split()) if(a == 1): if(x < x1): balck_S += 0 x1 = x1 elif(x1 <= x <= x2): black_S += (x-x1)*(y2-y1) x1 = x elif(x2 < x): black_S = W*H break elif(a == 2): if(x < x1): black_S = W*H break elif(x1 <= x <= x2): black_S += (x2-x)*(y2-y1) x2 = x elif(x2 < x): black_S += 0 x2 = x2 elif(a == 3): if(y < y1): balck_S += 0 y1 = y1 elif(y1 <= y <= y2): black_S += (y-y1)*(x2-x1) y1 = y elif(y2 < y): black_S = W*H break elif(a == 4): if(y < y1): black_S = W*H break elif(y1 <= y <= y2): black_S += (y2-y)*(x2-x1) y2 = y elif(y2 < y): black_S += 0 y2 = y2 #print(x1,x2,y1,y2,black_S) print(rectangle_S - black_S)
s369313415
p03944
u392029857
1551470585
Python
Python (3.4.3)
py
Runtime Error
18
3064
393
W, H, N = map(int, input().spllit()) a = [list(map(int, input().split())) for i in range(N)] x, y = 0, 0 for i in a: if (i[2]==1) and (x < i[0]): x = i[0] elif (i[2]==2) and (W > i[0]): W = i[0] elif (i[2]==3) and (y < i[1]): y = i[1] elif (i[2]==4) and (H > i[1]): H = i[1] if ((W-x)<=0) or ((H-y)<=0): print(0) else: print((W-x)*(H-y))
s767880201
p03944
u023229441
1550898307
Python
Python (3.4.3)
py
Runtime Error
64
3064
480
w,h,n=map(int,input().split()) A=[[0 for i in range(w)] for j in range(h)] for i in range(n): a,b,c=map(int,input().split()) if c==1: for i in range(h): for j in range(a): A[i][j]=1 elif c==2: for i in range(h): for j in range(w-a): A[i][j+a]=1 elif c==3: for i in range(b): A[i]=[1 for i in range(w)] else: for i in range(h-b): A[h-i]=[1 for i in range(w)] ans=0 for i in range(h): ans+=A[i].count(0) print(ans)
s159944592
p03944
u604412462
1550536704
Python
Python (3.4.3)
py
Runtime Error
19
3064
354
whn = list (map(int, input().split())) x = 0 y = 0 for i in range(len(whn[2])): xya = list(map(int,input().split())) if xya[2] == 1: x = max(x, xya[0]) elif xya[2] == 2: whn[0] = min(whn[0], xya[0]) elif xya[2] == 3: y = max(y, xya[0]) else: whn[1] = min(whn[1], xya[1]) print((whn[0]-x)*(whn[1]-y))
s893625039
p03944
u127844950
1548977708
Python
Python (3.4.3)
py
Runtime Error
18
2940
11637
#include <iostream> #include <algorithm> #include <cstdio> #include <cmath> #include <vector> #include <queue> #include <functional> #include <numeric> #include <iomanip> #include <stack> #include <string> #include <map> #include <set> using namespace std; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <class T> using VVV = V<VV<T>>; template <class T, class U> using P = pair<T, U>; template <class S, class T, class U> using TUP = tuple<S, T, U>; using ll = long long; using ull = unsigned long long; using dbl = double; using str = string; using vll = V<ll>; using vll2 = VV<ll>; using vll3 = VVV<ll>; using pll = P<ll, ll>; using tll = TUP<ll, ll, ll>; using vpll = V<pll>; using tpll = V<tll>; using vs = V<str>; using vvs = V<vs>; using vd = V<dbl>; using vvd = V<vd>; using qll = queue<ll>; using qpll = queue<pll>; using mapll = map<ll, ll>; using setll = set<ll>; #define int ll #define fst first #define snd second #define PQ priority_queue #define mp make_pair #define mt make_tuple #define pb push_back #define popb pop_back() #define sz size() #define bn begin() #define ed end() #define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++) #define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) #define REP(i, n) FOR(i, 0, (n)-1) #define REP1(i, n) FOR(i, 1, (n)) #define VFOR(i, v) for (auto &(i) : v) #define IOTA(a, n) \ vll(a)((n)); \ iota((a).bn, (a).ed, (0)); #define SORT_ASC(a) sort((a).bn, (a).ed) #define SORT_DESC(a) sort((a).rbegin(), (a).rend()) #define UNIQUE(a) (a).erase(unique((a).bn, (b).ed), (a).ed) #define PREVP(a) prev_permutation((a).bn, (a).ed) #define NEXTP(a) next_permutation((a).bn, (a).ed) #define BINS(a, target) binary_search((a).bn, (a).ed, target) #define LB(a, target) lower_bound((a).bn, (a).ed, target) #define FIND(a, target) find((a).bn, (a).ed, target) #define UB(a, target) upper_bound((a).bn, (a).ed, target) #define CNT(a, target) count((a).bn, (a).ed, target) #define SUM(a) accumulate((a).bn, (a).ed, 0) #define DEBUG(...) \ dal(#__VA_ARGS__); \ dal(__VA_ARGS__) #define Dig2(a, b) ((a) >> (b)&1) #define Dig10(a, b) (ll)(((a) / ((ll)(pow(10.0, (dbl)(b))))) % 10) #define DigN2(a) ((llabs(a) == 0) ? 1 : ((ll)log2((dbl)llabs(a)) + 1)) #define DigN10(a) ((llabs(a) == 0) ? 1 : ((ll)log10((dbl)llabs(a)) + 1)) #define Pow2(a) ((ll)(1) << (a)) #define Pow10(a) ((ll)(pow(10.0, double(a)))) #define LSB(a) ((a) & -(a)) #define llin(n) \ ll n; \ cin >> n; #define strin(n) \ str n; \ cin >> n; #define vin(v) \ VFOR(i, v) { cin >> (i); }; #define vllin(v, N) \ vll(v)((N)); \ vin(v); #define vl4in(v1, v2, N) \ vll(v1)(N), (v2)(N); \ REP(i, N) { cin >> (v1)[i] >> (v2)[i]; }; #define vl6in(v1, v2, v3, N) \ vll(v1)(N), (v2)(N), (v3)(N); \ REP(i, N) { cin >> (v1)[i] >> (v2)[i] >> (v3)[i]; }; #define vsin(v, N) \ vs(v)((N)); \ vin(v); #define min(...) Min(__VA_ARGS__) #define max(...) Max(__VA_ARGS__) #define emin(a, ...) ((a) = Min((a), __VA_ARGS__)) #define emax(a, ...) ((a) = Max((a), __VA_ARGS__)) #define egcd(a, ...) ((a) = gcd((a), __VA_ARGS__)) #define elcm(a, ...) ((a) = lcm((a), __VA_ARGS__)) #define tf(cond, t, f) if(cond){echo(t);}else{echo(f);} #define yn(cond) tf(cond, "yes", "no") #define Yn(cond) tf(cond, "Yes", "No") #define YN(cond) tf(cond, "YES", "NO") static const ll MOD = (ll)1e9 + 7; static const ll INF = (1LL << 62) - 1; // 4.611E+18 static const dbl PI = acos(-1.0); void Input(){}; template <class T, class... Args> void Input(T &t, Args &... args) { cin >> t; Input(args...); } void vInit(ll size) {} template <class T, class... Args> void vInit(ll size, V<T> &v, Args &... args) { v.resize(size); vInit(size, args...); } void vInputNum(ll num) {} template <class T, class... Args> void vInputNum(ll num, V<T> &v, Args &... args) { cin >> v[num]; vInputNum(num, args...); } void vInput(ll size) {} template <class... Args> void vInput(ll size, Args &... args) { vInit(size); REP(i, size) { vInputNum(i, args...); } } template <class S, class T> ostream &operator<<(ostream &o, const P<S, T> &p) { return o << "(" << p.first << ", " << p.second << ")"; } template <class T> ostream &operator<<(ostream &o, const V<T> &v) { if (v.empty()) { return o << "[]"; } else { auto itr = v.bn; o << "[" << *itr; itr++; while (itr != v.ed) { o << ", " << *itr; itr++; } o << "]"; return o; } } template <class T> ostream &operator<<(ostream &o, queue<T> q) { if (q.empty()) { return o << "| |"; } else { while (!q.empty()) { o << "| " << q.front() << " "; q.pop(); } o << "|"; return o; } } template <class S, class T> ostream &operator<<(ostream &o, const map<S, T> &m) { if (m.empty()) { return o << "[]"; } else { auto itr = m.bn; o << "{" << itr->first << ": " << itr->second; itr++; while (itr != m.ed) { o << "} {" << itr->first << ": " << itr->second; itr++; } o << "}"; return o; } } template <class T> ostream &operator<<(ostream &o, const set<T> &s) { if (s.empty()) { return o << "<>"; } else { auto itr = s.bn; o << "<" << *itr; itr++; while (itr != s.ed) { o << ", " << *itr; itr++; } o << ">"; return o; } } void say() {} template <class T> void say(T t) { cout << t; } template <class Head, class... Body> void say(Head h, Body... b) { cout << h; say(b...); } void echo() { cout << "\n"; } template <class... Args> void echo(Args... args) { say(args...); cout << "\n"; } void dbgsay() {} template <class T> void dbgsay(T t) { cout << t; } template <class Head, class... Body> void dbgsay(Head h, Body... b) { cerr << h << " "; dbgsay(b...); } void dbgecho() { cout << "\n"; } template <class... Args> void dbgecho(Args... args) { dbgsay(args...); cerr << "\n"; } void echovv() {} template <class T> void echovv(VV<T> v) { if (v.empty()) { echo(); } else { VFOR(i, v) echo(v); } } template <class T, class... Args> void echovv(VV<T> v, Args... args) { echovv(v); echovv(args...); } template <class Head> Head Min(Head head) { return head; } template <class Head, class... Body> Head Min(Head h, Body... b) { auto t = Min(b...); return (h < t) ? h : t; } template <class Head> Head Max(Head head) { return head; } template <class Head, class... Body> Head Max(Head h, Body... b) { auto t = Max(b...); return (h > t) ? h : t; } ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } template <class... Body> ll gcd(ll h, Body... b) { return gcd(h, gcd(b...)); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } template <class... Body> ll lcm(ll h, Body... b) { return lcm(h, lcm(b...)); } ll Bset(ll a, ll b, ll c) { if (c) a |= b; else a &= ~b; return a; } struct UF { public: ll tsize; ll mode; vll par; vll rank; UF(){}; UF(const UF &uf) {} UF(ll _size, ll _mode = 0) { tsize = _size; mode = _mode; par.assign(tsize, -1); if (!mode) rank.resize(tsize, 0); } ll root(ll x) { return par[x] < 0 ? x : par[x] = root(par[x]); } bool isRoot(ll x) { return root(x) == x; } void unite(ll x, ll y) { x = root(x); y = root(y); if (x == y) return; if (mode) { par[x] += par[y]; par[y] += x; } else { if (rank[x] < rank[y]) { par[y] += par[x]; par[x] = y; } else { par[x] += par[y]; par[y] = x; if (rank[x] == rank[y]) rank[x]++; } } } bool same(ll x, ll y) { return root(x) == root(y); } ll size(ll x) { return -par[root(x)]; } }; class Vertex { public: ll idx; ll param = -1; ll dist = INF; vector<pair<Vertex *, ll> /**/> e; ll size() { return e.size(); } bool operator==(const Vertex *o) { return dist == o->dist; } bool operator!=(const Vertex *o) { return dist != o->dist; } bool operator>(const Vertex *o) { return dist > o->dist; } bool operator<(const Vertex *o) { return dist < o->dist; } bool operator>=(const Vertex *o) { return dist >= o->dist; } bool operator<=(const Vertex *o) { return dist <= o->dist; } }; class Graph { public: vector<Vertex *> V; vll order; typedef tuple<Vertex *, Vertex *, ll> Edge; vector<Edge> E; Graph(ll siz) { REP(i, siz) { auto v = new Vertex(); v->idx = i; V.pb(v); } } static bool comp(const Edge &e1, const Edge &e2) { return get<2>(e1) < get<2>(e2); } Vertex *getVertex(ll idx) { return V[idx]; } void unite(ll from, ll to, ll w = 1, bool digraph = true) { E.push_back(make_tuple(V[from], V[to], w)); V[from]->e.pb(make_pair(V[to], w)); if (!digraph) { E.push_back(make_tuple(V[to], V[from], w)); V[to]->e.pb(make_pair(V[from], w)); } } void dijkstra(ll start) { PQ<Vertex *, vector<Vertex *>, greater<Vertex *> /**/> pq; Vertex *s = getVertex(start); s->dist = 0; pq.push(s); while (!pq.empty()) { Vertex *v = pq.top(); pq.pop(); for (auto &u : v->e) { if (u.first->dist > v->dist + u.second) { u.first->dist = v->dist + u.second; pq.push(u.first); } } } } bool sort(){ for(auto &v : V){ if(v->param==-1 && !sort_visit(v->idx)){ return false; } } reverse(order.bn, order.ed); return true; } bool sort_visit(int v){ Vertex *_v = getVertex(v); _v->param = 1; if(!_v->e.empty()){ for(auto &u: _v->e){ if(u.first->param == 2) continue; if(u.first->param == 1) return false; if(!sort_visit(u.first->idx)) return false; } } order.push_back(v); _v->param = 2; return true; } }; ll isPrime(ll n) { if (n <= 1) return 0; FOR(i, 2, (ll)sqrt(n)) { if (n % i == 0) return 0; } return 1; } ll DigS10(ll n) { ll m = 0; REP(i, DigN10(n)) { m += (ll)((llabs(n) % Pow10(i + 1))) / Pow10(i); } return m; } ll PowMod(ll a, ll b) { ll ans = 1, x = a % MOD; REP(i, DigN2(b)) { if (Dig2(b, i) == 1) { ans = (ans * x) % MOD; } if (i != (DigN2(b) - 1)) { x = (x * x) % MOD; } } return ans; } vll FactMod(1, 1); vll FactModInv(1, 1); ll Mod(ll n) { n %= MOD; n = (n + MOD) % MOD; return n; } ll InvM(ll n) { n = Mod(n); n = PowMod(n, MOD - 2); return n; } void CFactMod(ll n) { if (FactMod.size() <= n) { FOR(i, FactMod.size(), n) { FactMod.pb((FactMod[i - 1] * (i % MOD)) % MOD); } } } void CFactModInv(ll n) { CFactMod(n); if (FactModInv.size() < (n + 1)) { FactModInv.resize(n + 1, -1); } if (FactModInv[n] == -1) { FactModInv[n] = PowMod(FactMod[n], MOD - 2); } for (int i = n - 1; i >= 1; i--) { if (FactModInv[i] != -1) break; FactModInv[i] = ((FactModInv[i + 1] * ((i + 1) % MOD)) % MOD); } } ll CombMod(ll n, ll k) { if (n < 0 || k < 0 || n < k) return 0; if (n + 1 > FactModInv.size()) CFactModInv(n); return ((((FactModInv[k] * FactModInv[n - k]) % MOD) * FactMod[n]) % MOD); } pll factor_sub(ll n, ll m) { ll i = 0; while (n % m == 0) { i++; n /= m; } return mp(i, n); } vpll factrization(ll n) { vpll a; ll c, m; tie(c, m) = factor_sub(n, 2); if (c > 0) a.pb(mp(2, c)); for (ll i = 3; m >= i * i; i += 2) { tie(c, m) = factor_sub(m, i); if (c > 0) a.pb(mp(i, c)); } if (m > 1) a.pb(mp(m, 1)); return a; } signed main() { llin(W); llin(H); llin(N); vl6in(x, y, a, N); ll xmin=0, xmax=W, ymin=0, ymax=H; REP(i, N){ switch (a[i]) { case 1: xmin = Max(xmin, x[i]); break; case 2: xmax = Min(xmax, x[i]); break; case 3: ymin = Max(ymin, y[i]); break; case 4: ymax = Min(ymax, y[i]); break; default: echo("Illegal Operator: ", a[i]); return 1; break; } } echo((ymax-ymin)<= 0||(xmax-xmin)<= 0 ? 0 : (ymax-ymin)*(xmax-xmin)); }
s126265564
p03944
u231647664
1547515176
Python
Python (3.4.3)
py
Runtime Error
19
3064
559
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) if not x1: if not x2: W = W else: W = min(x2) elif not x2: W -= max(x1) elif max(x1) >= min(x2): W = 0 else: W = min(x2) - max(x1) if not y3: if not y4: H = H else: H = min(y4) elif not y4: H -= max(y3) elif max(y3) >= min(y4): H = 0 else: H = min(h2) - max(h1) print(W*H)
s654974947
p03944
u231647664
1547514942
Python
Python (3.4.3)
py
Runtime Error
18
3064
540
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) if not x1: if not x2: W = W else: W = min(x2) elif not x2: W -= max(x1) elif max(x1) >= min(x2): W = 0 else: W = w2 - w1 if not y3: if not y4: H = H else: H = min(y4) elif not y4: H -= max(y3) elif max(y3) >= min(y4): H = 0 else: H = h2 - h1 print(W*H)
s880615979
p03944
u777923818
1546390564
Python
Python (3.4.3)
py
Runtime Error
18
3064
321
def inpl(): return list(map(int, input().split())) W, H, N = inpl() l, r, d, u = 0, W, 0, H for _ in range(N): x, y, a = inpl() if a == 0: l = max(l, a) elif a == 1: r = min(r, a) elif a == 2: d = max(d, a) else: assert a == 3 u = min(u, a) print((r-l)*(u-d))
s063865251
p03944
u391540332
1545286828
Python
Python (3.4.3)
py
Runtime Error
18
3064
41
W, H, N = sprit(input()) print(W, H, N)
s945143953
p03944
u615615456
1544913265
Python
Python (2.7.6)
py
Runtime Error
11
2568
176
a,b = map(int,raw_input().split()) r=0 s=t=u=v=0 for i in range(b-a): s = a+i%10 t = a+i/ 10000%10 u = a+i / 10 % 10 v = a+i /1000% 10 if s==t and u == v: r +=1 print r
s403044395
p03944
u557437077
1544856135
Python
Python (3.4.3)
py
Runtime Error
25
3188
767
w, h, n = [int(i) for i in input().split()] table = [[0 for _ in range(w)] for _ in range(h)] for _ in range(n): x, y, a = [int(i) for i in input().split()] if a == 1: table[0][0] += 1 if x < w: table[0][x] -= 1 elif a == 2: table[0][x] += 1 elif a == 3: table[0][0] += 1 if y < h: table[y][0] -= 1 elif a == 4: table[y][0] += 1 for i in range(len(table)): for j in range(1, len(table[i])): table[i][j] += table[i][j-1] for i in range(1, len(table)): for j in range(len(table[i])): table[i][j] += table[i-1][j] count = 0 for i in range(len(table)): for j in range(len(table[i])): if table[i][j] == 0: count += 1 print(count)
s820536185
p03944
u557437077
1544855282
Python
Python (3.4.3)
py
Runtime Error
25
3188
723
w, h, n = [int(i) for i in input().split()] table = [[0 for _ in range(w)] for _ in range(h)] for _ in range(n): x, y, a = [int(i) for i in input().split()] if a == 1: table[0][0] += 1 table[0][x] -= 1 elif a == 2: table[0][x] += 1 elif a == 3: table[0][0] += 1 table[y][0] -= 1 elif a == 4: table[y][0] += 1 for i in range(len(table)): for j in range(1, len(table[i])): table[i][j] += table[i][j-1] for i in range(1, len(table)): for j in range(len(table[i])): table[i][j] += table[i-1][j] count = 0 for i in range(len(table)): for j in range(len(table[i])): if table[i][j] == 0: count += 1 print(count)
s975491010
p03944
u539402331
1543179697
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38256
337
w, h, n = map( int, input().split()) l = 0,r = w,d = 0,u = h for _ in range(n): x, y, a = map( int, input().split()) if a == 1: l = max(l,x) elif a == 2: r = min(r,x) elif a == 3: d = max(d,y) else: u = min(u,y) if r-l <= 0 or u-d <= 0: print(0) else: print(max(0,(r-l)*(u-d)))
s605494244
p03944
u001024152
1542213755
Python
Python (3.4.3)
py
Runtime Error
17
3064
506
W,H,N = 5,4,3 s = set([]) for h in range(H): for w in range(W): s.add((w+0.5, h+0.5)) # print(s) for _ in range(N): x,y,a = map(int, input().split()) rm = set([]) if a==1: for si in s: if si[0]<x: rm.add(si) if a==2: for si in s: if si[0]>x: rm.add(si) if a==3: for si in s: if si[1]<y: rm.add(si) if a==4: for si in s: if si[1]>y: rm.add(si) s = s - rm print(len(s))
s550146708
p03944
u063052907
1542161153
Python
Python (3.4.3)
py
Runtime Error
18
3064
688
# coding: utf-8 W, H, N = map(int, input().split()) min_x, max_x = 0, W min_y, max_y = 0, H for i in range(N): x, y, a = map(int, input().split()) if a == 1: if max_x <= x: min_x, max_x = 0, 0 elif min_x <= x: min_x = x elif a == 2: if min_x >= x: min_x, max_x = 0, 0 elif x <= max_x: max_x = x elif a == 3: if max_y <= y: min_y, max_y = 0, 0 elif min_y <= y: min_y = y else: if y <= min_y: min_y, max_y = 0, 0 elif y <= max_y: max_y = T diff_x = max_x - min_x diff_y = max_y - min_y print(diff_x * diff_y)
s376832771
p03944
u365375535
1539472110
Python
Python (3.4.3)
py
Runtime Error
17
3064
669
W, H, N = map(int, input().split()) a_list =[] for i in range(N): a_list.append(list(map(int, input().split()))) a1_list = [i[0] for i in a_list if i[2] == 1 ] a2_list = [i[0] for i in a_list if i[2] == 2 ] a3_list = [i[1] for i in a_list if i[2] == 3 ] a4_list = [i[1] for i in a_list if i[2] == 4 ] if a1_list == []: a1_max = 0 else: a1_max = max(a1_list) if a2_list == []: a2_min = W else: a2_min = min(a2_list) if a3_list ==[]: a3_max = 0 else: a3_max = max(a3_list) if a4_list == []: a4_min = H else: a4_min = min(a4_list) S = (a2_min - a1_max)*(a4_min - a3_max) if (a2_min - a1_max) >= 0 and (a4_min - a3_max) >= 0): print(S) else: print(0)
s628804805
p03944
u344545933
1538686560
Python
Python (3.4.3)
py
Runtime Error
17
2940
649
#include<bits/stdc++.h> #include <algorithm> using namespace std; int main(void){ int W, H, N; cin>>W>>H>>N; vector<int> x_min(1,0), x_max(1,W), y_min(1,0), y_max(1,H); int i,j; int tmp[3]; for(i=0;i<N;i++){ cin>>tmp[0]>>tmp[1]>>tmp[2]; if(tmp[2]==1) x_min.push_back(tmp[0]); if(tmp[2]==2) x_max.push_back(tmp[0]); if(tmp[2]==3) y_min.push_back(tmp[1]); if(tmp[2]==4) y_max.push_back(tmp[1]); } sort(x_min.begin(),x_min.end()); sort(x_max.begin(),x_max.end()); sort(y_min.begin(),y_min.end()); sort(y_max.begin(),y_max.end()); cout<<max(0,((x_max.front()-x_min.back())*(y_max.front()-y_min.back()))); }
s122256510
p03944
u466478199
1537579582
Python
Python (3.4.3)
py
Runtime Error
17
3064
339
w,h,n=map(int,input().split()) xa=[] xb=[] ya=[] yb=[] for i in range(n): x1,y1,a1=map(int,input().split()) if a1==1: xa.append(x1) elif a1==2: xb.append(x1) elif a1==3: ya.append(y1) elif a1==4: yb.append(y1) if min(xb)<=max(xa) or min(yb)<=max(ya): print(0) else: print((min(xb)-max(xa))*(min(yb)-max(ya)))
s780633342
p03944
u466478199
1537579502
Python
Python (3.4.3)
py
Runtime Error
17
3064
339
w,h,n=map(int,input().split()) xa=[] xb=[] ya=[] yb=[] for i in range(n): x1,y1,a1=map(int,input().split()) if a1==1: xa.append(x1) elif a1==2: xb.append(x1) elif a1==3: ya.append(y1) elif a1==4: yb.append(y1) if max(xb)<=max(xa) or max(yb)<=max(ya): print(0) else: print((max(xb)-max(xa))*(max(yb)-max(ya)))
s862901076
p03944
u505420467
1537550701
Python
Python (3.4.3)
py
Runtime Error
18
3064
251
w,h,n=map(int,input().split()) x=y=0 for i in range(n): xi,yi,a=map(int,input().split()) if a==1: x=max(x,xi) elif a==2: w=min(W,xi) elif a==3: y=max(y,yi) elif a==4: h=min(H,yi) print(0 if x>=w or y>=h else (w-x)*(h-y))
s022788231
p03944
u017810624
1536382542
Python
Python (3.4.3)
py
Runtime Error
18
3064
426
w,h,n=map(int,input().split()) a=[list(map(int,input().split())) for i in range(n)] a1=[];a2=[];a3=[];a4=[] for i in a: if i[2]==1:a1.append(i[0]) else:pass for i in a: if i[2]==2:a2.append(i[0]) else:pass for i in a: if i[2]==3:a3.append(i[1]) else:pass for i in a: if i[2]==4:a4.append(i[1]) else:pass if max(a1)-min(a2)<0:x=max(a1)-min(a2) else:x=0 if max(a3)-min(a4)<0:y=max(a3)-min(a4) else:y=0 print(x*y)
s905040424
p03944
u599547273
1533050998
Python
Python (3.4.3)
py
Runtime Error
17
3064
376
w, h, n = map(int, input().split(" ")) x_y_a = [tuple(map(int, input().split(" "))) for i in range(n)] min_x, max_x, min_y, max_y = 0, w, 0, h for x_y_a_i in x_y_a: x, y, a = x_y_a_i if a == 1: min_x = x elif a == 2: max_x = x elif a == 3: min_y = y elif a == 4: max_y = y print(min(0, max_x-min_x) * min(0, max_y-min_y)))
s866947887
p03944
u004025573
1532640586
Python
Python (3.4.3)
py
Runtime Error
17
3064
445
w,h,n=map(int,input().split()) ma_x=w ma_y=h mi_x=0 mi_y=0 for i in range(n): x,y,a=map(int,input().split()) if a==1: if mi_x<x: mi_x=x elif a==2: if ma_x>x: ma_x=x elif a==3: if mi_y<y: mi_y=y elif a==4: if ma_y>y: ma_y=y if ma_x-mi_x<0 and ma_y-mi_y<0: ma_x-mi_x=0 ans=(ma_x-mi_x)*(ma_y-mi_y) if ans<0: ans=0 print(ans)
s735932824
p03944
u624475441
1530921847
Python
Python (3.4.3)
py
Runtime Error
17
2940
264
W,H,N = map(int,input().split()) w=h=0 for _ in[0]*N: x,y,a = map(int,input().split()) if a == 1: w = max(w,x) elif a == 2: W = min(W,x) elif a == 3: h = max(h,y) elhe: H = min(H,y) print((W-w)*(H-h)*(W>w)*(H>h))
s071864819
p03944
u039623862
1525843306
Python
Python (3.4.3)
py
Runtime Error
17
3064
369
w, h, n = map(int, input().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 = min(x, x_min) elif a == 2: x_max = max(x, max_x) elif a == 3: y_min = min(y, y_min) else: y_max = max(y, max_y) print(max(y_max - y_min, 0) * max(x_max - x_min, 0))
s350266428
p03944
u327248573
1525138124
Python
Python (3.4.3)
py
Runtime Error
17
2940
398
W, H, N = map(int, input().split(' ')) minx = 0 maxx = W miny = 0 maxy = H for i in range(N): x, y, a = map(int, input().split(' ')) if a == 1: minx = max(minx, x) elif a == 2: maxx = min(maxx, x) elif a == 3: miny = max(miny, y) else: maxy = min(maxy, y) if minx <= maxx and miny <= maxy: print((maxx-minx) * (maxy-miny)) else: print(0)
s351305319
p03944
u944209426
1524976102
Python
Python (3.4.3)
py
Runtime Error
18
3064
407
w, h, n = map(int, input().split()) xya = [list(map(int, input().split())) for i in range(n)] x,y,a=[],[],[] for z in xya: x.append(z[0]) y.append(z[1]) a.append(z[2]) pp = np.array([[1]*w]*h) for i in range(n): if a[i]==1: pp[:, :x[i]]=0 if a[i]==2: pp[:, x[i]:]=0 if a[i]==3: pp[(h-y[i]):, :]=0 if a[i]==4: pp[:(h-y[i]), :]=0 print(sum(sum(pp)))
s882813707
p03944
u612721349
1520944179
Python
Python (3.4.3)
py
Runtime Error
17
3064
275
w,h,n = map(int,input().split()) lx,hx,ly,hy = 0,w,0,h for i in range(n): x,y,a = map(int,input().split()) if a == 1: lx = max(lx, x) elif a == 2: hx = min(hx, x) elif a == 3: ly = max(ly, y) elif a == 4: hy = min(hy, y) print(max(0,(hx-lx)*(hy-ly))
s924012525
p03944
u898651494
1519026151
Python
Python (3.4.3)
py
Runtime Error
17
2940
1704
#include <iostream> #include <fstream> #include <string> #include <cmath> #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <functional> using namespace std; using ll = long long; #define FOR(i, m, n) for(int i = (m);i < (n);i++) #define REP(i,n) for(int i = 0; i < int(n); i++) #define VI vector<int> #define VVI vector<vector<int>> #define VVVI vector<vector<vector<int>>> #define VL vector<ll> #define VVL vector<vector<ll>> #define VB vector<bool> #define VVB vector<vector<bool>> #define PAIR pair<int,int> #define MP make_pair #define VP vector<pair<int,int>> #define VS vector<string> #define QUE queue<int> #define DEQ deque<int> #define PQUE priority_queue<int> //5,5,4,3,3,2,... #define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,... #define SUM(obj) accumulate((obj).begin(), (obj).end(), 0) #define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5... #define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1... #define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n #define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n const ll MOD = (ll)1e9 + 7; int main() { int W,H,N; cin >> W >> H >> N; VI x(N), y(N), a(N); REP(i, N) cin >> x[i] >> y[i] >> a[i]; int left = 0, right = W, bottom = 0, top = H; REP(i, N){ if (a[i] == 1) left = max(left, x[i]); if (a[i] == 2) right = min(right, x[i]); if (a[i] == 3) bottom = max(bottom, y[i]); if (a[i] == 4) top = min(top, y[i]); } cout << max(0, (right - left)*(top - bottom)) << endl; return 0; }
s155126864
p03944
u481333386
1489118530
Python
Python (3.4.3)
py
Runtime Error
17
3064
394
w, h, n = [int(e) for e in input().split()] min_w, max_w, min_h, max_h = 0, w, 0, h for _ in range(n): x, y, a = [int(e) for e in input().split()] if a == 1: min_w = max(x, min_w) elif a == 2: max_w = min(x, max_w) elif a == 3: min_y = max(min_y, y) elif a == 4: max_y = min(max_y, h) print(max(0, max_w - min_w) * max(0, max_h - min_h))
s034889590
p03944
u481333386
1489118401
Python
Python (3.4.3)
py
Runtime Error
18
3064
378
w, h, n = map(int, input().split()) min_w, max_w, min_h, max_h = 0, w, 0, h for _ in range(n): x, y, a = map(int, input().split()) if a == 1: min_w = max(x, min_w) elif a == 2: max_w = min(x, max_w) elif a == 3: min_y = max(min_y, y) elif a == 4: max_y = min(max_y, h) print(max(0, max_w - min_w) * max(0, max_h - min_h))
s430083659
p03944
u481333386
1489118282
Python
Python (3.4.3)
py
Runtime Error
18
3064
345
w, h, n = map(int, input().split()) min_w, w, min_h, h = 0, w, 0, h for _ in range(n): x, y, a = map(int, input().split()) if a == 1: min_w = max(x, min_w) elif a == 2: w = min(x, w) elif a == 3: min_y = max(min_y, y) elif a == 4: y = min(y, h) print(max(0, w - min_w) * max(0, h - min_h))
s273910544
p03944
u481333386
1489117901
Python
Python (3.4.3)
py
Runtime Error
18
3064
384
w, h, n = map(int, input().split()) min_w, w, min_h, h = 0, w, 0, h for _ in range(n): x, y, a = map(int, input().split()) if a == 1: min_w = max(x, min_w) elif a == 2: w = min(x, w) elif a == 3: min_y = max(min_y, y) elif a == 4: y = min(y, h) w = w - min_w h = h - min_h if w < 1 or h < 1: print(0) else: print(w * h)
s633652087
p03944
u481333386
1489067491
Python
Python (3.4.3)
py
Runtime Error
17
3064
721
width, height, n = list(map(int, input().split())) lst = [[0 * width]] * height for _ in range(n): x, y, a = list(map(int, input().split())) if a == 1: for i in range(x): for j in range(height): lst[j][i] = 1 elif a == 2: for i in range(x, width): for j in range(height): lst[j][i] = 1 elif a == 3: for i in range(width): for j in range(y): lst[j][i] = 1 elif a == 4: for i in range(width): for j in range(y, height): lst[j][i] = 1 total = 0 for row in lst: for column in row: if column == 0: total += 1 print(total)
s118718059
p03944
u481333386
1489067153
Python
Python (3.4.3)
py
Runtime Error
17
3064
725
width, height, n = [int(e) for e in input().split()] lst = [[0 * width]] * height for _ in range(n): x, y, a = [int(e) for e in input().split()] if a == 1: for i in range(x): for j in range(height): lst[j][i] = 1 elif a == 2: for i in range(x, width): for j in range(height): lst[j][i] = 1 elif a == 3: for i in range(width): for j in range(y): lst[j][i] = 1 elif a == 4: for i in range(width): for j in range(y, height): lst[j][i] = 1 total = 0 for row in lst: for column in row: if column == 0: total += 1 print(total)
s356404207
p03944
u481333386
1489067006
Python
Python (3.4.3)
py
Runtime Error
17
3064
730
width, height, n = [int(e) for e in input().split()] lst = [[0 * width]] * height for _ in range(n): x, y, a = [int(e) for e in input().split()] if a == 1: for i in range(x): for j in range(height): lst[j][i] = 1 elif a == 2: for i in range(x, width): for j in range(height): lst[j][i] = 1 elif a == 3: for i in range(width): for j in range(height): lst[j][i] = 1 elif a == 4: for i in range(width): for j in range(height, y): lst[j][i] = 1 total = 0 for row in lst: for column in row: if column == 0: total += 1 print(total)
s174847033
p03944
u481333386
1489066889
Python
Python (3.4.3)
py
Runtime Error
17
3064
730
width, height, n = [int(e) for e in input().split()] lst = [[0 * width]] * height for _ in range(n): x, y, a = [int(e) for e in input().split()] if a == 1: for i in range(x): for j in range(height): lst[j][i] = 1 elif a == 2: for i in range(x, width): for j in range(height): lst[j][i] = 1 elif a == 3: for i in range(width): for j in range(y, height): lst[j][i] = 1 elif a == 4: for i in range(width): for j in range(height): lst[j][i] = 1 total = 0 for row in lst: for column in row: if column == 0: total += 1 print(total)
s990659049
p03944
u481333386
1489066574
Python
Python (3.4.3)
py
Runtime Error
17
3064
725
width, height, n = [int(e) for e in input().split()] lst = [[0 * width]] * height for _ in range(n): x, y, a = [int(e) for e in input().split()] if a == 1: for i in range(x): for j in range(height): lst[j][i] = 1 elif a == 2: for i in range(x, width): for j in range(height): lst[j][i] = 1 elif a == 3: for i in range(y): for j in range(width): lst[i][j] = 1 elif a == 4: for i in range(y, height): for j in range(width): lst[i][j] = 1 total = 0 for row in lst: for column in row: if column == 0: total += 1 print(total)
s381435403
p03944
u481333386
1489065951
Python
Python (3.4.3)
py
Runtime Error
18
3064
725
width, height, n = [int(e) for e in input().split()] lst = [[0 * width]] * height for _ in range(n): x, y, a = [int(e) for e in input().split()] if a == 1: for i in range(x): for j in range(height): lst[i][j] = 1 elif a == 2: for i in range(x, width): for j in range(height): lst[i][j] = 1 elif a == 3: for i in range(y): for j in range(width): lst[i][j] = 1 elif a == 4: for i in range(y, height): for j in range(width): lst[i][j] = 1 total = 0 for row in lst: for column in row: if column == 0: total += 1 print(total)
s731882569
p03944
u080412864
1480363487
Python
Python (3.4.3)
py
Runtime Error
24
3064
415
W, H, N = [int(x) for x in input().strip().split()] x_min = 0 y_min = 0 for i in range(N): x, y, a = [int(x) for x in input().strip().split()] if a == 1 and x_min < x: x_min = x elif a == 2 and W > x: W = x elif a == 3 and y_min < y: y_min = y elif a == 4 and H > y: H = y if x_min > w or y_min > H: print('0') else: print('(W - x_min)*(H - y_min)')
s285502465
p03944
u080412864
1480363421
Python
Python (3.4.3)
py
Runtime Error
24
3192
413
W, H, N = [int(x) for x in input().strip().split()] x_min = 0 y_min = 0 for i in range(N): x, y, a = [int(x) for x in input().strip().split()] if a == 1 and x_min < x: x_min = x elif a == 2 and W > x: W = x elif a == 3 and y_min < y: y_min = y elif a == 4 and H > y: H = y if x_min > w or y_min > H: print('0') else: print((W - x_min)*(H - y_min))
s944144126
p03944
u443512298
1480062054
Python
Python (3.4.3)
py
Runtime Error
24
3064
568
# coding: utf-8 """Snuke's Coloring 2 (ABC Edit) @author: hijiri.n @modified: 11-19-2016 """ def data(): return list(map(int, input().split())) def solve(init, point): w, h, N = init rect = [0, w, 0, h] for p in point: x, y, a = p if [1, -1][a % 2] * ([x, y][a > 2] - rect[a - 1]) < 0: rect[a - 1] = [x, y][a > 2] if rect[1] <= rect[0] or rect[3] <= rect[2]: return 0 return (rect[1] - rect[0]) * (rect[3] - rect[2]) i_in = data() p_in = [data() for _ in i[-1]] print(solve(i_in, p_in))
s237320497
p03944
u922952729
1479622662
Python
Python (3.4.3)
py
Runtime Error
24
3188
588
import sys inputdata=sys.stdin.readlines() whn=int(inputdata[0].split( )) W=whn[0] H=whn[1] N=whn[2] data1=[] data2=[] data3=[] data4=[] for i in inputdata: if i[-1]=="1": data1.append(int(i.split( ))) elif i[-1]=="2": data2.append(int(i.split( ))) elif i[-1]=="3": data3.append(int(i.split( ))) elif i[-1]=="4": data4.append(int(i.split( ))) a=0 for i in data1: if a<i: a=i b=W for i in data2: if b>i: b=i c=0 for i in data3: if c<i: c=i d=H for i in data4: if d>i: d=i if c>=d: print("0") elif b<=a: print("0") else: print(str((d-c)*(b-a)))
s633163765
p03944
u443512298
1479413469
Python
Python (3.4.3)
py
Runtime Error
23
3064
331
# coding: utf-8 w, h, N = list(map(int, input().split())) rect = [0, w, 0, h] for i in range(N): x, y, a = list(map(int, input().split())) if [1, -1][a % 2] * ([a > 2] - rect[a - 1]) < 0: rect[a - 1] = [x, y][a > 2] length = lambda x: [x, 0][x < 0] print(length(rect[1] - rect[0]) * length(rect[3] - rect[2]))
s625937730
p03944
u054556734
1479350407
Python
Python (3.4.3)
py
Runtime Error
24
3064
233
wo=0 ho=0 w,h,n=map(int, input().split()) for i in range(n): x,y,a=map(int, input().split()) if a==1: wo=x if a==2: w=x if a==3: ho=y if a==4: h=y ans=(w-wo)*(h-ho) if wo>=w or h0>=h: print(0) else: print(ans)
s759173778
p03944
u984351908
1478905362
Python
Python (3.4.3)
py
Runtime Error
23
3064
685
w, h, n = list(map(int, input().split())) xya = [] for i in range(n): xya.append(list(map(int, input().split()))) min_x_1 = w max_x_2 = 0 min_y_3 = h max_y_4 = 0 for i in range(n): ai = xya[i][2] if ai == 1: if xya[i][0] < min_x_1: min_x_1 = xya[i][0] if ai == 2: if xya[i][0] > max_x_2: max_x_2 = xya[i][0] if ai == 3: if xya[i][1] < min_y_3: min_y_3 = xya[i][1] if ai == 4: if xya[i][1] > max_y_4: max_y_4 = xya[i][1] x = min_x_1 - max_x_2 if x <= 0: print("0") else: y = min_y_3 - max_y_4 if y <= 0: print("0") else: print(str(x * y)) return 0
s846813777
p03944
u132291455
1478581343
Python
Python (2.7.6)
py
Runtime Error
17
2568
248
w,h,n=map(int,raw_input().split()) x1=0,x2=w,y1=0,y2=h for i in range(n): x,y,a=map(int,raw_input().split()) if a==1: x1=max(x1,x) if a==2: x2=min(x2,x) if a==3: y1=max(y1,y) if a==4: y2=min(y2,y) print max(0,x2-x1)*max(0,y2-y1)
s302084795
p03944
u155667931
1478493104
Python
Python (2.7.6)
py
Runtime Error
17
2696
1276
def main(): W,H,N = map(int , raw_input().split()) white = {"l_bottom":[0,0],"r_top":[W,H]} areaZero = False for i in xrange(N): x,y,a = map(int,raw_input().split()) if a == 1: if x > white['r_top'][0]: areaZero = True continue if x > white['l_bottom'][0]: white['l_bottom'][0] = x continue if a == 2: if x < white['l_bottom'][0]: areaZero = True continue if x < white['r_top'][0]: white['r_top'][0] = x continue if a ==3 : if y > white['r_top'][1]: areaZero = True continue if y > white['l_bottom'][1]: white['l_bottom'][1] = y continue if a == 4 : if y < white['l_bottom'][1]: areaZero = True continue if y < white['r_top'][1]: white['r_top'][1] = y continue if areaZero == True: print 0 else: print (white['r_top'][0] - white['l_bottom'][0]) * (white['r_top'][1] - white['l_bottom'][1]) if __name__ == '__main__' main()
s127104034
p03944
u462665941
1478489384
Python
Python (2.7.6)
py
Runtime Error
18
2696
473
W = 0 H = 0 maxa_1 = 0 mina_2 = 0 maxa_3 = 0 mina_4 = 0 count = 0 for line in l: if count == 0: W = line[0] H = line[1] S = W * H maxa_1 = 0 mina_2 = W maxa_3 = 0 mina_4 = H else: if line[2] == 1: maxa_1 = max(maxa_1, line[0], 0) if line[2] == 2: mina_2 = min(mina_2, line[0], W) if line[2] == 3: maxa_3 = max(maxa_3, line[1], 0) if line[2] == 4: mina_4 = min(mina_4, line[1], H) count += 1 print((mina_2-maxa_1) * (mina_4-maxa_3))
s300365423
p03944
u436484848
1478487362
Python
Python (3.4.3)
py
Runtime Error
23
3064
563
def read(): return [int(i) for i in input().split(' ')] W, H, N = read() x = [0] * N y = [0] * N a = [0] * N for i in range(N): x[i], y[i], a[i] = read() new_x = [0] + x + [W] new_y = [0] + y + [H] for inx in range(N): if(a[inx] == 1): new_x = [num for num in new_x if num >= x[inx]] elif(a[inx] == 2): new_x = [num for num in new_x if num <= x[inx]] elif(a[inx] == 3): new_y = [num for num in new_y if num >= y[inx]] else: new_y = [num for num in new_y if num <= y[inx]] area = (max(new_x) - min(new_x)) * (max(new_y) - min(new_y)) print(area)
s658918951
p03945
u624613992
1601084569
Python
Python (3.8.2)
py
Runtime Error
26
9108
92
s = input() ans = 0 for i in range(len(s)-1): if s[i] != S[i+1]: ans += 1 print(ans)
s151983345
p03945
u620846115
1600574823
Python
Python (3.8.2)
py
Runtime Error
27
9068
54
n = input() gr = itertools.groupby(n) print(len(gr)-1)
s239257148
p03945
u672316981
1600361824
Python
Python (3.8.2)
py
Runtime Error
24
8928
802
def main(): s = str(input()) b_count = s.count('B') w_count = len(s) - b_count if b_count == len(s) or w_count == len(s): count = 0 else: count = 0 index = 0 alp = s[index] while True: if b_count == 0 or w_count == 0: break else: if s[index] == 'B': b_count -= 1 else: w_count -= 1 if s[index] == alp: index += 1 continue else: count += 1 alp = s[index] index += 1 if not (b_count == 0 and w_count == 0): count += 1 print(count) if __name__ == '__main__': main()
s238856865
p03945
u113255362
1600229197
Python
Python (3.8.2)
py
Runtime Error
50
9700
118
S = input() List = list(S) trial = 0 for i in range(1,len(List)): if List[i] != List[i-1]: trial += 1 print(res)
s972905401
p03945
u244836567
1599781884
Python
Python (3.8.2)
py
Runtime Error
28
9008
99
a=input() b=0 for i in range(len(a)-1): a[i]!=a[i+1]: b=b+1 if a[-2]!=a[-1]: b=b+1 print(b)
s029403120
p03945
u867826040
1599270059
Python
Python (3.8.2)
py
Runtime Error
24
8924
356
#include <iostream> #include <string> #define rep(i,n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; int ans = 0; cin >> s; rep(i,s.size()-1) { if (s[i] != s[i+1]) { ans++; } } cout << ans << "\n"; }
s778346192
p03945
u867826040
1599270032
Python
Python (3.8.2)
py
Runtime Error
25
8992
338
#include <iostream> #define rep(i,n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; int ans = 0; cin >> s; rep(i,s.size()-1) { if (s[i] != s[i+1]) { ans++; } } cout << ans << "\n"; }
s046877047
p03945
u536034761
1598287297
Python
Python (3.8.2)
py
Runtime Error
25
8936
247
S = input() cntb = 1000000 if if S[0] == "B" and S[-1] == "B" else 0 cntw = 1000000 if S[0] == "W" and S[-1] == "W" else 0 for s in S.split("B"): if s != "": cntb += 1 for s in S.split("W"): if s != "": cntw += 1 print(min(cntb, cntw))
s004243839
p03945
u074220993
1597079082
Python
Python (3.8.2)
py
Runtime Error
29
9148
208
S = input() X = S[0] ans = 0 while 1: for i in range(S): if S[i] != X: ans += 1 X =S[i] S = S[i:] break else: break print(ans)
s284962664
p03945
u425762225
1596937276
Python
Python (3.8.2)
py
Runtime Error
21
8876
593
#!/usr/bin/env python3 # from numba import njit # input = stdin.readline def calcGroup(s): whiteCount = 0 blackCount = 0 prev = "" for i in range(len(s)): if s[i] == prev: pass else: if s[i] = "": pass elif s[i] = "W": whiteCount += 1 elif s[i] = "B": blackCount += 1 else: raise ValueError prev = s[i] return whiteCount,blackCount # @njit def solve(s): # white,black = calcGroup(s) return min(calcGroup(s)) def main(): s = input() print(solve(s)) return if __name__ == '__main__': main()
s767078811
p03945
u425762225
1596937177
Python
Python (3.8.2)
py
Runtime Error
27
9020
557
#!/usr/bin/env python3 # from numba import njit # input = stdin.readline def calcGroup(s): whiteCount = 0 blackCount = 0 prev = "" for i in range(len(s)): if s[i] == prev: pass else: if s[i] = "W": whiteCount += 1 elif s[i] = "B": blackCount += 1 else: raise ValueError prev = s[i] return whiteCount,blackCount # @njit def solve(s): # white,black = calcGroup(s) return min(calcGroup(s)) def main(): s = input() print(solve(s)) return if __name__ == '__main__': main()
s086700697
p03945
u758815106
1596095699
Python
Python (3.8.2)
py
Runtime Error
47
9160
341
#import #import math #import numpy as np #= int(input()) S = input() #= map(int, input().split()) #= list(map(int, input().split())) #= [input(), input()] #= [list(map(int, input().split())) for _ in range(N)] #= {i:[] for i in range(N)} s = S[0] r = 0 for i in range(1, len(S)): if s != S[i]: r += 1 s = S[i] print(res)
s119794861
p03945
u350093546
1595842704
Python
PyPy3 (7.3.0)
py
Runtime Error
102
79252
97
s=list(input()) ans=0 pin=s[0] for i in s[1:]: if s[i]==pin: ans+=1 pin=s[i] print(ans)
s114689890
p03945
u299172013
1594097890
Python
PyPy3 (7.3.0)
py
Runtime Error
139
81476
307
def solve(n): if n == 1: return 0 else: if S[n - 2] == S[n - 1]: return solve(n - 1) else: return solve(n - 1) + 1 if __name__ == "__main__": S = input() first_s = S[0] S = [1 if first_s == s else 0 for s in S] print(solve(len(S)))
s722702930
p03945
u094191970
1592531996
Python
Python (3.8.2)
py
Runtime Error
27
9316
422
w, h, n = map(int,input().split()) y_min = 0 y_max = h x_min = 0 x_max = w for i in range(n): x, y, a = map(int,input().split()) if a == 1: x_min = max(x_min, x) if a == 2: x_max = min(x_max, x) if a == 3: y_min = max(y_min, y) if a == 4: y_max = min(y_max, y) white = (y_max - y_min) * (x_max - x_min) if (y_max - y_min)>=0 and (x_max - x_min)>=0: print(max(white, 0)) else: print(0)
s731088326
p03945
u094191970
1592531922
Python
Python (3.8.2)
py
Runtime Error
23
9220
448
w, h, n = map(int,input().split()) #とりうるx,yの範囲 y_min = 0 y_max = h x_min = 0 x_max = w for i in range(n): x, y, a = map(int,input().split()) if a == 1: x_min = max(x_min, x) if a == 2: x_max = min(x_max, x) if a == 3: y_min = max(y_min, y) if a == 4: y_max = min(y_max, y) white = (y_max - y_min) * (x_max - x_min) if (y_max - y_min)>=0 and (x_max - x_min)>=0: print(max(white, 0)) else: print(0)
s010570192
p03945
u670961163
1592399977
Python
Python (3.4.3)
py
Runtime Error
31
3188
582
def main(): s = input() slen = len(s) cnt = 0 last = 0 if s[0] == "W": for i in range(slen-1): if s[i] == "W" and s[i+1] =="B": cnt += 1 if s[-1] == "W" and s[-2] == "B": last = 1 if s[0] == "B": for i in range(slen-1): if s[i] == "B" and s[i+1] =="W": cnt += 1 if s[-1] == "B" and s[-2] == "W": last = 1 if cnt == 0: print(cnt) else: print(cnt*2 - 1 + last) if __name__ == "__main__": main()
s099654211
p03945
u131881594
1592361215
Python
Python (3.4.3)
py
Runtime Error
18
3188
98
s=input() now,ans=0,0 while now<n-1: if s[now]!=s[now+1]: ans+=1 now+=1 print(ans)
s334296702
p03945
u857759499
1589936387
Python
Python (3.4.3)
py
Runtime Error
17
2940
331
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); sc.close(); int ans = 0; char b = s[0]; for (char i:s){ if (b != i){ ans++; b = i; } } System.out.println(ans); } }
s608980302
p03945
u704563784
1589404152
Python
Python (3.4.3)
py
Runtime Error
42
3188
197
string = input() ans = 0 for i in range(len(string)-1): if string[i] != string[i+1]: ans += 1 if string[-1] != string[-2]: ans += 1 if ans > 0: print(ans-1) else: print(ans)
s096244368
p03945
u159975271
1589138409
Python
Python (3.4.3)
py
Runtime Error
82
3956
268
S = list(input()) if len(list(set(S))) != 0: i =0 count = 0 while True: if S[i] != S[i+1]: count += 1 S[i] = S[i + 1] i += 1 if i == (len(S)-1): break else: count = 0 print(count)
s428646056
p03945
u159975271
1589138347
Python
Python (3.4.3)
py
Runtime Error
75
3956
248
S = list(input()) if len(list(set(S))) != 0: i =0 count = 0 while True: if S[i] != S[i+1]: count += 1 S[i] = S[i + 1] i += 1 if i == (len(S)-1): break print(count)
s446758648
p03945
u896741788
1588194498
Python
Python (3.4.3)
py
Runtime Error
18
3188
63
s=input() from itertools import groupby as gb print(len(gb(s)))
s734859238
p03945
u679154596
1586740739
Python
Python (3.4.3)
py
Runtime Error
264
99392
480
import sys sys.setrecursionlimit(10**5) S = list(input()) L = len(S) b = S.count("B") w = S.count("W") def f(i, result): if S[i] == S[i-1]: if i == 1: print(result) exit() else: f(i-1, result) else: if i == 1: result += 1 print(result) exit() else: result += 1 f(i-1, result) if L == 1: result = 0 print(result) exit() elif b == L or w == L: result = 0 print(result) exit() else: f(L-1, 0)
s432664903
p03945
u679154596
1586740149
Python
Python (3.4.3)
py
Runtime Error
82
4836
439
S = list(input()) L = len(S) b = S.count("B") w = S.count("W") def f(i, result): if S[i] == S[i-1]: if i == 1: print(result) exit() else: f(i-1, result) else: if i == 1: result += 1 print(result) exit() else: result += 1 f(i-1, result) if L == 1: result = 0 print(result) exit() elif b == L or w == L: result = 0 print(result) exit() else: f(L-1, 0)