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
s826697052
p02556
u884244819
1600029379
Python
Python (3.8.2)
py
Runtime Error
598
74844
395
import numpy as np from scipy.spatial import distance def main(): n = int(input()) lis = [] for i in range(n+1): x,y = map(int, input().split()) lis.append([x,y]) M = np.array(lis) try: dist_M = distance.cdist(M, M, metric='cityblock') print(str(np.max(dist_M)).split(...
s852148597
p02556
u710282484
1600029373
Python
Python (3.8.2)
py
Runtime Error
1708
72744
320
n=int(input()) l=[input().split() for _ in range(n)] dp=[0]*(n+2) dp1=[0]*(n+2) for i in range(n): for j in range(1,n): dp[i+j] = max(abs(int(l[i][0]) - int(l[j][0])), dp[i+j-1]) dp1[i+j] = max(abs(int(l[i][1]) - int(l[j][1])), dp[i+j-1]) dp=sorted(dp) dp1=sorted(dp1) print(int(dp[-1])+int(dp1[-1]))
s109464152
p02556
u622570247
1600029372
Python
Python (3.8.2)
py
Runtime Error
461
44008
416
import itertools n = int(input()) ps = list({ tuple(map(int, input().split())) for _ in range(n) }) g = sum([p[0] for p in ps]) / len(ps) g = sum([p[1] for p in ps]) / len(ps) maxd = 0 maxp = ps[0] for p in ps: d = abs(g[0] - p[0]) + abs(g[1] - p[1]) if d > maxd: maxp = p maxd = d ma...
s625455217
p02556
u662977802
1600029363
Python
Python (3.8.2)
py
Runtime Error
429
9348
1324
n = int(input()) c = 0 c1 = 0 xx = 0 yy = 0 for i in range(n): p = input() q = p.split(" ") x = int(q[0]) y = int(q[1]) k = i + 1 for j in range(k, n): m = input() l = m.split(" ") a = int(l[0]) b = int(l[1]) if x >= a and y >= b: ...
s717011666
p02556
u585963734
1600029348
Python
Python (3.8.2)
py
Runtime Error
29
9180
512
N=int(input()) A=[list(map(int, input().split()))] temp1=cp.deepcopy(A[0]) temp2=cp.deepcopy(A[0]) for i in range(N-1): f=0 x,y=map(int, input().split()) if abs(temp1[0]-x)+abs(temp1[1]-y): temp2[0]=x temp2[1]=y f=1 if f==1: for i,j in A: if max(abs(temp2[0]-i...
s543179073
p02556
u496407619
1600029330
Python
PyPy2 (7.3.0)
py
Runtime Error
82
64696
2039
for i, (x, y) in enumerate(pairs): xy = x+y if i == 0: min_x = max_x = x min_y = max_y = y min_xi = [0] max_xi = [0] min_yi = [0] max_yi = [0] min_xyi = [0] max_xyi = [0] min_xy = max_xy = xy else: if x < min_x: mi...
s282194276
p02556
u290886932
1600029311
Python
Python (3.8.2)
py
Runtime Error
25
9120
250
N = int(input()) A = list() for i in range(N): A.append(list(map(int,input().split()))) ret = 0 for i in range(N-1): for j in range(i + 1,N): tmp = abs(A[i][0] - A[j][0]) + abs(A[i][1] - A[j][1]) if ret < tmp: ret = tmp return ret
s045882910
p02556
u469254913
1600029291
Python
Python (3.8.2)
py
Runtime Error
358
66360
487
import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N = int(input()) xy = [list(map(int,input().split())) for i in range(N)] xy = np.array(xy) # print(xy) diffs = np.expand_dims(xy,axis=1)...
s620878090
p02556
u372802746
1600029288
Python
Python (3.8.2)
py
Runtime Error
34
11980
207
N = int(input()) M=N*N x = [0] * N y = [0] * N z=[0]*M for i in range(0,N): x[i], y[i] = map(int, input().split()) for i in range(0,M): z.append(abs(x[i//N]-x[i%N])+abs(y[i//N]-y[i%N])) print(max(z))
s753511117
p02556
u354804355
1600029270
Python
Python (3.8.2)
py
Runtime Error
610
66436
317
#ABC178 E import numpy as np n = int(input()) l = [list(map(int, input().split())) for l in range(n)] list = np.array(l) #print(list) all_diffs = np.expand_dims(list, axis=1) - np.expand_dims(list, axis=0) #print(all_diffs) distance = np.sum(abs(all_diffs), axis=-1) #print(distance) ans = np.max(distance) print(ans)
s494678478
p02556
u785618718
1600029265
Python
Python (3.8.2)
py
Runtime Error
455
45516
424
N = int(input()) xy = [ [0,0] ]*N for i in range(N): xy[i] = list( map(int, input().split()) ) max = 0 xy = list(set(xy)) for s in range(N-1): for t in range(s+1,N): manh = 0 x_d = xy[s][0] - xy[t][0] y_d = xy[s][1] - xy[t][1] if x_d > 0: manh += x_d else: manh -= x_d if y_d...
s462855766
p02556
u273914730
1600029256
Python
Python (3.8.2)
py
Runtime Error
27
9072
321
N=int(input()) xy=[map(int,input().split()) for i in range(N)] x,y=[list(j) for j in zip(*xy)] m=0 t=0 for k in range(N): for l in range(k,N-1): if (abs(x[k]-x[l]))<t: m=m else: if (abs(x[k]-x[l])+abs(y[k]-y[l]))>m: t=(abs(x[k]-x[l]) m=(abs(x[k]-x[l])+abs(y[k]-y[l])) print(m)...
s724625977
p02556
u019685451
1600029226
Python
PyPy3 (7.3.0)
py
Runtime Error
356
98060
1778
def solve(): N = int(input()) xs, ys = [], [] for _ in range(N): x, y = map(int, input().split()) xs.append(x) ys.append(y) T, B = max(ys), min(ys) L, R = min(xs), max(xs) # print(T, B, L, R) if T == B: return abs(R - L) if L == R: return ...
s162372599
p02556
u554129261
1600029222
Python
Python (3.8.2)
py
Runtime Error
468
9256
494
N = int(input()) xpy_max = 0 xpy_min = 10 ** 9 + 3 xmy_max = 0 xmy_min = 10 ** 9 + 3 for i in range(N): x, y = map(int, input().split()) if x + y <= xpy_min: xpy_min = x + y a = (x, y) if x + y >= xpy_max: xpy_max = x + y b = (x, y) if x - y >= xmy_max: xmy_max = ...
s246241025
p02556
u248996551
1600029218
Python
PyPy3 (7.3.0)
py
Runtime Error
2207
97600
2173
N=int(input()) X=[] Y=[] Z=[] import sys if N==2: x_1,y_1=map(int,input().split()) x_2,y_2=map(int,input().split()) print(abs(x_1-x_2)+(y_1-y_2)) sys.exit() for i in range(N): x,y=map(int,input().split()) X.append(x) Y.append(y) if [x,y] not in Z: Z.append([x,y]) #Z.a...
s259086770
p02556
u706414019
1600029208
Python
PyPy3 (7.3.0)
py
Runtime Error
88
68616
1306
import sys,math,collections,itertools input = sys.stdin.readline N=int(input()) XY = [] xAve = 0 yAve = 0 for _ in range(N): x,y=map(int,input().split()) XY.append([x,y]) xAve += x yAve += y xAve = xAve/N yAve = yAve/N XYnorm = [0]*4 for x,y in XY: nX = x-xAve nY = y-yAve if nX>=0 and nY>=...
s907771114
p02556
u922769680
1600029195
Python
Python (3.8.2)
py
Runtime Error
653
76228
452
n=int(input()) a_list=[list(map(int,input().split())) for i in range(n)] import numpy as np A=[] for i in range(n): A.append(a_list[i][0]**2+a_list[i][1]**2) A2=np.array(A) maxIndex = [i for i, x in enumerate(a) if x == max(a)] minIndex = [i for i, x in enumerate(a) if x == min(a)] B=[] for i in range(len(maxIndex...
s212488856
p02556
u706414019
1600029159
Python
PyPy3 (7.3.0)
py
Runtime Error
89
68612
1555
import sys,math,collections,itertools input = sys.stdin.readline N=int(input()) XY = [] xAve = 0 yAve = 0 for _ in range(N): x,y=map(int,input().split()) XY.append([x,y]) xAve += x yAve += y xAve = xAve/N yAve = yAve/N XYnorm = [0]*4 for x,y ...
s755946326
p02556
u699522269
1600029139
Python
Python (3.8.2)
py
Runtime Error
592
66548
289
import numpy as np N = int(input()) nums=[] for _ in range(N): nums.append(list(map(int,input().split()))) cities = np.array(nums) all_diffs = np.expand_dims(cities, axis=1) - np.expand_dims(cities, axis=0) degree_distance = np.sum(abs(all_diffs), axis=-1) print(degree_distance.max())
s090944940
p02556
u822090837
1600029124
Python
Python (3.8.2)
py
Runtime Error
364
24696
242
N = int(input()) x = [0] * N y = [0] * N for i in range(N): x[i], y[i] = map(int, input().split()) 0<=a<=N-1,0<=b<=N-1,a!=b for a in range(N): for b in range(N): P=list(abs(x[a]-x[b])+abs(y[a]-y[b])) l=sum(P) print(P.count(l))
s924507499
p02556
u706414019
1600029107
Python
PyPy3 (7.3.0)
py
Runtime Error
198
95740
1307
import sys,math,collections,itertools input = sys.stdin.readline N=int(input()) XY = [] xAve = 0 yAve = 0 for _ in range(N): x,y=map(int,input().split()) XY.append([x,y]) xAve += x yAve += y xAve = xAve/N yAve = yAve/N XYnorm = [0]*4 for x,y in XY: nX = x-xAve nY = y-yAve if nX>=0 and nY>=...
s379784265
p02556
u995323427
1600029074
Python
Python (3.8.2)
py
Runtime Error
28
8944
382
N = int(input()) hw = [[int(i) for i in input().split()] for _ i range(N)] minD = 2*10**9 min = 0 maxD = 0 max = 0 for i in range(N): if (minD > (hw[i][0] + hw[i][1])): minD = hw[i][0] + hw[i][1] min = i if (maxD < hw[i][0] + hw[i][1]): maxD = hw[i][0] + hw[i][1] max = i print...
s959736247
p02556
u198930868
1600029059
Python
PyPy3 (7.3.0)
py
Runtime Error
2211
164112
274
n = int(input()) c = [list(map(int,input().split())) for i in range(n)] c= list(map(list, set(map(tuple, c)))) ans = 0 if len(c) >= 2: for i in range(n): for l in range(i,n): tmp = abs(c[i][0] - c[l][0]) + abs(c[i][1]-c[l][1]) ans = max(ans,tmp) print(ans)
s518332906
p02556
u469254913
1600029050
Python
Python (3.8.2)
py
Runtime Error
375
66476
469
import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N = int(input()) xy = [list(map(int,input().split())) for i in range(N)] xy = np.array(xy) # print(xy) diffs = np.expand_dims(xy,axis=1)...
s907868536
p02556
u623283955
1600029046
Python
PyPy3 (7.3.0)
py
Runtime Error
92
68720
197
import numpy as np n=int(input()) lx=[] ly=[] for i in range(n): x,y=map(int,input().split()) lx.append(x+y) ly.append(x-y) ax,bx,ay,by=max(lx),min(lx),max(ly),min(ly) print(max(ax-bx,ay-by))
s381792028
p02556
u923662841
1600029037
Python
Python (3.8.2)
py
Runtime Error
577
60092
320
import numpy as np N = int(input()) xy = list() for i in range(N): x,y = map(int,input().split()) xy.append([x,y]) XY = np.array(xy) dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0) dis = np.sum(np.abs(dif), axis=-1).astype(np.int64) idx = np.unravel_index(np.argmax(dis),dis.shape) print(dis[idx])
s646906088
p02556
u710282484
1600029035
Python
Python (3.8.2)
py
Runtime Error
442
69164
316
n=int(input()) l=[input().split() for _ in range(n)] dp=[0]*n*n dp1=[0]*n*n for i in range(n): for j in range(1,n): dp[i+j] = max(abs(int(l[i][0]) - int(l[j][0])), dp[i+j-1]) dp1[i+j] = max(abs(int(l[i][1]) - int(l[j][1])), dp[i+j-1]) dp=sorted(dp) dp1=sorted(dp1) print(int(dp[-1])+int(dp1[-1]))
s474732882
p02556
u224346910
1600029010
Python
PyPy3 (7.3.0)
py
Runtime Error
367
103944
585
from itertools import combinations N = int(input()) XY = [list(map(int, input().split())) for _ in range(N)] min_diff = 10**9 max_diff = 1 min_sum = 2 * 10**9 max_sum = 2 for x,y in XY: min_diff = min(x-y, min_x) max_diff = max(x-y, max_x) min_sum = min(x+y, min_sum) max_sum = max(x+y, max_sum) cand...
s420212020
p02556
u710282484
1600028998
Python
PyPy3 (7.3.0)
py
Runtime Error
387
120792
316
n=int(input()) l=[input().split() for _ in range(n)] dp=[0]*n*n dp1=[0]*n*n for i in range(n): for j in range(1,n): dp[i+j] = max(abs(int(l[i][0]) - int(l[j][0])), dp[i+j-1]) dp1[i+j] = max(abs(int(l[i][1]) - int(l[j][1])), dp[i+j-1]) dp=sorted(dp) dp1=sorted(dp1) print(int(dp[-1])+int(dp1[-1]))
s319262934
p02556
u710282484
1600028947
Python
PyPy3 (7.3.0)
py
Runtime Error
404
124748
306
n=int(input()) l=[input().split() for _ in range(n)] dp=[0]*n*n dp1=[0]*n*n for i in range(n): for j in range(1,n): dp[i+j] = max(abs(int(l[i][0]) - int(l[j][0])), dp[i+j-1]) dp1[i+j] = max(abs(int(l[i][1]) - int(l[j][1])), dp[i+j-1]) dp=sorted(dp) dp1=sorted(dp1) print(dp[-1]+dp1[-1])
s421478022
p02556
u580073714
1600028934
Python
Python (3.8.2)
py
Runtime Error
598
66256
283
import numpy as np N = int(input()) a = [[0] *2] * N for i in range(N): a[i] = list(map(int, input().split())) cities = np.array(a) all_diffs = np.expand_dims(cities, axis=1) - np.expand_dims(cities, axis=0) distance = np.sum(np.abs(all_diffs), axis=-1) print(np.max(distance))
s580383230
p02556
u926266624
1600028921
Python
Python (3.8.2)
py
Runtime Error
1119
77304
362
N = int(input()) ListN = [[0 for i in range(2)] for j in range(N)] for i in range (N): x, y, = map(int, input().split()) ListN[i] = [x,y] ListN = list(map(list, set(map(tuple, ListN)))) ListN.sort(reverse=True) m = 0 minN = ListN[0][0] + ListN[0][1] maxN = ListN[0][0] + ListN[0][1] print((ListN[0][0] - ListN[0]...
s543903712
p02556
u248996551
1600028898
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
139156
1963
N=int(input()) X=[] Y=[] Z=[] for i in range(N): x,y=map(int,input().split()) X.append(x) Y.append(y) Z.append([x,y]) def signed_area(p1, p2, p3): '''符号付き面積を計算 ''' area = (((p2[0] - p1[0]) * (p3[1] - p1[1])) - ((p3[0] - p1[0]) * (p2[1] - p1[1]))) / 2 return area def convex_hull(p_list)...
s424693283
p02556
u926266624
1600028874
Python
Python (3.8.2)
py
Runtime Error
1073
77184
360
N = int(input()) ListN = [[0 for i in range(2)] for j in range(N)] for i in range (N): x, y, = map(int, input().split()) ListN[i] = [x,y] ListN = list(map(list, set(map(tuple, ListN)))) ListN.sort(reverse=True) m = 0 minN = ListN[0][0] + ListN[0][1] maxN = ListN[0][0] + ListN[0][1] print(ListN[0][0] - ListN[0][...
s817243668
p02556
u476628920
1600028869
Python
Python (3.8.2)
py
Runtime Error
2207
45408
239
N = int(input()) XY = [] for i in range(N): val = input() if val: XY.append(val) V=[] c = 0 for i in range(N): for j in range(i+1,N): V.append(abs(int(XY[i][0])-int(XY[j][0]))+abs(int(XY[i][2])-int(XY[j][2]))) print(max(V))
s494603742
p02556
u662977802
1600028859
Python
Python (3.8.2)
py
Runtime Error
431
9228
602
n = int(input()) c = 0 xx = 0 yy = 0 for i in range(n): p = input() q = p.split(" ") x = int(q[0]) y = int(q[1]) k = i + 1 for j in range(k, n): m = input() l = m.split(" ") a = int(l[0]) b = int(l[1]) if x >= a and y >= b: if (x - a) + (y - b) > (xx + yy): ...
s587404745
p02556
u822090837
1600028832
Python
Python (3.8.2)
py
Runtime Error
378
24684
246
N = int(input()) x = [0] * N y = [0] * N for i in range(N): x[i], y[i] = map(int, input().split()) 1<=a<=N,1<=b<=N,a!=b for a in range(1,N+1): for b in range(1,N+1): P=list(abs(x[a]-x[b])+abs(y[a]-y[b])) l=sum(P) print(P.count(l))
s861427200
p02556
u580073714
1600028794
Python
Python (3.8.2)
py
Runtime Error
614
66384
392
import numpy as np N = int(input()) a = [[0] *2] * N for i in range(N): a[i] = list(map(int, input().split())) #print(a) cities = np.array(a) all_diffs = np.expand_dims(cities, axis=1) - np.expand_dims(cities, axis=0) #print(all_diffs) degree_distance = np.sum(np.abs(all_diffs), axis=-1) #print(degree_distance...
s404816441
p02556
u884244819
1600028740
Python
Python (3.8.2)
py
Runtime Error
664
77660
334
import numpy as np from scipy.spatial import distance def main(): n = int(input()) lis = [] for i in range(n): x,y = map(int, input().split()) lis.append([x,y]) M = np.array(lis) dist_M = distance.cdist(M, M, metric='cityblock') print(int(np.max(dist_M))) if __name__ == '__main_...
s842713338
p02556
u245375581
1600028735
Python
Python (3.8.2)
py
Runtime Error
28
8932
396
import numpy as np from numba import njit N = int(input()) x=[0]*N y=[0]*N add=[0]*N for i in range(N): xy=list(map(int,input().split())) x[i]=xy[0] y[i]=xy[1] add=x[i]+y[i] @njit def solve(N, x, y, add): temp=np.array(add) index_list=np.argsort(temp) return int(abs(x[index_list[0]-x[index...
s177399500
p02556
u699522269
1600028734
Python
Python (3.8.2)
py
Runtime Error
617
66048
320
import numpy as np import sys N = int(input()) mx = - float("inf") nums=[] for _ in range(N): nums.append(list(map(int,input().split()))) cities = np.array(nums) all_diffs = np.expand_dims(cities, axis=1) - np.expand_dims(cities, axis=0) degree_distance = np.sum(abs(all_diffs), axis=-1) print(degree_distance.max())
s087108870
p02556
u699522269
1600028707
Python
PyPy3 (7.3.0)
py
Runtime Error
370
88184
320
import numpy as np import sys N = int(input()) mx = - float("inf") nums=[] for _ in range(N): nums.append(list(map(int,input().split()))) cities = np.array(nums) all_diffs = np.expand_dims(cities, axis=1) - np.expand_dims(cities, axis=0) degree_distance = np.sum(abs(all_diffs), axis=-1) print(degree_distance.max())
s312190417
p02556
u706414019
1600028675
Python
PyPy3 (7.3.0)
py
Runtime Error
224
95756
925
import sys,math,collections,itertools input = sys.stdin.readline N=int(input()) XY = [] xAve = 0 yAve = 0 for _ in range(N): x,y=map(int,input().split()) XY.append([x,y]) xAve += x yAve += y xAve = xAve/N yAve = yAve/N XYnorm = [0]*4 for x,y in XY: nX = x-xAve nY = y-yAve if nX>=0 and nY>=...
s554957765
p02556
u102655885
1600028649
Python
Python (3.8.2)
py
Runtime Error
705
9288
1544
n = int(input()) edge0 = list(map(lambda x: int(x), input().split())) edge1 = list(map(lambda x: int(x), input().split())) dis = abs(edge0[0]-edge1[0]) + abs(edge0[1]-edge1[1]) for _ in range(n-2): x, y = map(lambda x: int(x), input().split()) if (x < min(edge0[0], edge1[0])) | (max(edge0[0], edge1[0]) < x) |...
s499356434
p02556
u597252152
1600028641
Python
Python (3.8.2)
py
Runtime Error
28
8956
1038
#include "bits/stdc++.h" //#include<ext/pb_ds/assoc_container.hpp> //#include<ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; using namespace std; #define fastio ios_base::sync_with_stdio(0); cin.tie(0); #define int long long int #define tc int t; cin>>t; while(t--) #define fora(i,n) for(int i=0;i<n;i++) #defi...
s294163017
p02556
u966542724
1600028626
Python
Python (3.8.2)
py
Runtime Error
761
49828
813
n = int(input()) c = [] for _ in range(n): c.append(list(map(int,input().split()))) ans = 0 a = 100000000000000 m = 0 lm = 0 rm = 0 lt = [] rt = [] lb = [] rb = [] for l in c: m = max(m,l[0]+l[1]) a = min(a,l[0]+l[1]) if l[0] > l[1]: rm = max(rm,l[0]-l[1]) if l[0] < l[1]: lm = ma...
s383533275
p02556
u739843002
1600028622
Python
Python (3.8.2)
py
Runtime Error
2215
276824
602
def main(): N = int(input()) p = [] for i in range(N): x, y = [int(a) for a in input().split(" ")] p.append({"x" : x, "y" : y}) aveX = 0 aveY = 0 for i in range(N): aveX += p[i]["x"] aveY += p[i]["y"] aveX /= N aveY /= N for i in range(N): p[i]["d"] = abs(aveX - p[i]["x"]) + abs(aveY - p[i]["y"]) p....
s845683438
p02556
u923662841
1600028569
Python
Python (3.8.2)
py
Runtime Error
615
60016
339
import numpy as np N = int(input()) xy = list() for i in range(N): x,y = map(int,input().split()) xy.append([x,y]) XY = np.array(xy) dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0) dis = np.sum(np.abs(dif), axis=-1) idx = np.unravel_index(np.argmax(dis),dis.shape) #print(dif) #print(dis) #print(i...
s971948369
p02556
u095424182
1600028519
Python
Python (3.8.2)
py
Runtime Error
410
42252
485
import math def dist(a,b): return abs(a[0]-b[0])+abs(a[1]-b[1]) if __name__=="__main__": n=int(input()) l=[] for _ in range(n): x=[int(i) for i in input().split()] l.append(x) if len(l)==1: print(0) exit n=len(l) ans=[] for i in range(n-1): l=i+1 r=len(l) ma=-1 while(i<...
s610091363
p02556
u304590784
1600028518
Python
Python (3.8.2)
py
Runtime Error
2208
116740
686
N = int(input()) xy = [map(int, input().split()) for s in range(N)] x, y = [list(i) for i in zip(*xy)] if max(x) == min(x): ans = abs(max(y) - min(y)) elif max(y) == min(y): ans = abs(max(x) -min(x)) else: list = [] l_a = [i for i, j in enumerate(x) if j == max(x)] l_b = [i for i, j in enumerate(x...
s366189554
p02556
u879921371
1600028488
Python
Python (3.8.2)
py
Runtime Error
686
48100
1269
from math import sqrt from functools import reduce def convex_hull_graham(points): TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0) # def cmp(a, b): # return (a > b) - (a < b) def turn(p, q, r): a=(q[0] - p[0])*(r[1] - p[1]) - (r[0] - p[0])*(q[1] - p[1]) (a > b) - (a < b) def _keep_left(hull, r): w...
s774466355
p02556
u543016260
1600028462
Python
Python (3.8.2)
py
Runtime Error
26
8992
9
2 1 1 1 1
s002583287
p02556
u408325839
1600028454
Python
Python (3.8.2)
py
Runtime Error
27
9040
176
N = int(input()) v = [list(map(input().split)) for i in range(N)] v.sort(key = lambda x:abs(x[0]) + abs(x[1])) d = abs(v[0][0] - v[N-1][0]) + abs(v[0][1] - v[N-1][1]) print(d)
s006211452
p02556
u354804355
1600028420
Python
Python (3.8.2)
py
Runtime Error
593
66520
307
#ABC178 E import numpy as np n = int(input()) l = [list(map(int, input().split())) for l in range(n)] list = np.array(l) #print(list) all_diffs = np.expand_dims(list, axis=1) - np.expand_dims(list, axis=0) #print(all_diffs) distance = np.sum(abs(all_diffs), axis=-1) #print(distance) print(np.max(distance))
s101810856
p02556
u068862829
1600028375
Python
Python (3.8.2)
py
Runtime Error
425
9248
529
N = int(input()) x1, y1 = map(int, input().split()) x2, y2 = map(int, input().split()) if x1+y1 > x2+y2: xmax = x1+y1 xmin = x2+y2 else: max1 = x2+y2 min1 = x1+y1 if x1-y1 > x2-y2: max2 = x1-y1 min2 = x2-y2 else: max2 = x2-y2 min2 = x1-y1 for i in range(N-2): x, y = map(int, input(...
s521206177
p02556
u411923565
1600028360
Python
Python (3.8.2)
py
Runtime Error
417
32864
331
import bisect N = int(input()) X = [] Y = [] for _ in range(N): x,y = map(int,input().split()) X.append(x) Y.append(y) sumxy = [x+y for x,y in zip(X,Y)] maxidx = bisect.bisect_left(sumxy,max(sumxy)) minidx = bisect.bisect_left(sumxy,min(sumxy)) ans = abs(X[maxidx] - X[minidx]) + abs(Y[maxidx] - Y[minidx])...
s889840005
p02556
u770293614
1600028352
Python
Python (3.8.2)
py
Runtime Error
660
96268
230
N=int(input()) arr=[] for i in range(N): arr.append((map(int,input().split(' ')))) most=0 for j in range(len(arr)): for k in range(i,len(arr)): x1,y1,x2,y2=arr[j],arr[k] most=max(most,(abs(x1-x2)+abs(y1-y2))) print(most)
s488331960
p02556
u367319568
1600028337
Python
Python (3.8.2)
py
Runtime Error
26
8960
355
N = int(input()) Xmax = -2*10**9 Ymax = -2*10**9 Xmin = 2*10**9 Ymin = 2*10**9 for i in range(N): x, y = map(int, input().split()) if (x + y >= Xmax): Xmax = x + y if (x + y =< Xmin): Xmin = x + y if (x - y >= Ymax): Ymax = x - y if (x - y =< Ymin): Ymin = x - y p...
s777515228
p02556
u770293614
1600028306
Python
Python (3.8.2)
py
Runtime Error
25
9188
229
N=int(input()) arr=[] for i in range(): arr.append((map(int,input().split(' ')))) most=0 for j in range(len(arr)): for k in range(i,len(arr)): x1,y1,x2,y2=arr[j],arr[k] most=max(most,(abs(x1-x2)+abs(y1-y2))) print(most)
s003212312
p02556
u060793972
1600028242
Python
PyPy3 (7.3.0)
py
Runtime Error
338
88752
302
n=int(input()) l1=[] l2=[] for i in range(n): a,b=map(int,input().split()) if a==b: l1.append(a+b) l2.append(a+b) elif a>b: l1.append(a+b) else: l2.append(a+b) l1.sort() l2.sort() a,b,c,d=l1[0],l1[-1],l2[0],l2[-1] print(abs(max(a-c,a-d,b-c,b-d,key=abs)))
s776609790
p02556
u770293614
1600028238
Python
Python (3.8.2)
py
Runtime Error
25
8936
291
def mahattan([x1,y1],[x2,y2]): return (abs(x1-x2)+abs(y1-y2)) N=int(input()) arr=[] for i in range(): arr.append((map(int,input().split(' ')))) most=0 for j in range(len(arr)): for k in range(i,len(arr)): x1,y1,x2,y2=arr[j],arr[k] most=max(most,mahattan(arr[j],arr[k])) print(most)
s545504837
p02556
u926266624
1600028204
Python
Python (3.8.2)
py
Runtime Error
27
8944
625
N = int(input()) ListN = [[0 for i in range(2)] for j in range(N)] for i in range (N): x, y, = map(int, input().split()) ListN[i] = [x,y] m = 0 minN = ListN[0][0] + ListN[0][1] maxN = ListN[0][0] + ListN[0][1] for i in range (len(ListN)-1): flg = False if minN >= ListN[i][0] + ListN[i]...
s695521062
p02556
u989074104
1600028190
Python
Python (3.8.2)
py
Runtime Error
4532
225636
593
s=int(input()) li=[] row=[] col=[] for i in range(s): x,y = map(int,input().split()) row.append(x) col.append(y) li.append([x,y]) row.sort() col.sort() print(li) def max_seek(row,col,li): print("row",row) if (([row[-1],col[-1]] in li) and ([row[0],low[0]] in li)) or (([row[0],col[-1]] in li) and ([row[-...
s218322420
p02556
u923662841
1600028164
Python
Python (3.8.2)
py
Runtime Error
625
59864
319
import numpy as np N = int(input()) xy = list() for i in range(N): x,y = map(int,input().split()) xy.append([x,y]) XY = np.array(xy) dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0) dis = np.sum(dif, axis=-1) idx = np.unravel_index(np.argmax(dis),dis.shape) #print(dis) #print(idx) print(dis[idx])
s684889332
p02556
u327498205
1600028121
Python
PyPy2 (7.3.0)
py
Runtime Error
87
64396
235
N = int(input()) X = [list(map(int, input().split())) for i in range(N)] M = 0 for i in range(N): for l in range(i): temp = abs(X[i][0] - X[l][0]) + abs(X[i][1] - X[l][1]) if M <= temp: M = temp print(M)
s198552716
p02556
u770293614
1600028109
Python
Python (3.8.2)
py
Runtime Error
32
8992
265
def mahattan([x1,y1],[x2,y2]): return (abs(x1-x2)+abs(y1-y2)) N=int(input()) arr=[] for i in range(): arr.append([map(int,input().split(' '))]) most=0 for j in range(len(arr)): for k in range(i,len(arr)): most=max(most,mahattan(arr[j],arr[k])) print(most)
s620065325
p02556
u163971674
1600028024
Python
Python (3.8.2)
py
Runtime Error
2207
76980
305
n=int(input()) x=[] for i in range(n): a,b=map(int,input().split(" ")) x.append([a,b]) x=list(map(list, set(map(tuple, x)))) if len(x)==1: print(0) else: ans=0 for i in range(n): for j in range(n): y=abs(x[i][0]-x[j][0])+abs(x[i][1]-x[j][1]) if ans<y: ans=y print(ans)
s619960712
p02556
u273914730
1600028020
Python
Python (3.8.2)
py
Runtime Error
869
113540
255
N=int(input()) xy=[map(int,input().split()) for _ in range(N)] x,y=[list(j) for j in zip(xy)] m=0 for k in range(0,len(x)-1): for l in range(k,len(y)): if abs(x[k]-x[l])+abs(y[k]-y[l])>m: m=abs(x[k]-x[l])+abs(y[k]-y[l]) print(m)
s820615983
p02556
u398511319
1600027965
Python
Python (3.8.2)
py
Runtime Error
414
80844
304
import numpy as np import sys dins=sys.stdin.readlines() data=np.array([ [ int(r) for r in ln.split(' ') if r != '' ] for ln in dins[1:]]) d0=data d1=data dists=[] while d0.shape[0] > 0: d0=d0[1:] d1=d1[:-1] dists=np.concatenate([dists,abs(x[i]-x[j])+abs(y[i]-y[j])]) print(dists.max())
s770686193
p02556
u933929042
1600027956
Python
PyPy3 (7.3.0)
py
Runtime Error
98
74744
628
import numpy as np def dist(d1, d2): return abs(d1[0]-d2[0]) + abs(d1[1]-d2[1]) n = int(input()) list1 = np.zeros((n)) list2 = np.zeros((n)) xy_list = [] for i in range(n): x, y = map(int, input().split()) xy_list.append([x, y]) list1[i] = x+y list2[i] = x-y num = np.zeros((4), dtype=int) num[0] ...
s482618352
p02556
u372802746
1600027946
Python
Python (3.8.2)
py
Runtime Error
34
12048
223
N = int(input()) x = [0] * N y = [0] * N z = [0] * (N*N) for i in range(N): x[i], y[i] = map(int, input().split()) for i in range(0,(int((1/2)*N*(N+1)-1))): z[i]=abs(x[i//N]-x[i%N])+abs(y[i//N]-y[i%N]) print(max(z))
s291469326
p02556
u245375581
1600027833
Python
Python (3.8.2)
py
Runtime Error
28
9068
610
import sys #def input(): #return sys.stdin.readline()[:-1] import numpy as np N = int(input()) x=[0]*N y=[0]*N add=[0]*N for i in range(N): xy=list(map(int,input().split())) x[i]=xy[0] y[i]=xy[1] add=x[i]+y[i] add=np.array(add) index_list=np.argsort(add) print(int(abs(x[index_list[0]-x[index_list[N-...
s705713202
p02556
u245375581
1600027791
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74548
610
import sys #def input(): #return sys.stdin.readline()[:-1] import numpy as np N = int(input()) x=[0]*N y=[0]*N add=[0]*N for i in range(N): xy=list(map(int,input().split())) x[i]=xy[0] y[i]=xy[1] add=x[i]+y[i] add=np.array(add) index_list=np.argsort(add) print(int(abs(x[index_list[0]-x[index_list[N-...
s900516923
p02556
u260204064
1600027791
Python
Python (3.8.2)
py
Runtime Error
379
9144
259
n = int(input()) min = 10000000000 max = -10000000000 for _ in range(n): x, y = map(int,input().split()) if x+y < min: l = [x,y] min = x+y elif x+y > max: r = [x,y] max = x+y print(abs(l[0]-r[0]) + abs(r[1]-l[1]))
s610544705
p02556
u813297429
1600027732
Python
Python (3.8.2)
py
Runtime Error
24
9124
366
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) if n%2==0: mid = n//2-1 else: mid = n//2 if sorted(list(set(b)))==sorted(list(set(a))): if b[mid+1:] + b[:mid+1] != a: print('Yes') print(" ".join(map(str,b[mid+1:] + b[:mid+1]))) else: print(...
s728981931
p02556
u469254913
1600027667
Python
Python (3.8.2)
py
Runtime Error
370
66544
420
import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N = int(input()) xy = [list(map(int,input().split())) for i in range(N)] xy = np.array(xy) diffs = np.expand_dims(xy,axis=1) - np.expand_dim...
s994517292
p02556
u273914730
1600027652
Python
Python (3.8.2)
py
Runtime Error
25
8704
254
N=int(input()) xy=[map(int,input().split()) for _ in range(N)] x,y=[list(j) for j in zip(xy)] m=0 for k in range(0,len(x)-1): for l in range(k,len(y)) if abs(x[k]-x[l])+abs(y[k]-y[l])>m: m=abs(x[k]-x[l])+abs(y[k]-y[l]) print(m)
s175870189
p02556
u273914730
1600027602
Python
Python (3.8.2)
py
Runtime Error
29
8936
255
N=int(input()) xy=[map(int,input().split()) for _ in range(N)] x,y=[list(j) for j in zip(*xy)] m=0 for k in range(0,len(x)-1): for l in range(k,len(y)) if abs(x[k]-x[l])+abs(y[k]-y[l])>m: m=abs(x[k]-x[l])+abs(y[k]-y[l]) print(m)
s411393001
p02556
u095424182
1600027506
Python
Python (3.8.2)
py
Runtime Error
648
78868
399
def dist(a,b): return sqrt((a[0]-b[0])**2+(a[1]-b[1])**2) import numpy as np if __name__=="__main__": n=int(input()) l=[] for _ in range(n): l.append([int(i) for i in input().split()]) l=list(np.unique(np.array(l))) l.sort() if len(l)==1: print(0) exit n=len(l) ans=[] for i in range(n): ...
s276897051
p02556
u244416763
1600027330
Python
Python (3.8.2)
py
Runtime Error
662
54780
359
n = int(input()) x = [0 for _ in range(n)] for i in range(n): x[i] = list(map(int, input().split())) xx = sum([i[0] for i in x])/n yy = sum([i[1] for i in x])/n for i in x: i.append(abs(xx-i[0]) + abs(yy-i[1])) x.sort(key = lambda s:s[2]) ans = 0 for i in range(1, min(6, n)): ans = max(ans, abs(x[-i][0] - i...
s148742468
p02556
u633467553
1600027326
Python
Python (3.8.2)
py
Runtime Error
404
25000
855
n = int(input()) xlis = [0] ylis = [0] for _ in range(n): x, y = map(int, input().split()) xlis.append(x) ylis.append(y) if (xlis[2]-xlis[1]) + (ylis[2]-ylis[1]) >= 0: defa1 = 1 defa2 = 2 elif (xlis[2]-xlis[1]) + (ylis[2]-ylis[1]) <= 0: defa1 = 2 defa2 = 1 def checkplace(defalt1, defalt2, n...
s500024424
p02556
u665452497
1600027145
Python
Python (3.8.2)
py
Runtime Error
568
66556
241
import numpy as np N=int(input()) cities = np.array([list(map(int,input().split())) for _ in range(N)]) all_diffs = np.expand_dims(cities, axis=1) - np.expand_dims(cities, axis=0) dist = np.sum(np.abs(all_diffs), axis=-1) print(np.max(dist))
s877428489
p02556
u476628920
1600027092
Python
Python (3.8.2)
py
Runtime Error
2206
26696
234
N = int(input()) XY = [] for i in range(N): val = input() if val: XY.append(val) c = 0 for i in range(N): for j in range(i+1,N): c = max(c,abs(int(XY[i][0])-int(XY[j][0]))+abs(int(XY[i][2])-int(XY[j][0]))) print(c)
s590681446
p02556
u904331908
1600027032
Python
Python (3.8.2)
py
Runtime Error
29
9052
13
3 1 1 2 4 3 2
s719374606
p02556
u012771396
1600026883
Python
PyPy3 (7.3.0)
py
Runtime Error
185
96068
2917
""" こんにちは。これはクシャルです Author : thekushalghosh (クシャル) Team : CodeDiggers I prefer Python language over the C++ language :p :D Visit my website : thekushalghosh.github.io """ import sys,math,cmath,time start_time = time.time() ###########################################################...
s769821205
p02556
u273914730
1600026801
Python
Python (3.8.2)
py
Runtime Error
29
8964
236
xy=[map(int,input().split()) for i in range(0,N-1)] x,y=[list(j) for j in zip(*xy)] m=0 for k in range(0,N-2): for l in range(k,N-1) if abs(x[k]-x[l])+abs(y[k]-y[l])>m: m=abs(x[k]-x[l])+abs(y[k]-y[l]) print(m)
s316283824
p02556
u273914730
1600026772
Python
Python (3.8.2)
py
Runtime Error
26
8976
226
xy=[map(int,input().split()) for i in range(0,N-1)] x,y=[list(j) for j in zip(*xy)] m=0 for k in range(0,N-2): for l in range(k,N-1) if abs(x[k]-x[l])+abs(y[k]-y[l])>m: m=abs(x[k]-x[l])+abs(y[k]-y[l]) print(m)
s549906838
p02556
u091051505
1600026764
Python
Python (3.8.2)
py
Runtime Error
2207
40740
1849
def signed_area(p1, p2, p3): '''符号付き面積を計算 ''' area = (((p2[0] - p1[0]) * (p3[1] - p1[1])) - ((p3[0] - p1[0]) * (p2[1] - p1[1]))) / 2 return area def convex_hull(p_list): '''グラハムの凸包走査 ''' p_sort = [] for i in p_list: p_sort.append(i[0]) # x座標が最小のものをリストの先頭に配置。 min_index = p_so...
s503402321
p02556
u205116974
1600026644
Python
Python (3.8.2)
py
Runtime Error
400
24816
300
def cost(x1,y1,x2,y2): return abs(x1-x2) + abs(y1-y2) n = int(input()) x = [] y = [] for i in range(n): a,b = map(int,input().split()) x.append(a) y.append(b) ans = - math.inf for i in range(n): for j in range(i+1,n): ans = max(ans,cost(x[i],y[i],x[j],y[j])) print(ans)
s575277350
p02556
u193172405
1600026622
Python
Python (3.8.2)
py
Runtime Error
29
9012
284
x = int(input()) points = [] for i in range(x): a = list(map(int, input().split())) points.append(a) d_max = -1 for i in range(x): for j in range(i+1, x): d = abs(points[i][0] - points[j][0]) + abs(points[i][1] - points[j][1]) d_max = max(d, d_max) print(d_max)
s306224947
p02556
u091051505
1600026571
Python
Python (3.8.2)
py
Runtime Error
2206
40648
1871
def signed_area(p1, p2, p3): '''符号付き面積を計算 ''' area = (((p2[0] - p1[0]) * (p3[1] - p1[1])) - ((p3[0] - p1[0]) * (p2[1] - p1[1]))) / 2 return area def convex_hull(p_list): '''グラハムの凸包走査 ''' p_sort = [] for i in p_list: p_sort.append(i[0]) # x座標が最小のものをリストの先頭に配置。 min_index = p_so...
s203307708
p02556
u061835391
1600026545
Python
Python (3.8.2)
py
Runtime Error
28
9204
186
n=int(input()) for i in range(0,n): a,b=int(input()) l.append((a,b)) i=0 while i<n: c=abs(l[i%n][0]-l[(i+1)%n][0])+abs(l[i%n][1]-l[(i+1)%n][1]) w.append(c) i=i+1 print(max(w))
s310689471
p02556
u766236264
1600026485
Python
Python (3.8.2)
py
Runtime Error
25
8980
418
n = input() n = int(n) p = [] for i in range(n): x,y = map(int, input().split(' ')) p.append([x, y]) maXP = max(p, key=lambda x:x[0]) miXP = min(p, key=lambda x:x[0]) maYP = max(p, key=lambda x:x[1]) miYP = min(p, key=lambda x:x[1]) mp = [maXP, miXP, maYP, miYP] md = -1 for i in range(3): for j in range(i+1, 4)...
s004398417
p02556
u328179275
1600026425
Python
Python (3.8.2)
py
Runtime Error
24
9004
336
import numpy as np from numba import jit @jit xy = [map(int, input().split()) for _ in range(n)] x, y = [list(i) for i in zip(*xy)] a=[] b=[] for i in range(len(x)): for j in range(i+1,len(x)): a.append(abs(x[j]-x[i])) b.append(abs(y[j]-y[i])) a_n = np.array(a) b_n = np.array(b) c = a_n+b_n print(c[...
s388512242
p02556
u061835391
1600026424
Python
Python (3.8.2)
py
Runtime Error
27
9220
184
n=int(input()) l=[] for i in range(0,n): a,b=int(input()) l.append((a,b)) i=0 w=[] while i<n: c=abs(l[i][0]-l[i+1][0])+abs(l[i][1]-l[i+1][1]) w.append(c) i=i+2 print(max(w))
s168434748
p02556
u061835391
1600026357
Python
Python (3.8.2)
py
Runtime Error
29
9176
165
n=int(input()) for i in range(0,n): a,b=int(input()) l.append((a,b)) i=0 while i<n: c=abs(l[i][0]-l[i+1][0])+abs(l[i][1]-l[i+1][1]) w.append(c) print(max(w))
s218445263
p02556
u546853743
1600026304
Python
Python (3.8.2)
py
Runtime Error
347
9084
226
n=int(input()) max=0 for i in range(n): x,y=map(int,input().split()) for j in range(n): for k in range(j,n): if (abs(x[j]-x[k])+abs(y[j]-y[k]))>max: max = (abs(x[j]-x[k])+abs(y[j]-y[k])) print(max)
s873935568
p02556
u688839540
1600025890
Python
Python (3.8.2)
py
Runtime Error
25
9116
199
n = int(input()) xy = [list(map(int,input())) for _ in range(n)] max = 0 for xy1 in xy: for xy2 in xy: dis = abs(xy1[0]-xy2[0]) + abs(xy1[1]-xy2[1]) if dis > max: max = dis print(max)
s051851054
p02556
u248364740
1600025833
Python
Python (3.8.2)
py
Runtime Error
2206
49280
495
import itertools n = int(input()) node = {} for i in range(n): x, y = map(int, input().strip().split()) if x in node.keys(): if y < node[x][0]: node[x][0] = y elif y > node[x][1]: node[y][1] = y else: node[x] = [y, y] res = 0 for key1, value1 in node.items()...
s300992297
p02556
u236441175
1600025590
Python
Python (3.8.2)
py
Runtime Error
604
29732
357
n = int(input()) import numpy as np dots = np.zeros((n,2),dtype=np.int) for i in range(n): x,y = input().split() dots[i,:] = int(x),int(y) max_dis=0 x = dots[:,0] y = dots[:,1] x_dis_array = np.abs(x - x[:,np.newaxis]) y_dis_array = np.abs(y - y[:,np.newaxis]) dis_array = x_dis_array + y_dis_array max_dis =...