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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s566557834 | p03681 | u343437894 | 1499643184 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 261 | n, m = map(int, input().split(" "))
n, m = n, m if n>m else m, n
M=1000000007
def newfact(n):
return (n * newfact(n-1)) % M
if n > m+1:
print(0)
elif n == m:
print((2 * newfact(n) * newfact(m)) % M)
else:
print((newfact(n) * newfact(m)) % M)
|
s560771577 | p03681 | u839537730 | 1498949017 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 357 | MOD = 1000000007
def fractorial(n):
ans = 1
for i in range(n):
ans *= (i+1)
ans = ans % MOD
return ans
N, M = list(map(int, input().split(" ")))
if abs(N - M) > 1:
print("%d"%(0))
elif (N - M) == 0:
print ("%d"%(2*((factorial(N))*(factorial(M)))%MOD))
else :
print ("%d"%(... |
s104434465 | p03681 | u839537730 | 1498948787 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 353 | MOD = 1e+9+7
def fractorial(n):
ans = 1
for i in range(n):
ans *= (i+1)
ans = ans % MOD
return ans
N, M = list(map(int, input().split(" ")))
if abs(N - M) > 1:
print("%d"%(0))
elif (N - M) == 0:
print ("%d"%(2*((factorial(N))*(factorial(M)))%MOD))
else :
print ("%d"%(((fa... |
s694035548 | p03681 | u040380068 | 1498424307 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 167 | inpt = map(int, raw_input().split())
n = inpt[0]
m = inpt[1]
ans = long(0)
if abs(n-m) < 2:
ans = fct(n)*fct(m)
if n == m:
ans = 2 * ans
print ans % 1000000007L |
s634852016 | p03681 | u584459098 | 1498386704 | Python | Python (3.4.3) | py | Runtime Error | 70 | 3896 | 275 | def fact(n):
if n == 0: return 1
return n * fact(n-1)
import sys
sys.setrecursionlimit(1000)
N, M=map(int,input().split())
if(abs(N%1000000007-M%1000000007)>1):
i=0
else:
i=fact(M%1000000007)*fact(N%1000000007)
if(N==M):
i=i*2
ans=i%1000000007
print(ans) |
s891690930 | p03681 | u540307496 | 1498368713 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 322 | N,M = list(map(int,input().split()))
a = 10**9 + 7
def fact(n):
f = 1
for i in range(1,n+1):
f*=i
return f
if(abs(N-M)>1):print(0)
elif(N > M):
f = fact(M)
print(int(N*(f**2)%a))
elif(N < M):
f = fact(N)
print(int(M*(f**2)%a))
elif(N == M):
f = fact(N)
print(int(((f**2)*2)%a... |
s254136614 | p03681 | u540307496 | 1498368656 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 322 | N,M = list(map(int,input().split()))
a = 10**9 + 7
def fact(n):
f = 1
for i in range(1,n+1):
f*=i
return f
if(abs(N-M)>1):print(0)
elif(N > M):
f = fact(M)
print(int(N*(f**2)%a))
elif(N < M):
f = fact(N)
print(int(M*(f**2)%a))
elif(N == M):
f = fact(N)
print(int(((f**2)*2)%a... |
s854020608 | p03681 | u846694620 | 1498363972 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 248 | import math
n, m = map(int, input().split())
diff = abs(n - m)
if diff > 1:
print(0)
elif diff == 1:
print(math.factorial(a) * math.factorial(b) % (10 ** 9 + 7))
else:
print(math.factorial(a) * math.factorial(b) * 2 % (10 ** 9 + 7))
|
s757827492 | p03681 | u120026978 | 1498363385 | Python | Python (3.4.3) | py | Runtime Error | 72 | 3892 | 299 | def factorial(x):
if x == 0:
return 1
return x * factorial(x - 1)
n, m = map(int, input().split())
dif = abs(n - m)
if dif >= 2:
ans = 0
elif dif == 1:
ans = factorial(n) * factorial(m) % (10**9 + 7)
else:
ans = factorial(n) * factorial(m) * 2 % (10**9 + 7)
print(ans) |
s067337069 | p03681 | u120026978 | 1498361898 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3896 | 269 | def fact(x):
if x == 0:
return 1
return x * fact(x - 1)
n, m = map(int, input().split())
dif = abs(n - m)
if dif >= 2:
ans = 0
elif dif == 1:
ans = fact(n) * fact(m) % (10**9 + 7)
else:
ans = fact(n) * fact(m) * 2 % (10**9 + 7)
print(ans) |
s680609245 | p03681 | u768951609 | 1498360050 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 655 | #include <iostream>
#include <cmath>
using namespace std;
int fact(int n){
long int sum=1;
long int X=(int)pow(10,9)+7;
for(long int i=1;i<=n;i++){
sum=(sum*i)%X;
}
return (int)sum;
}
int main(){
long int N,M,a,b;
cin >> N;
cin >> M;
if(N==M){
a=fact(N);
... |
s729635155 | p03681 | u602740328 | 1498358663 | Python | Python (3.4.3) | py | Runtime Error | 703 | 5108 | 254 | import math
N, M = map(int, input().split())
if N-M == 0:
n = 2*math.factorial(N)*math.factorial(M)
n %= int(7+1e9)
print(n)
elif abs(N-Mi) == 1:
n = math.factorial(N)*math.factorial(M)
n %= int(7+1e9)
print(n)
else:
print(0) |
s795035898 | p03681 | u768951609 | 1498358169 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 628 | #include <iostream>
#include <cmath>
using namespace std;
int fact(int n){
long int sum=1;
long int X=(int)pow(10,9)+7;
for(long int i=1;i<=n;i++){
sum=(sum*i)%X;
}
return (int)sum;
}
int main(){
long int N,M,a,b;
cin >> N;
cin >> M;
if(N==M){
a=fact(N);
... |
s824303342 | p03681 | u780709476 | 1498356597 | Python | Python (3.4.3) | py | Runtime Error | 72 | 3892 | 289 | def fact(n):
if(n <= 1):
return 1
return fact(n - 1) * n
max = 10 ** 9 + 7
N, M = map((int), input().split() )
if(abs(N - M) > 1):
print(0)
exit()
dog = fact(N)
monkey = fact(M)
if(N == M):
print((2 * dog * monkey) % max)
else:
print((dog * monkey) % max) |
s279108203 | p03681 | u213431796 | 1498355728 | Python | Python (3.4.3) | py | Runtime Error | 80 | 3896 | 222 | n ,m = map(int,input().split(" "))
def kai(x):
if x == 0:
return 1
else:
return x * kai(x-1)
if abs(n - m) > 1:
print(str(0))
else:
print(str(kai(n + m) / (kai(n) * kai(m)) + 2 % (pow(10,9) + 7))) |
s121126815 | p03681 | u145035045 | 1498355618 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3968 | 385 | def kaijou2(num):
return kaijou(num,1)
def kaijou(num,ac):
if (num == 0):
return ac
else:
return kaijou(num - 1,(ac * num) % (10 ** 9 + 7))
[n,m] = list(map(int,input().split()))
x = abs(n - m)
ans = 0
if (x >= 2):
ans = 0
elif (x == 1):
ans = (kaijou2(m) * kaijou2(n)) % (10 ** 9 + 7)
elif (x == 0):
... |
s047207608 | p03682 | u378691508 | 1600729650 | Python | Python (3.8.2) | py | Runtime Error | 344 | 45388 | 453 | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix#, coo_matrix, lil_matrix
N=int(input())
X=[]
Y=[]
for _ in range(N):
x, y = map(int, input().split())
X.append(x)
Y.append(y)
L=np.zeros((N,N))
for i in range(N):
for j in range(N):
p=min(abs(X[i]-X[j])... |
s187243380 | p03682 | u378691508 | 1600728450 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 74788 | 487 | #import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix#, coo_matrix, lil_matrix
N=int(input())
X=[]
Y=[]
for _ in range(N):
x, y = map(int, input().split())
X.append(x)
Y.append(y)
#L=np.zeros((N,N))
L=list([0]*N for _ in range(N))
for i in range(N):
for j i... |
s248618358 | p03682 | u378691508 | 1600728377 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 74764 | 486 | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix#, coo_matrix, lil_matrix
N=int(input())
X=[]
Y=[]
for _ in range(N):
x, y = map(int, input().split())
X.append(x)
Y.append(y)
#L=np.zeros((N,N))
L=list([0]*N for _ in range(N))
for i in range(N):
for j in... |
s524001392 | p03682 | u378691508 | 1600727047 | Python | Python (3.8.2) | py | Runtime Error | 351 | 45524 | 445 | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
N=int(input())
X=[]
Y=[]
for _ in range(N):
x, y = map(int, input().split())
X.append(x)
Y.append(y)
L=np.zeros((N,N))
for i in range(N):
for j in range(N):
p=min(abs(X[i]-X[j]),... |
s696964675 | p03682 | u285358283 | 1600544960 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1450 | 130132 | 956 | class UnionFind:
def __init__(self, n):
self.p = [i for i in range(n)]
self.components = n # 連結成分の数
def root(self, x):
if self.p[x] == x:
return x
else:
self.p[x] = self.root(self.p[x])
return self.p[x]
def unite(self, x, y):
... |
s772907120 | p03682 | u285358283 | 1600544814 | Python | Python (3.8.2) | py | Runtime Error | 1679 | 66856 | 956 | class UnionFind:
def __init__(self, n):
self.p = [i for i in range(n)]
self.components = n # 連結成分の数
def root(self, x):
if self.p[x] == x:
return x
else:
self.p[x] = self.root(self.p[x])
return self.p[x]
def unite(self, x, y):
... |
s387936459 | p03682 | u001769145 | 1597514992 | Python | Python (3.8.2) | py | Runtime Error | 2196 | 655968 | 1481 | import sys
sys.setrecursionlimit(10**9)
N = int(input())
# XY_L = [[int(_) for _ in input().split()] for __ in range(N)]
X_L = [None] * N
Y_L = [None] * N
for i in range(N):
_x, _y = map(int, input().split())
X_L[i] = [_x, i]
Y_L[i] = [_y, i]
class UnionFind():
def __init__(self, n):
self.ran... |
s906642851 | p03682 | u001769145 | 1597465653 | Python | Python (3.8.2) | py | Runtime Error | 1917 | 69748 | 1439 | N = int(input())
# XY_L = [[int(_) for _ in input().split()] for __ in range(N)]
X_L = [None] * N
Y_L = [None] * N
for i in range(N):
_x, _y = map(int, input().split())
X_L[i] = [_x, i]
Y_L[i] = [_y, i]
class UnionFind():
def __init__(self, n):
self.rank = [1] * n
self.par = [int(_) for... |
s909608748 | p03682 | u001769145 | 1597465316 | Python | Python (3.8.2) | py | Runtime Error | 1800 | 69656 | 1439 | N = int(input())
# XY_L = [[int(_) for _ in input().split()] for __ in range(N)]
X_L = [None] * N
Y_L = [None] * N
for i in range(N):
_x, _y = map(int, input().split())
X_L[i] = [_x, i]
Y_L[i] = [_y, i]
class UnionFind():
def __init__(self, n):
self.rank = [1] * n
self.par = [int(_) for... |
s354275989 | p03682 | u869790980 | 1597400793 | Python | PyPy2 (7.3.0) | py | Runtime Error | 2216 | 416860 | 771 | import heapq
n = int(raw_input())
points = [map(int, raw_input().split()) for _ in range(n)]
heap =[]
parent = range(n)
size = [1] * n
cumul = 0
for i in range(len(points)):
for j in range(i + 1, len(points)):
a,b = points[i], points[j]
if min(abs(a[0]- b[0]), abs(a[1] - b[1])) == 0:
pi,pj = get(i, parent)... |
s352974173 | p03682 | u730769327 | 1597239955 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1441 | 121040 | 634 | from heapq import heappop,heappush
n=int(input())
pair=[i for i in range(n)]
que=[]
e=[None]*n
for i in range(n):
x,y=map(int,input().split())
e[i]=(i,x,y)
ex=sorted(e,key=lambda x:x[1])
ey=sorted(e,key=lambda x:x[2])
for i in range(n-1):
w=ex[i+1][1]-ex[i][1]
heappush(que,(w,ex[i][0],ex[i+1][0]))
for i in rang... |
s015385182 | p03682 | u279460955 | 1596776228 | Python | PyPy3 (7.3.0) | py | Runtime Error | 634 | 123072 | 2307 | from operator import itemgetter
class UnionFind: # 0-index
def __init__(self, n):
self.n = n
self.parents = [-1] * n # 親の番号 要素が根の場合は-(そのグループの要素数)を格納
def find(self, x): # 要素xが属するグループの根を返す
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.fi... |
s523863292 | p03682 | u021548497 | 1596654769 | Python | Python (3.8.2) | py | Runtime Error | 344 | 29524 | 1785 | from copy import deepcopy as copy
from operator import itemgetter
class UnionFind:
def __init__(self, n):
self.n = n
self.par = [-1]*(n+1)#それぞれの要素がどの要素の子であるか
def find(self, x):
if self.par[x] < 0:
return x
else:
self.par[x] = self.find(self.par[x])
... |
s954079223 | p03682 | u576432509 | 1596604499 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2224 | 703540 | 1065 | import sys
sys.setrecursionlimit(10**6)
from heapq import heappop, heappush,heapify
icase=0
if icase==0:
n=int(input())
xy=[[0]*2 for i in range(n)]
for i in range(n):
xy[i]=list(map(int,input().split()))
elif icase==1:
n=3
xy=[[1, 5], [3, 9], [7, 8]]
elif icase==2:
n=6
xy=[... |
s562189286 | p03682 | u576432509 | 1596603208 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2219 | 440660 | 954 | import sys
sys.setrecursionlimit(10**6)
from heapq import heappop, heappush
icase=0
if icase==0:
n=int(input())
xy=[[0]*2 for i in range(n)]
for i in range(n):
xy[i]=list(map(int,input().split()))
elif icase==1:
n=3
xy=[[1, 5], [3, 9], [7, 8]]
elif icase==2:
n=6
xy=[[8, 3], ... |
s783791532 | p03682 | u576432509 | 1596602894 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2220 | 495728 | 955 | import sys
sys.setrecursionlimit(10**6)
from heapq import heappop, heappush
icase=0
if icase==0:
n=int(input())
xy=[[0]*2 for i in range(n)]
for i in range(n):
xy[i]=list(map(int,input().split()))
elif icase==1:
n=3
xy=[[1, 5], [3, 9], [7, 8]]
elif icase==2:
n=6
xy=[[8, 3], ... |
s504222471 | p03682 | u761154175 | 1596412076 | Python | PyPy3 (7.3.0) | py | Runtime Error | 99 | 74772 | 824 | import sys
import pprint
sys.path.append('C:\\ARIHON')
from Kraskal import compute_mst_kruskal
import UnionFind
import array
import collections
from operator import itemgetter
Edge = collections.namedtuple("Edge", "start end weight")
def main():
n = int(input())
l = []
for i in range(n):
x,y = m... |
s014029808 | p03682 | u786020649 | 1595877015 | Python | Python (3.8.2) | py | Runtime Error | 981 | 75232 | 1622 | import sys
from collections import defaultdict
finput=lambda:sys.stdin.readline().strip()
class Unionfind():
def __init__(self,n):
self.parents=[-1]*n
self.ranks=[0]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
self.parents[x]=self.find(... |
s872008668 | p03682 | u786020649 | 1595876045 | Python | Python (3.8.2) | py | Runtime Error | 951 | 75648 | 1591 | import sys
from collections import defaultdict
finput=lambda:sys.stdin.readline().strip()
class Unionfind():
def __init__(self,n):
self.parents=[-1]*n
self.ranks=[0]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
self.parents[x]=self.find(... |
s933425712 | p03682 | u786020649 | 1595875083 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9360 | 1595 | import sys
from collections import defaultdict
sys.setrecursionlimit(10**18)
finput=lambda:sys.stdin.readline().strip()
class Unionfind():
def __init__(self,n):
self.parents=[-1]*n
self.ranks=[0]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
... |
s546747947 | p03682 | u786020649 | 1595875057 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9432 | 1599 | import sys
from collections import defaultdict
sys.sys.setrecursionlimit(10**18)
finput=lambda:sys.stdin.readline().strip()
class Unionfind():
def __init__(self,n):
self.parents=[-1]*n
self.ranks=[0]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
... |
s173533700 | p03682 | u786020649 | 1595874774 | Python | Python (3.8.2) | py | Runtime Error | 961 | 75548 | 1593 | import sys
from collections import defaultdict
finput=lambda:sys.stdin.readline().strip()
sys.setrecursionlimit(10*9)
class Unionfind():
def __init__(self,n):
self.parents=[-1]*n
self.ranks=[0]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
... |
s579856728 | p03682 | u786020649 | 1595874491 | Python | Python (3.8.2) | py | Runtime Error | 917 | 75676 | 1565 | import sys
from collections import defaultdict
finput=lambda:sys.stdin.readline().strip()
class Unionfind():
def __init__(self,n):
self.parents=[-1]*n
self.ranks=[0]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
self.parents[x]=self.find(s... |
s689595835 | p03682 | u873904588 | 1595364034 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1389 | 268204 | 1328 | # https://atcoder.jp/contests/abc065/tasks/arc076_b
import copy
class UnionFind():
def __init__(self, n):
super().__init__()
self.n = n
self.parents = [i for i in range(n)]
def root(self, x):
if self.parents[x] == x:
return x
else:
self.parents[... |
s699608396 | p03682 | u730769327 | 1594590216 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1706 | 142392 | 658 | from heapq import heappop,heappush
n=int(input())
pair=[i for i in range(n)]
e=[]
que=[]
que1=[]
for i in range(n):
s,t=map(int,input().split())
heappush(e,(s,t))
s,t=heappop(e)
heappush(que1,(t,s,0))
for i in range(n-1):
s1,t1=heappop(e)
heappush(que,(s1-s,i,i+1))
s,t=s1,t1
heappush(que1,(t,s,i+1))
t,s,i=h... |
s555165517 | p03682 | u730769327 | 1594589546 | Python | Python (3.8.2) | py | Runtime Error | 1408 | 46560 | 658 | from heapq import heappop,heappush
n=int(input())
pair=[i for i in range(n)]
e=[]
que=[]
que1=[]
for i in range(n):
s,t=map(int,input().split())
heappush(e,(s,t))
s,t=heappop(e)
heappush(que1,(t,s,0))
for i in range(n-1):
s1,t1=heappop(e)
heappush(que,(s1-s,i,i+1))
s,t=s1,t1
heappush(que1,(t,s,i+1))
t,s,i=h... |
s393234373 | p03682 | u318127926 | 1592883680 | Python | Python (3.8.2) | py | Runtime Error | 929 | 51724 | 912 | n = int(input())
xy = []
for i in range(n):
x, y = map(int, input().split())
xy.append((i, x, y))
xx = sorted(xy, key=lambda x:x[1])
yy = sorted(xy, key=lambda x:x[2])
li = []
for i in range(n-1):
li.append((xx[i][0], xx[i+1][0], xx[i+1][1]-xx[i][1]))
li.append((yy[i][0], yy[i+1][0], yy[i+1][2]-yy[i][2]... |
s148550240 | p03682 | u176645218 | 1592870372 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1962 | 155832 | 1086 | #import sys
#input = sys.stdin.readline
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
x,y = zip(*xy)
#import random
#N = 20000
#x = [random.randint(0,0) for i in range(N)]
#y = [random.randint(0,0) for i in range(N)]
class UnionFind:
def __init__(self,nodes):
self.parents = {nod... |
s539371285 | p03682 | u176645218 | 1592866754 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1819 | 153784 | 1208 | import sys
input = sys.stdin.readline
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
class UnionFind:
def __init__(self,nodes):
self.parents = {node : node for node in nodes}
def root(self,x):
if x == self.parents[x]:
return x
else:
rt =... |
s005912015 | p03682 | u748241164 | 1592776833 | Python | Python (3.8.2) | py | Runtime Error | 975 | 50484 | 1371 | class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
# 検索
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
# 併合
def union(... |
s398819652 | p03682 | u594803920 | 1592704469 | Python | PyPy3 (7.3.0) | py | Runtime Error | 110 | 68596 | 1078 | n = int(int, input().split())
machi = []
li_x = []
li_y = []
for i in range(n):
x, y = map(int, input().split())
li_x.append((x, i))
li_y.append((y, i))
machi.append((x, y, i))
li_x.sort()
li_y.sort()
edge = [[] for _ in range(n)]
for i in range(n-1):
edge[li_x[i][1]].append((li_x[i+1][0]-li_x[i][0]... |
s423723977 | p03682 | u612975321 | 1592424842 | Python | Python (3.4.3) | py | Runtime Error | 1093 | 53104 | 647 | from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
n = int(input())
ixy = [[i] + [int(x) for x in input().split()] for i in range(n)]
f = []
t = []
d = []
ixy = sorted(ixy, key=lambda x:(x[1], x[2]))
for i in range(n-1):
j, k = ixy[i][0], ixy[i+1][0]
d.append(ixy[i+1][... |
s193884121 | p03682 | u623687794 | 1592353101 | Python | Python (3.4.3) | py | Runtime Error | 1498 | 51128 | 1151 | n=int(input())
points=[list(map(int,input().split()))+[i] for i in range(n)]
points.sort(key = lambda x:x[1])
edge=[]
for i in range(n-1):
edge.append((points[i][2],points[i+1][2],points[i+1][1]-points[i][1]))
points.sort()
for i in range(n-1):
edge.append((points[i][2],points[i+1][2],points[i+1][0]-points[i][0... |
s960343270 | p03682 | u279493135 | 1591566985 | Python | Python (3.4.3) | py | Runtime Error | 43 | 5332 | 1110 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
fro... |
s095904001 | p03682 | u896741788 | 1591455837 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3192 | 1800 | n=int(input())
l=sorted([list(map(int,input().split()))+[i] for i in range(n)])
xs=[(x,i)for x,y,i in l]
ys=sorted([(x,i)for y,x,i in l])
edges={}
for i in range(1,n):
a,s,d,f=*xs[i-1],*xs[i]
if (s,f)in edges:
edges[(s,f)]=min(edges[(s,f)],abs(a-d))
else:edges[(s,f)]=abs(a-d)
a,s,d,f=*ys[i-1],*y... |
s381969143 | p03682 | u896741788 | 1591455781 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 1800 | n=int(input())
l=sorted([list(map(int,input().split()))+[i] for i in range(n)])
xs=[(x,i)for x,y,i in l]
ys=sorted([(x,i)for y,x,i in l])
edges={}
for i in range(1,n):
a,s,d,f=*xs[i-1],*xs[i]
if (s,f)in edges:
edges[(s,f)]=min(edges[(s,f)],abs(a-d))
else:edges[(s,f)]=abs(a-d)
a,s,d,f=*ys[i-1],*y... |
s004306849 | p03682 | u047796752 | 1591061928 | Python | PyPy3 (2.4.0) | py | Runtime Error | 185 | 38384 | 2120 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
#define int long long
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int N;
vector<P> xi, yi;
vector<T> edges;
struct Unionfind {
vector<int> par, rank;
Unionfind(int n) {
par.r... |
s520090678 | p03682 | u072610327 | 1590462839 | Python | Python (3.4.3) | py | Runtime Error | 286 | 21632 | 1701 | import numpy as np
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self,... |
s716782549 | p03682 | u072610327 | 1590462807 | Python | Python (3.4.3) | py | Runtime Error | 153 | 12328 | 1705 | import numpy as np
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self,... |
s313429416 | p03682 | u480300350 | 1590214938 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1479 | 125224 | 7607 | #!/usr/bin/env python3
import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random # random, uniform, randint,... |
s821341651 | p03682 | u480300350 | 1590214407 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1714 | 131448 | 7813 | #!/usr/bin/env python3
import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random # random, uniform, randint,... |
s361238641 | p03682 | u935558307 | 1588893621 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38384 | 1175 | class UnionFind():
def __init__(self,n):
self.n=n
self.parents = [i for i in range(n+1)]
self.size = [1]*(n+1)
def find(self,x):
if self.parents[x]==x:
return x
else:
self.parents[x]=self.find(self.parents[x])
return self.parents[x]
... |
s865598004 | p03682 | u131638468 | 1588796014 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 68088 | 644 | import heapq
n=int(input())
x=[]
y=[]
for i in range(n):
xx,yy=map(int,input().split())
x.append([xx,i])
y.append([yy,i])
x=sorted(x)
y=sorted(y)
px=[]
py=[]
for i in range(n-1):
px.append([x[i+1][0]-x[i][0],x[i][1],x[i+1][1]])
py.append([y[i+1][0]-y[i][0],y[i][1],y[i+1][1]])
p=px+py
heapq.heapify(p)
r=[i for... |
s778253985 | p03682 | u203843959 | 1588651101 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 93304 | 993 | import heapq
import sys
sys.setrecursionlimit(10**6)
N=int(input())
xylist,yxlist=[],[]
par_list={}
for i in range(N):
x,y=map(int,input().split())
xylist.append((x,y))
yxlist.append((y,x))
par_list[(x,y)]=(x,y)
xylist.sort()
yxlist.sort()
#print(xylist)
hq=[]
for i in range(1,N):
x1,y1=xylist[i-1]
x2,y2... |
s561632496 | p03682 | u075595666 | 1587341628 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1300 | def main:
import sys
input = sys.stdin.readline
import heapq
def prim_heap():
used = [True] * n #True:不使用
edgelist = []
for e in edge[0]:
heapq.heappush(edgelist,e)
used[0] = False
res = 0
while len(edgelist) != 0:
minedge = heapq.heappop(edgelist)
... |
s171933380 | p03682 | u075595666 | 1587340523 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38256 | 1236 | import sys
input = sys.stdin.readline
import heapq
def prim_heap():
used = [True] * n #True:不使用
edgelist = []
for e in edge[0]:
heapq.heappush(edgelist,e)
used[0] = False
res = 0
while len(edgelist) != 0:
minedge = heapq.heappop(edgelist)
if not used[minedge[1]]:
... |
s858978201 | p03682 | u858742833 | 1586916518 | Python | Python (3.4.3) | py | Runtime Error | 1240 | 94276 | 936 | from operator import itemgetter
from scipy.sparse import lil_matrix, csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
def main():
N = int(input())
M = 10**10
XY = [tuple(map(int, input().split())) for _ in range(N)]
xy = [(x, i) for i, (x, _) in enumerate(XY)]
yx = [(y, i) for i, (... |
s328122305 | p03682 | u858742833 | 1586915940 | Python | Python (3.4.3) | py | Runtime Error | 2115 | 95600 | 819 | from scipy.sparse import lil_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
def main():
N = int(input())
M = 10**10
XY = [tuple(map(int, input().split())) for _ in range(N)]
xy = [(x, i) for i, (x, _) in enumerate(XY)]
yx = [(y, i) for i, (_, y) in enumerate(XY)]
xy.sort()
yx... |
s162448427 | p03682 | u547167033 | 1586228769 | Python | Python (3.4.3) | py | Runtime Error | 469 | 55572 | 1295 | from heapq import *
class UnionFind():
def __init__(self,n):
self.n=n
self.parents=[-1]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
self.parents[x]=self.find(self.parents[x])
return self.parents[x]
def unite(self,x,y):
x=self.find(x)
y=self.find(y)
if x==... |
s470610416 | p03682 | u711238850 | 1586034209 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38256 | 512 | def prim(self):
gb = GraphBuilder(self.v,self.directed)
queue = []
for i,w in self.w_e[0].items(): heapq.heappush(queue,(w,0,i))
rest = [True]*self.v
rest[0] = False
v = 1
while len(queue)>0:
w,i,j = heapq.heappop(queue)
if rest[j]:
... |
s256567036 | p03682 | u893063840 | 1585930137 | Python | Python (3.4.3) | py | Runtime Error | 1097 | 73064 | 711 | from operator import itemgetter
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
xyi = [[x, y, i] for i, (x, y) in enumerate(xy)]
row = []
col = []
cost = []
xyi.sort()
for (x1, y1, i1), (x2, y2, i2) i... |
s169502067 | p03682 | u752907966 | 1585770428 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 2109 | #最小全域木 プリム法
from heapq import *
n=int(input())
xy=[]
for i in range(n):
x,y=map(int,input().split())
xy.append([x,y,i])
#今回の問題では,高々xが隣のやつとyが隣のやつを全部考えればよし
#(詳しくは解説pdfより)
x_sort = sorted(xy, key=lambda x: x[0])
y_sort = sorted(xy, key=lambda x: x[1])
cost = [[]for _ in range(n+3)] #cost[i]にはi番目から(j,k)でj番目にコストk... |
s207254724 | p03682 | u731448038 | 1585761223 | Python | Python (3.4.3) | py | Runtime Error | 1275 | 92088 | 698 | import sys
sys.setrecursionlimit(10000)
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [(i, xy[i][0]) for i in range(n)]
y = [(i, xy[i][1]) for i in range(n)]
x.sort(key = lambda x:x[1])
y.sort(key = lambda x:x[1])
x_dif = [((x[i][0], x[i+1][0]), abs(x[i+1][1]-x[i][1])) for i in range... |
s893125737 | p03682 | u731448038 | 1585752372 | Python | Python (3.4.3) | py | Runtime Error | 1274 | 92260 | 714 | import sys
sys.setrecursionlimit(10000)
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [(i, xy[i][0]) for i in range(n)]
y = [(i, xy[i][1]) for i in range(n)]
x.sort(key = lambda x:x[1])
y.sort(key = lambda x:x[1])
x_dif = [((x[i][0], x[i+1][0]), abs(x[i+1][1]-x[i][1])) for i in range... |
s219027226 | p03682 | u731448038 | 1585751960 | Python | Python (3.4.3) | py | Runtime Error | 1276 | 92388 | 738 | import sys
sys.setrecursionlimit(10000)
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [(i, xy[i][0]) for i in range(n)]
y = [(i, xy[i][1]) for i in range(n)]
x.sort(key = lambda x:x[1])
y.sort(key = lambda x:x[1])
x_dif = [((x[i][0], x[i+1][0]), abs(x[i+1][1]-x[i][1])) for i in range... |
s076807718 | p03682 | u731448038 | 1585751741 | Python | Python (3.4.3) | py | Runtime Error | 1280 | 87064 | 696 | n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [(i, xy[i][0]) for i in range(n)]
y = [(i, xy[i][1]) for i in range(n)]
x.sort(key = lambda x:x[1])
y.sort(key = lambda x:x[1])
x_dif = [((x[i][0], x[i+1][0]), abs(x[i+1][1]-x[i][1])) for i in range(n-1)]
y_dif = [((y[i][0], y[i+1][0]), abs... |
s914048867 | p03682 | u731448038 | 1585751623 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2114 | 175320 | 696 | n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [(i, xy[i][0]) for i in range(n)]
y = [(i, xy[i][1]) for i in range(n)]
x.sort(key = lambda x:x[1])
y.sort(key = lambda x:x[1])
x_dif = [((x[i][0], x[i+1][0]), abs(x[i+1][1]-x[i][1])) for i in range(n-1)]
y_dif = [((y[i][0], y[i+1][0]), abs... |
s473196021 | p03682 | u863442865 | 1584623407 | Python | Python (3.4.3) | py | Runtime Error | 164 | 23144 | 1619 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate
#from itertools import product
from bisect import bisect_left,bisect_... |
s206242713 | p03682 | u893063840 | 1584200371 | Python | Python (3.4.3) | py | Runtime Error | 1273 | 80776 | 591 | from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
import numpy as np
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = []
y = []
for i, (ex, ey) in enumerate(xy):
x.append([ex, i])
y.append([ey, i])
x.sort()
y.sort()
u = []
v = []
c = []
... |
s254131227 | p03682 | u893063840 | 1584199693 | Python | Python (3.4.3) | py | Runtime Error | 1341 | 84796 | 560 | from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = []
y = []
for i, (ex, ey) in enumerate(xy):
x.append([ex, i])
y.append([ey, i])
x.sort()
y.sort()
u = []
v = []
c = []
def f(li):
for... |
s389689184 | p03682 | u703950586 | 1583970096 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38256 | 806 | import queue,sys,copy
sys.setrecursionlimit(10**7)
INF = 10**10
N = int(input())
x = [0 for _ in range(N)]
y = [0 for _ in range(N)]
for i in range(N):
x[i], y[i] = map(int,input().split())
ix = [i for i in range(N)]
sort_x_ix = sorted(ix, key=lambda i:x[i])
sort_x = [x[i] for i in sort_x_ix]
sort_y_ix = sorted(ix,... |
s791628087 | p03682 | u703950586 | 1583966076 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38384 | 782 | import queue
INF = 10**10
N = int(input())
x = [0 for _ in range(N)]
y = [0 for _ in range(N)]
for i in range(N):
x[i], y[i] = map(int,input().split())
x_ix = [*range(N)]
y_ix = [*range(N)]
sort_x_ix = sorted(x_ix, key=lambda i:x[i])
sort_x = [x[i] for i in sort_x_ix]
sort_y_ix = sorted(y_ix, key=lambda i:y[i])
sor... |
s833265671 | p03682 | u762420987 | 1583764806 | Python | Python (3.4.3) | py | Runtime Error | 176 | 15768 | 929 | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
inf = float("inf")
N = int(input())
graph = np.full((N, N), inf)
xylist = [tuple([_] + list(map(int, input().split()))) for _ in range(N)]
xylist_xsort = sorted(xylist, key=lambda x: x[1... |
s196701137 | p03682 | u762420987 | 1583764683 | Python | Python (3.4.3) | py | Runtime Error | 269 | 17516 | 845 | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
inf = float("inf")
N = int(input())
graph = np.full((N, N), inf)
xylist = [tuple([_] + list(map(int, input().split()))) for _ in range(N)]
xylist_xsort = sorted(xylist, key=lambda x: x[1... |
s670929171 | p03682 | u762420987 | 1583762849 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 9602 | """
...(ggNMMMMMMMMMNg+...
..(gMH9"^` ?"YMa,
..gMY"! 7Mm.
` ..gM9^ (Ma.` ` ` ` ` ` ` ... |
s239902049 | p03682 | u779455925 | 1582665143 | Python | PyPy3 (2.4.0) | py | Runtime Error | 627 | 72152 | 2028 | #from collections import *
#from itertools import *
#from bisect import *
from heapq import *
#import copy
#N=int(input())
#X,Y=map(int,input().split()))
#S=list(map(int,input().split()))
#S=[list(map(int,input().split())) for i in range(N)]
N=int(input())
Xsort=[]
Ysort=[]
for i in range(N):
X,Y=map(int,input().... |
s348479965 | p03682 | u644907318 | 1580993200 | Python | Python (3.4.3) | py | Runtime Error | 2116 | 191412 | 1919 | from bisect import bisect_left,bisect_right
def find(i):
while i!=T[i][0]:
i = T[i][0]
return i
def union(rt0,rt1):
if T[rt0][1]>=T[rt1][1]:
T[rt1][0] = rt0
T[rt0][1] += T[rt1][1]
return rt0
else:
T[rt0][0] = rt1
T[rt1][1] += T[rt0][1]
return rt1
N... |
s455203515 | p03682 | u644907318 | 1580928255 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 1658 | import ipdb
import heapq
from bisect import bisect_left,bisect_right
INFTY = 10**10
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
A = sorted([(X[i][0],-X[i][1],i) for i in range(N)],key=lambda x:x[1])
A = sorted([(X[i][0],-X[i][1],i) for i in range(N)],key=lambda x:x[0])
B = sorted([(X[i][1],-... |
s693487129 | p03682 | u644907318 | 1580923347 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3192 | 1676 | import heapq
from bisect import bisect_left,bisect_right
INFTY = 10**10
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
A = sorted([(X[i][0],-X[i][1],i) for i in range(N)],key=lambda x:x[1])
A = sorted([(X[i][0],-X[i][1],i) for i in range(N)],key=lambda x:x[0])
B = sorted([(X[i][1],-X[i][0],i) f... |
s506242482 | p03682 | u296518383 | 1579312548 | Python | PyPy3 (2.4.0) | py | Runtime Error | 633 | 60504 | 839 | import heapq
print(1)
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
X = []
Y = []
for x, y in XY:
X.append((x, i + 1))
Y.append((y, i + 1))
X.sort()
Y.sort()
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
x1, a = X[i]
x2, b = X[i + 1]
graph[a].append((abs(x1 -... |
s356541185 | p03682 | u254871849 | 1577100192 | Python | Python (3.4.3) | py | Runtime Error | 296 | 37344 | 844 | import sys
import numpy as np
from scipy.sparse import coo_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
n = int(sys.stdin.readline().rstrip())
xy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2).T
def main():
indices1, indices2 = np.argsort(xy)
res1 = xy[:, indices1]
re... |
s036166061 | p03682 | u254871849 | 1577100021 | Python | Python (3.4.3) | py | Runtime Error | 407 | 42480 | 850 | import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
n = int(sys.stdin.readline().rstrip())
xy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2).T
def main():
indices1, indices2 = np.argsort(xy)
res1 = xy[:, indices1]
re... |
s713204473 | p03682 | u254871849 | 1577099842 | Python | Python (3.4.3) | py | Runtime Error | 536 | 50008 | 854 | import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
n = int(sys.stdin.readline().rstrip())
xy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2)
xy = np.transpose(xy)
def main():
indices1, indices2 = np.argsort(xy)
res1 = xy... |
s513282636 | p03682 | u254871849 | 1577099728 | Python | Python (3.4.3) | py | Runtime Error | 528 | 50156 | 834 | import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
n = int(sys.stdin.readline().rstrip())
xy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2).T
def main():
indices1, indices2 = np.argsort(xy)
res1 = xy[:, indices1]
re... |
s646582346 | p03682 | u254871849 | 1577098646 | Python | Python (3.4.3) | py | Runtime Error | 500 | 50536 | 905 | import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
n = int(sys.stdin.readline().rstrip())
xy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2).T
def main():
indices1, indices2 = np.argsort(xy)
res1 = xy[:, indices1]
r... |
s514536126 | p03682 | u672220554 | 1576856935 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38384 | 692 | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
n=int(input())
l=[]
for i in range(n):
l.append([i]+list(map(int,input().split())))
g = [[0 for j in range(n)]for i in range(n)]
l.sort(key=lambda x: x[1])
for i in range(n-1):
... |
s225656583 | p03682 | u672220554 | 1576856874 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38384 | 631 | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
n=int(input())
l=[]
INF = 10**10
for i in range(n):
l.append([i]+list(map(int,input().split())))
g = [[INF for j in range(n)]for i in range(n)]
l.sort(key=lambda x: x[1])
for i in r... |
s922321899 | p03682 | u945181840 | 1576522280 | Python | Python (3.4.3) | py | Runtime Error | 632 | 50016 | 750 | import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
read = sys.stdin.read
N, *xy = map(int, read().split())
xy = np.array(xy, np.int64).reshape(N, 2)
x = xy[:, 0]
y = xy[:, 1]
town = np.arange(N)
arg_x = np.argsort(x)
arg_y = np.argsort(y)
edges_x ... |
s816815407 | p03682 | u026537738 | 1576116437 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 2571 | #include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;... |
s805366606 | p03682 | u682985065 | 1574445810 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1282 | import heapq
class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(n)]
self.rank = [0] * n
def find(self, x):
if self.parent[x] != x:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def union(self, x, y)... |
s138091712 | p03682 | u233437481 | 1573760717 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2112 | 158928 | 949 | par =[]
N = int(input())
graph = []
for i in range(N):
x, y = [int(s) for s in input().split()]
graph.append((i, x, y))
sort_x = sorted(graph, key=lambda x: x[1])
sort_y = sorted(graph, key=lambda x: x[2])
edges = []
for i in range(len(sort_x)-1):
i1, a, b = sort_x[i]
i2, c, d = sort_x[i+1]
w ... |
s528375698 | p03682 | u233437481 | 1573760626 | Python | Python (3.4.3) | py | Runtime Error | 1339 | 53492 | 949 | par =[]
N = int(input())
graph = []
for i in range(N):
x, y = [int(s) for s in input().split()]
graph.append((i, x, y))
sort_x = sorted(graph, key=lambda x: x[1])
sort_y = sorted(graph, key=lambda x: x[2])
edges = []
for i in range(len(sort_x)-1):
i1, a, b = sort_x[i]
i2, c, d = sort_x[i+1]
w ... |
s884056652 | p03682 | u634461820 | 1571863614 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 40304 | 1440 | import sys
import heapq
import bisect
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
import itertools
import numpy as np
import sys... |
s443785608 | p03682 | u844646164 | 1570330014 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 960 | import itertools
import heapq
from heapq import heappush, heappop
global G
def input_graph(N, xy):
comb_list = list(itertools.combinations(xy, 2))
for i in range(N*(N-1)//2):
a, b = comb_list[i]
an, ax, ay = a
bn, bx, by = b
cost = min(abs(ax-bx), abs(ay-by))
G[an] += [(cost, bn)]
G[bn] +... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.