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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s791421264 | p03805 | u583010173 | 1524642778 | Python | Python (3.4.3) | py | Runtime Error | 62 | 3064 | 480 | # -*- coding: utf-8 -*-
n, m = [int(x) for x in input().split()]
adj = [[0]*m for i in range(m)]
visited = [0]*m
for i in range(m):
a, b = [int(x) for x in input().split()]
adj[a-1][b-1] = 1
adj[b-1][a-1] = 1
ans = 0
def dfs(v):
global ans
if sum(visited) == m:
ans += 1
for i in range(m... |
s302593404 | p03805 | u583010173 | 1524642602 | Python | Python (3.4.3) | py | Runtime Error | 56 | 3064 | 463 | # -*- coding: utf-8 -*-
n, m = [int(x) for x in input().split()]
adj = [[0]*m for i in range(m)]
visited = [0]*m
for i in range(m):
a, b = [int(x) for x in input().split()]
adj[a-1][b-1] = 1
adj[b-1][a-1] = 1
ans = 0
def dfs(v):
global ans
if sum(visited) == m:
ans += 1
for i in range(m... |
s059310216 | p03805 | u136090046 | 1521997036 | Python | Python (3.4.3) | py | Runtime Error | 48 | 3064 | 656 | import sys
n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
if m == 0 or m == 1:
print(1)
sys.exit()
adjacency_list = [[] for x in range(n + 1)]
for i in array:
adjacency_list[i[0]].append(i[1])
adjacency_list[i[1]].append(i[0])
searched = [False for x... |
s474777228 | p03805 | u653005308 | 1521663235 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1013 | n,m=map(int,input().split())
path=[[[0]*n]*n]
for i in range(m):
a,b=map(int,input().split())
path[a][b]=1
path[b][a]=1#隣接グラフを作成
visited=[[0]*n]#どこを通ったか記憶
visited[0]=1#1は最初に通る
def dfs(position,visited,n):#深さ優先探索
all_visited=1
for i in range(n):
if visited[i]==0:
all_visited=0#行った... |
s055026138 | p03805 | u653005308 | 1521663029 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1033 | n,m=map(int,input().split())
path=[[[0]*(n+1)]*(n+1)]
for i in range(m):
a,b=map(int,input().split())
path[a][b]=1
path[b][a]=1#隣接グラフを作成
visited=[[0]*(n+1)]#どこを通ったか記憶
visited[1]=1#1は最初に通る
def dfs(position,visited,n):#深さ優先探索
all_visited=1
for i in range(1,n+1):
if visited[i]==0:
a... |
s139028504 | p03805 | u653005308 | 1521420370 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 691 | def dfs(v,n,visited):#深さ優先探索
all_visited=1#全ての点を通ったか調べる
for i in range(n):
if visited[i]==0:
all_visited=0
if all_visited==1:
return 1
count=0
for i in range(n):
if path[v][i]!=0:
continue
if visited[i]==1:
continue
... |
s879995295 | p03805 | u429843511 | 1521255765 | Python | Python (3.4.3) | py | Runtime Error | 38 | 3064 | 652 | nmax = 8
def dfs(v, N, visited):
all_visited=True
for i in range(N):
if visited[i]==False:
all_visited=False
if all_visited==True:
return 1
ret=0
for i in range(N):
if graph[v][i]==False:
continue
if visited[i]==True:
continue
... |
s673693607 | p03805 | u136090046 | 1521252732 | Python | Python (3.4.3) | py | Runtime Error | 47 | 3064 | 656 | import sys
n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
if m == 0 or m == 1:
print(1)
sys.exit()
adjacency_list = [[] for x in range(m + 1)]
for i in array:
adjacency_list[i[0]].append(i[1])
adjacency_list[i[1]].append(i[0])
searched = [False for x... |
s398385467 | p03805 | u136090046 | 1521252511 | Python | Python (3.4.3) | py | Runtime Error | 49 | 3064 | 645 | import sys
n, m = map(int, input().split())
if m == 0:
print(1)
sys.exit()
array = [[int(x) for x in input().split()] for x in range(m)]
adjacency_list = [[] for x in range(m + 1)]
for i in array:
adjacency_list[i[0]].append(i[1])
adjacency_list[i[1]].append(i[0])
searched = [False for x in range(m... |
s244848467 | p03805 | u136090046 | 1521252342 | Python | Python (3.4.3) | py | Runtime Error | 49 | 3064 | 638 | import sys
sys.setrecursionlimit(100000)
n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
adjacency_list = [[] for x in range(m + 1)]
for i in array:
adjacency_list[i[0]].append(i[1])
adjacency_list[i[1]].append(i[0])
searched = [False for x in range(m+1)]
... |
s750495172 | p03805 | u136090046 | 1521252255 | Python | Python (3.4.3) | py | Runtime Error | 50 | 3064 | 594 | n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
adjacency_list = [[] for x in range(m + 1)]
for i in array:
adjacency_list[i[0]].append(i[1])
adjacency_list[i[1]].append(i[0])
searched = [False for x in range(m+1)]
def calc(start, maze, searched):
res = 0... |
s671305291 | p03805 | u136090046 | 1520202801 | Python | Python (3.4.3) | py | Runtime Error | 43 | 3064 | 772 | import sys
sys.setrecursionlimit(1000000)
def judge(now, edges, searched):
pattern = 0
if searched[now] == "searched":
return 0
searched[now] = "searched"
if searched.count("searched") == len(searched) - 1:
return 1
for next in edges[now]:
pattern += judge(next, edges,... |
s864081975 | p03805 | u136090046 | 1520202704 | Python | Python (3.4.3) | py | Runtime Error | 44 | 3064 | 727 | def judge(now, edges, searched):
pattern = 0
if searched[now] == "searched":
return 0
searched[now] = "searched"
if searched.count("searched") == len(searched) - 1:
return 1
for next in edges[now]:
pattern += judge(next, edges, list(searched))
return pattern
def mai... |
s971961629 | p03805 | u143492911 | 1519357606 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 432 | import numpy as np
n,m=map(int,input().split())
if m==0:
print(0)
exit()
ans=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
ans[a-1].append((b-1))
ans[b-1].append((a-1))
v=[]
def dfs(now,visited=[]):
global v
if len(visited)==n:
v.append([visited])
ret... |
s244131116 | p03805 | u867069435 | 1518485418 | Python | Python (3.4.3) | py | Runtime Error | 163 | 13144 | 454 | import numpy as np
n, m = map(int, input().split())
if m == 0:
print(0)
exit()
r = [[] for i in range(m)]
for i in range(m):
f, s = map(int, input().split())
r[f-1].append(s - 1)
r[s-1].append(f - 1)
ans = []
def dfs(now, visited = []):
global ans
if len(visited) == n:
ans.append([vi... |
s390212401 | p03805 | u867069435 | 1518485374 | Python | Python (3.4.3) | py | Runtime Error | 161 | 13140 | 483 | import numpy as np
n, m = map(int, input().split())
r = [[] for i in range(m)]
for i in range(m):
f, s = map(int, input().split())
r[f-1].append(s - 1)
r[s-1].append(f - 1)
ans = []
def dfs(now, visited = []):
try:
global ans
if len(visited) == n:
ans.append([visited])
... |
s420596562 | p03805 | u867069435 | 1518485249 | Python | Python (3.4.3) | py | Runtime Error | 163 | 13120 | 419 | import numpy as np
n, m = map(int, input().split())
r = [[] for i in range(m)]
for i in range(m):
f, s = map(int, input().split())
r[f-1].append(s - 1)
r[s-1].append(f - 1)
ans = []
def dfs(now, visited = []):
global ans
if len(visited) == n:
ans.append([visited])
return
for j in... |
s182471661 | p03805 | u621935300 | 1513140930 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2940 | 497 | import itertools
import collections
N,M=map(int,raw_input().split())
#print N,M
a=[tuple(map(int,raw_input().split())) for i in range(N)]
#print a
b=list(itertools.combinations(a,N-1))
#print b
#print collections.Counter(b[0])
cnt=0
for i in b:
c=[]
for j,k in i:
#print j,k
c.append(j)
c.append(k)
#print c
... |
s082044547 | p03805 | u839537730 | 1501446983 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 523 | N, M = list(map(int, input().split(" ")))
graph = [list() for i in range(N+1)]
for i in range(M):
a, b = list(map(int, input().split(" ")))
graph[a].append(b)
graph[b].append(a)
def DFS(node, prev, visited):
visited.append(node)
if len(visited) == N:
return 1
res = 0
for ... |
s646123245 | p03805 | u839537730 | 1501446929 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 523 | N, M = list(map(int, input().split(" ")))
graph = [list() for i in range(N+1)]
for i in range(M):
a, b = list(map(int, input().split(" ")))
graph[a].append(b)
graph[b].append(a)
def DFS(node, prev, visited):
visited.append(node)
if len(visited) == N:
return 1
res = 0
for ... |
s856309727 | p03805 | u946386741 | 1496241952 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 1188 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(lambda x: int(x) - 1, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0]].append(l[i][1])
lis[l[i][1]].append(l[i][0])
# 隣接行列
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range(M... |
s702828872 | p03805 | u946386741 | 1496105287 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1191 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(int, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0] - 1].append(l[i][1])
lis[l[i][1] - 1].append(l[i][0])
# 隣接行列
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range(M):
# ... |
s237668979 | p03805 | u946386741 | 1496105226 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1190 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(int, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0] - 1].append(l[i][1])
lis[l[i][1] - 1].append(l[i][0])
# 隣接行列
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range(M):
# ... |
s527979494 | p03805 | u946386741 | 1496105145 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1200 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(int, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0] - 1].append(l[i][1])
lis[l[i][1] - 1].append(l[i][0])
print(lis)
# 隣接行列
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range... |
s784866310 | p03805 | u946386741 | 1496105074 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1201 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(int, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0] - 1].append(l[i][1])
lis[l[i][1] - 1].append(l[i][0])
print(lis)
# 隣接行列
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range... |
s043035655 | p03805 | u946386741 | 1496104939 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1168 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(int, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0] - 1].append(l[i][1])
lis[l[i][1] - 1].append(l[i][0])
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range(M):
# tmp_n, t... |
s669963903 | p03805 | u946386741 | 1496104635 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1192 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(int, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0] - 1].append(l[i][1])
if l[i][1] == N:
lis[l[i][1] - 1].append(l[i][0])
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in... |
s776108862 | p03805 | u946386741 | 1496104328 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 896 | N, M = map(int, input().split())
l = []
for i in range(N):
l.append(list(map(int, input().split())))
lis = [[] for i in range(N)]
for i in range(N):
lis[l[i][0] - 1].append(l[i][1])
if l[i][1] == N:
lis[l[i][1] - 1].append(l[i][0])
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i i... |
s899036268 | p03805 | u820351940 | 1495428004 | Python | Python (3.4.3) | py | Runtime Error | 42 | 5236 | 653 | n, m = map(int, input().split())
ab = [list(map(int, input().split())) for x in range(m)]
abmap = {}
for a, b in ab:
atarget = abmap.get(a)
if atarget == None:
abmap[a] = []
abmap[a].append(b)
btarget = abmap.get(b)
if btarget == None:
abmap[b] = []
abmap[b].append(a)
que = [[... |
s202737357 | p03805 | u556160473 | 1491095550 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 418 | n,m = map(int,input().split(' '))
bar = [[] for _ in range(m)]
for i in range(n):
a,b = map(lambda x:int(x)-1,input().split(' '))
bar[a].append(b)
bar[b].append(a)
result = 0
def search(root=[0]):
global result
if len(root) >= n:
result += 1
return
nxt = set(bar[root[-1]])
... |
s714900718 | p03805 | u556160473 | 1491095472 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 403 | n,m = map(int,input().split(' '))
bar = [[] for _ in range(m)]
for i in range(n):
a,b = map(lambda x:int(x)-1,input().split(' '))
bar[a].append(b)
bar[b].append(a)
result = 0
def search(root=[0]):
global result
if len(root) >= n:
result += 1
nxt = set(bar[root[-1]])
nxt = nxt -... |
s243644626 | p03805 | u451987205 | 1489883992 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2696 | 573 | num = list(map(int,raw_input().split()))
point = num[0]
line = num[1]
d = {}
for i in range (point):
d[i+1] = []
for i in range(point):
pair = list(map(int,raw_input().split()))
d[pair[0]].append(pair[1])
d[pair[1]].append(pair[0])
old_list = []
new_list = [[1]]
for i in range (point-1):
old_list =... |
s295419836 | p03805 | u125205981 | 1488423243 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3188 | 595 | import itertools
def path(n):
l = len(n)
i = 0
while i < l - 1:
a = n[i]
b = n[i + 1]
if a < b:
c = (a, b)
else:
c = (b, a)
for m in C:
if m == c:
break
else:
return False
i += 1
re... |
s146658656 | p03805 | u125205981 | 1488423166 | Python | Python (3.4.3) | py | Runtime Error | 34 | 3188 | 608 | import itertools
def path(n):
l = len(n)
i = 0
while i < l - 1:
a = n[i]
b = n[i + 1]
if a < b:
c = (a, b)
else:
c = (b, a)
for m in C:
if m == c:
break
else:
return False
i += 1
re... |
s413951417 | p03805 | u125205981 | 1488422444 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 590 | import itertools
def path(n):
l = len(n)
i = 0
while i < l - 1:
a = n[i]
b = n[i + 1]
if a < b:
c = (a, b)
else:
c = (b, a)
for m in C:
if m == c:
break
else:
return False
i += 1
re... |
s552589374 | p03805 | u526532903 | 1487727998 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 892 | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const i... |
s941987335 | p03805 | u526532903 | 1487727816 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 837 | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const i... |
s247137104 | p03805 | u526532903 | 1487727748 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 825 | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const i... |
s653854792 | p03805 | u252805217 | 1487540045 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 484 | from itertools import permutations as perm
n, m = map(int, input().split())
path = [[False] * n for _ in range(n)]
for i in range(n):
path[i][i] = True
for _ in range(n):
ai, bi = map(int, input().split())
a, b = ai - 1, bi -1
path[a][b] = True
path[b][a] = True
ans = 0
for ps in perm(range(1, n... |
s974104621 | p03805 | u098572984 | 1487206301 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3444 | 1395 | _N,_M=input().split()
N = int(_N)
M = int(_M)
l = []
for i in range(0,M):
_p, _q = input().split()
l.append((int(_p),int(_q)))
_A,_B=zip(l)
A=_A+_B
B=_B+_A
def gen_get_to(_fr):
global A
global B
global nodes
global step
for itr in range(0,len(A)):
if A[itr]==_fr:
if no... |
s071346904 | p03805 | u098572984 | 1487206165 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3444 | 1393 | _N,_M=input().split()
N = int(_N)
M = int(_M)
l = []
for i in range(0,M):
_p, _q = input().split
l.append((int(_p),int(_q)))
_A,_B=zip(l)
A=_A+_B
B=_B+_A
def gen_get_to(_fr):
global A
global B
global nodes
global step
for itr in range(0,len(A)):
if A[itr]==_fr:
if not ... |
s242354167 | p03805 | u098572984 | 1487206031 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1330 | N,M=input().split()
l = []
for i in range(0,M):
l.append(input())
_A,_B=zip(l)
A=_A+_B
B=_B+_A
def gen_get_to(_fr):
global A
global B
global nodes
global step
for itr in range(0,len(A)):
if A[itr]==_fr:
if not B[itr] in nodes[0:step]:
yield B[itr]
def move... |
s434689462 | p03805 | u637175065 | 1486914152 | Python | Python (3.4.3) | py | Runtime Error | 53 | 5420 | 739 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def main():
n,m = LI()
r ... |
s462087390 | p03805 | u425351967 | 1486867303 | Python | Python (3.4.3) | py | Runtime Error | 28 | 3064 | 502 | import itertools
N, M = [int(n) for n in input().split()]
path = [[False for i in range(M)]for j in range(M)]
for i in range(M):
a, b = [int(n)-1 for n in input().split()]
path[a][b] = True
path[b][a] = True
res = 0
for way in itertools.permutations(range(1,N), N-1):
exist = True
if path[0][way[... |
s222264558 | p03805 | u065683101 | 1486867264 | Python | Python (3.4.3) | py | Runtime Error | 51 | 4212 | 572 | def read():
return int(input())
def reads(sep=None):
return list(map(int, input().split(sep)))
def main():
n, m = reads();
g = [set() for _ in range(m)]
for _ in range(m):
a, b = reads()
g[a - 1].add(b - 1)
g[b - 1].add(a - 1)
count = 0
q = [(0, [])]
while ... |
s172128905 | p03806 | u911449886 | 1600606256 | Python | PyPy3 (7.3.0) | py | Runtime Error | 777 | 132380 | 1250 | from copy import deepcopy
def getval():
n,ma,mb = map(int,input().split())
p = [list(map(int,input().split())) for i in range(n)]
return n,ma,mb,p
def main(n,ma,mb,p):
dp = [[[-1 for i in range(401)] for i in range(401)]]
dp[0][0][0] = 0
for i in range(n):
temp = deepcopy(dp[-1])
... |
s715934471 | p03806 | u787059958 | 1600399899 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9032 | 645 | import math
N, Ma, Mb = map(int, input().split())
cost = [[0] * 10 for _ in range(10)]
for _ in range(N):
a, b, c = map(int, input().split())
a -= 1
b -= 1
cost[a][b] = c
min_cost = 10 ** 9 + 7
for k in range(N):
for i in range(N):
for j in range(N):
g = math.gcd(i + 1 + k + 1, ... |
s193798375 | p03806 | u860829879 | 1599623819 | Python | Python (3.8.2) | py | Runtime Error | 710 | 107824 | 1290 | import numpy as np
from numba import njit
@njit
def main(n,ma,mb,abc):
inf=10**5
cost=inf*np.ones((401,401))
maxa=np.sum(np.transpose[abc][0])
maxb=np.sum(np.transpose[abc][1])
left=4*n//8
right=n
cnt=right-left
for i in range(2**cnt):
ta=0
tb=0
tc=0
fo... |
s641199614 | p03806 | u074220993 | 1599245994 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9480 | 581 | N, Ma, Mb = map(int, input().split())
Med = [tuple(map(int, input().split())) for _ in range(N)]
INF = 100000
from collections import defaultdict as dd
dp = [dd(lambda:INF) for _ in range(N+1)]#dp[i,j]:Aがiグラム、Bがjグラムの時の最小予算
for n in range(1,N+1):
a,b,c = Med[n-1]
dp[n-1][0,0] = 0
for (i,j),value in dp[n-1].... |
s704777884 | p03806 | u074220993 | 1599244759 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9236 | 527 | N, Ma, Mb = map(int, input().split())
Med = [tuple(map(int, input().split())) for _ in range(N)]
N *= 100
INF = 100000
dp = [[INF]*N+1 for _ in range(N+1)] #dp[i,j]:Aがiグラム、Bがjグラムの時の最小予算
dp[0][0] = 0
from itertools import product as prd
R = lambda x:reversed(range(x,N+1))
for a,b,c in Med:
for i,j in prd(R(a),R(b))... |
s550617608 | p03806 | u678167152 | 1597408234 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1021 | 76496 | 1238 | from itertools import groupby, accumulate, product, permutations, combinations
def solve():
ans = float('inf')
N, A, B = map(int, input().split())
mae = [list(map(int, input().split())) for _ in range((N+1)//2)]
usiro = [list(map(int, input().split())) for _ in range(N-(N+1)//2)]
if N==1:
a,b,c = mae[0]
... |
s738360026 | p03806 | u678167152 | 1597408198 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1016 | 76332 | 1230 | from itertools import groupby, accumulate, product, permutations, combinations
def solve():
ans = float('inf')
N, A, B = map(int, input().split())
mae = [list(map(int, input().split())) for _ in range((N+1)//2)]
usiro = [list(map(int, input().split())) for _ in range(N-(N+1)//2)]
if N==1:
a,b,c = mae[0]
... |
s952460188 | p03806 | u678167152 | 1597408063 | Python | PyPy3 (7.3.0) | py | Runtime Error | 998 | 76492 | 1146 | from itertools import groupby, accumulate, product, permutations, combinations
def solve():
ans = float('inf')
N, A, B = map(int, input().split())
mae = [list(map(int, input().split())) for _ in range(N//2)]
usiro = [list(map(int, input().split())) for _ in range(N-N//2)]
mae_lis = [[float('inf')]*201 for _ i... |
s708720777 | p03806 | u843175622 | 1597408021 | Python | PyPy3 (7.3.0) | py | Runtime Error | 102 | 68696 | 678 | import numpy as np
n, ma, mb = map(int, input().split())
item = [tuple(map(int, input().split())) for _ in range(n)]
INF = 5000
dp = np.full((n + 1, 444, 444), INF, dtype=np.int)
dp[0][0][0] = 0
for i in range(n):
for j in range(401):
for k in range(401):
a, b, c = item[i]
dp[i +... |
s545450443 | p03806 | u503228842 | 1595363006 | Python | Python (3.8.2) | py | Runtime Error | 76 | 12744 | 793 | N, ma, mb = map(int, input().split())
a = [0]*N
b = [0]*N
c = [0]*N
NMAX = 10
ABMAX = 10
INF = 100000
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
dp = [[[INF]*(NMAX*ABMAX+1)for _ in range(NMAX*ABMAX+1)]for _ in range(N+1)]
dp[0][0][0] = 0
for i in range(N):
for ca in range(NMAX*ABMAX+1):
... |
s223785242 | p03806 | u786020649 | 1595218971 | Python | Python (3.8.2) | py | Runtime Error | 363 | 31916 | 1110 | import sys
import numpy as np
from collections import deque,defaultdict
inp=lambda v,w:v[0]*w[0]+v[1]*w[1]
isprop = lambda a,b: a[0]*b[1]==a[1]*b[0]
cwsum = lambda l:[sum([x[0] for x in l]), sum([x[1] for x in l])]
chmin = lambda a,b:(a,b)[b<a]
# cwsum = lambda l:np.sum(l,axis=0)
def main():
N,Ma,Mb=m... |
s593846309 | p03806 | u786020649 | 1595218746 | Python | Python (3.8.2) | py | Runtime Error | 248 | 29372 | 1110 | import sys
import numpy as np
from collections import deque,defaultdict
inp=lambda v,w:v[0]*w[0]+v[1]*w[1]
isprop = lambda a,b: a[0]*b[1]==a[1]*b[0]
cwsum = lambda l:[sum([x[0] for x in l]), sum([x[1] for x in l])]
chmin = lambda a,b:(a,b)[b<a]
# cwsum = lambda l:np.sum(l,axis=0)
def main():
N,Ma,Mb=m... |
s097984312 | p03806 | u786020649 | 1595218674 | Python | Python (3.8.2) | py | Runtime Error | 118 | 27144 | 1105 | import sys
import numpy as np
from collections import deque,defaultdict
inp=lambda v,w:v[0]*w[0]+v[1]*w[1]
isprop = lambda a,b: a[0]*b[1]==a[1]*b[0]
cwsum = lambda l:[sum([x[0] for x in l]), sum([x[1] for x in l])]
chmin = lambda a,b:(a,b)[b<a]
# cwsum = lambda l:np.sum(l,axis=0)
def main():
N,Ma,Mb=m... |
s373287651 | p03806 | u122743999 | 1593919844 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9164 | 565 | import more_itertools
import math
data = []
part = []
cost = math.inf
n = input()
n = n.split()
N = int(n[0])
Ma = int(n[1])
Mb = int(n[2])
for i in range(N):
part.append(i)
tmp = input()
tmp = tmp.split()
tmp = list(map(int, tmp))
data.append(tmp)
part = more_itertools.powerset(part)
for i in part:... |
s631193967 | p03806 | u506549878 | 1593802477 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 9436 | 660 | k, a, b = map(int, input().split())
item = [list(map(int, input().split())) for i in range(k)]
n = len(item)
cost_list = []
for i in range(2 ** n):
bag = []
for j in range(n): # このループが一番のポイント
if ((i >> j) & 1): # 順に右にシフトさせ最下位bitのチェックを行う
bag.append(item[j]) # フラグが立っていたら bag に果物を詰める
d... |
s209217025 | p03806 | u679390859 | 1592874907 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8924 | 930 | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define BIG 1000007
int min(int a,int b){
if(a<b) return a;
else return b;
}
int main(){
int N,Ma,Mb;
scanf("%d %d %d",&N,&Ma,&Mb);
int a[42],b[42],c[42];
for(int i=0;i<N;i++)
... |
s991793142 | p03806 | u679390859 | 1592873678 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9124 | 379 | N,M = map(int,input().split())
path = [[] for i in range(N)]
for _ in range(M):
a,b = map(int,input().split())
path[a-1].append(b-1)
path[b-1].append(a-1)
vis = [0 for i in range(N)]
cnt = 0
def dfs(now,depth):
global cnt
if depth == N: cnt+=1
for new in path[now]:
if vis[new] == 0:
vis[new] = 1
dfs(ne... |
s065628614 | p03806 | u671861352 | 1591941497 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38384 | 592 | #!python3
LI = lambda: list(map(int, input().split()))
# input
N, Ma, Mb = LI()
ABC = [LI() for _ in range(N)]
INF = 10 ** 5
def main():
w = [[INF] * 401 for _ in range(401)]
w[0][0] = 0
for a, b, c in ABC:
l = w.copy()
for j in range(a, 401):
for k in range(b, 401):
... |
s057427180 | p03806 | u591808161 | 1590954330 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38256 | 839 | import sys
import itertools
import numpy as np
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return np.array(list(map(int, input().split())))
def main():
n, ma, mb = MI()
num = ma / mb
buy = [i for i in range(n)]
mylist = [LI() for i in... |
s897183271 | p03806 | u591808161 | 1590954294 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38512 | 822 | import sys
import itertools
import numpy as np
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return np.array(list(map(int, input().split())))
def main():
n, ma, mb = MI()
num = ma / mb
buy = [i for i in range(n)]
mylist = [LI() for i in... |
s896850114 | p03806 | u591808161 | 1590953973 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 853 | import sys
import itertools
import numpy as np
np_array = np.array
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return np_array(map(int, input().split()))
def main():
n, ma, mb = MI()
num = ma / mb
buy = [i for i in range(n)]
mylist = ... |
s854189784 | p03806 | u703950586 | 1590843175 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 138100 | 1369 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
INF = 10**5
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
n,ma,mb = LI()
med = [LI() for _ in range(n)]
h1 = []
h2 = []
for i in range(2 ** (n//2)):
bit = 1
ta = 0
tb = 0
... |
s624935712 | p03806 | u703950586 | 1590842542 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 136908 | 1305 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
INF = 10**5
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
n,ma,mb = LI()
med = [LI() for _ in range(n)]
h1 = []
h2 = []
for i in range(2 ** (n//2)):
b = 1
ta = 0
tb = 0
... |
s556774115 | p03806 | u703950586 | 1590842388 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 136220 | 1298 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
INF = 10**5
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
n,ma,mb = LI()
med = [LI() for _ in range(n)]
h1 = []
h2 = []
for i in range(2 ** (n//2)):
b = 1
ta = 0
tb = 0
... |
s352826277 | p03806 | u703950586 | 1590842196 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2111 | 137844 | 1246 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
INF = 10**18
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
n,ma,mb = LI()
med = [LI() for _ in range(n)]
h1 = []
h2 = []
for i in range(2 ** (n//2)):
b = 1
ta = 0
tb = 0
... |
s797499419 | p03806 | u932465688 | 1587315074 | Python | PyPy3 (2.4.0) | py | Runtime Error | 226 | 62172 | 750 | n,ma,mb = map(int,input().split())
L = []
sa = 0
sb = 0
for i in range(n):
a,b,c = map(int,input().split())
sa += a
sb += b
L.append([a,b,c])
dp = [[[10000 for i in range(sa+1)] for i in range(sb+1)] for i in range(n+1)]
dp[0][0][0] = 0
for i in range(n):
a = L[i][0]
b = L[i][1]
c = L[i][2]
... |
s791275357 | p03806 | u627600101 | 1587099898 | Python | Python (3.4.3) | py | Runtime Error | 1695 | 4712 | 559 | N,Ma,Mb=map(int,input().split())
a=[0 for k in range(N)]
b=[0 for k in range(N)]
c=[0 for k in range(N)]
for k in range(N):
a[k],b[k],c[k]=map(int,input().split())
Sa=sum(a)
Sb=sum(b)
dp =[[5000 for k in range(Sb+1)]for k in range(Sa+1)]
dp[0][0]=0
for k in range(N):
for j in range(Sa-a[k]+1):
for l in... |
s169804341 | p03806 | u932465688 | 1586873110 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38384 | 874 | n,ma,mb = map(int,input().split())
L = []
for i in range(n):
a,b,c = map(int,input().split())
L.append([a,b,c])
dp = [[10**5]*401 for i in range(401)]
make = [[0,0],[L[0][0],L[0][1]]]
dp[L[0][0]][L[0][1]] = L[0][2]
dp[0][0] = 0
for i in range(1,n):
a = L[i][0]
b = L[i][1]
c = L[i][2]
for j in ra... |
s927864364 | p03806 | u488401358 | 1586481705 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38384 | 924 | from math import gcd
N,ma,mb=map(int,input().split())
med=[]
for i in range(0,N):
a,b,c=map(int,input().split())
med.append((a,b,c))
dp=[[[float("inf") for i in range(0,401)] for j in range(0,401)] for k in range(0,N)]
dp=[[float("inf") for i in range(0,401)] for j in range(0,401)]
for i in range(0,401):
... |
s075136629 | p03806 | u562935282 | 1586319548 | Python | Python (3.4.3) | py | Runtime Error | 72 | 3828 | 787 | def main():
from collections import defaultdict
inf = 100 * 40 + 1
N, Ma, Mb = map(int, input().split())
dp = [inf] * (400 * N * 2 + 10)
# dp[x]:=minimum price
# (b-a)(Mb+Ma)-(b+a)(Mb-Ma)=0を目指す
for _ in range(N):
a, b, p = map(int, input().split())
x = (b - a) * (Mb + Ma)... |
s968188155 | p03806 | u654470292 | 1586151965 | Python | PyPy3 (2.4.0) | py | Runtime Error | 378 | 73688 | 1141 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in... |
s935147326 | p03806 | u107601154 | 1585790988 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3164 | 905 | N,Ma,Mb= (int(x) for x in input().split())
a = [0]*N
b = [0]*N
c = [0]*N
# use = [0]*N
ans = 40*100+1
for i in range (N):
a[i],b[i],c[i] = (int(x) for x in input().split())
# 0ならつかわない1なら使う
A = 0
B = 0
C = 0
def search(N,Ma,Mb,a,b,c,A,B,C):
if (B!= 0 and A/B == Ma/Mb):
return C
if(N==1):
# ... |
s908225473 | p03806 | u107601154 | 1585790860 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 909 | N,Ma,Mb= (int(x) for x in input().split())
a = [0]*N
b = [0]*N
c = [0]*N
# use = [0]*N
ans = 40*100+1
for i in range (N):
a[i],b[i],c[i] = (int(x) for x in input().split())
# 0ならつかわない1なら使う
A = 0
B = 0
C = 0
def search(N,Ma,Mb,a,b,c,A,B,C):
if (B!= 0 and A/B == Ma/Mb):
return C
if(N==1):
# ... |
s620103871 | p03806 | u994521204 | 1584462526 | Python | PyPy3 (2.4.0) | py | Runtime Error | 229 | 80420 | 613 | import sys
input = sys.stdin.buffer.readline
n,ma,mb=map(int,input().split())
ABC=[list(map(int,input().split())) for _ in range(n)]
infi=10**15
dp=[[[infi]*(401) for _ in range(401)]for _ in range(41)]
dp[0][0][0]=0
for i in range(n):
a,b,c=ABC[i]
for j in range(401-a):
for k in range(401-b):
... |
s083538201 | p03806 | u994521204 | 1584462042 | Python | Python (3.4.3) | py | Runtime Error | 160 | 55796 | 718 | n,ma,mb=map(int,input().split())
ABC=[list(map(int,input().split())) for _ in range(n)]
infi=10**15
dp=[[[infi]*(401) for _ in range(401)]for _ in range(41)]
dp[0][0][0]=0
for i in range(n):
a,b,c=ABC[i]
for j in range(401):
for k in range(401):
ni=i+1
nj=j+a
nk=k+b
... |
s706051446 | p03806 | u119226758 | 1584227774 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3184 | 981 | import math
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
MA += a[i]
MB += b[i]
dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0
for it_... |
s393879168 | p03806 | u119226758 | 1584227501 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3184 | 983 | import math
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
MA += a[i]
MB += b[i]
dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0
for it_... |
s950612560 | p03806 | u119226758 | 1584227442 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3184 | 983 | import math
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
MA += a[i]
MB += b[i]
dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0
for it_... |
s197478403 | p03806 | u119226758 | 1584227381 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3184 | 1013 | import math
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
MA += a[i]
MB += b[i]
dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0
for it_... |
s074730363 | p03806 | u119226758 | 1584227210 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1156 | import math
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
MA += a[i]
MB += b[i]
dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0
for it_... |
s105563733 | p03806 | u119226758 | 1584227137 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 1155 | import math
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
MA += a[i]
MB += b[i]
dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0
for it_... |
s875065258 | p03806 | u119226758 | 1583981003 | Python | Python (3.4.3) | py | Runtime Error | 131 | 4084 | 1031 |
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
MA += a[i]
MB += b[i]
dp = [[0 for i in range(MA+1)] for j in range(MB+1)]
src = [[0 for i in range(MA+1)] for j in range(MB+1)]
src[0][0] =... |
s311478211 | p03806 | u353797797 | 1582843613 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 1753 | # 半分全列挙バージョン
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for ... |
s036433514 | p03806 | u644907318 | 1582033166 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 73592 | 1237 | from itertools import combinations
from bisect import bisect_left
N,Ma,Mb = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
if N==1:
if A[0][0]*Mb==A[0][1]*Ma:
print(A[0][2])
else:
print(-1)
else:
A1 = A[:N//2] # N//2
A2 = A[N//2:] # N-N//2
B1 = []
... |
s124760218 | p03806 | u644907318 | 1582032518 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2111 | 157740 | 1004 | from itertools import combinations
from bisect import bisect_left
N,Ma,Mb = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
A1 = A[:N//2] # N//2
A2 = A[N//2:] # N-N//2
B1 = []
for k in range(1,N//2+1):
for x in combinations(range(N//2),k):
cnt1 = 0
cnt2 = 0
... |
s937235151 | p03806 | u223904637 | 1580703336 | Python | Python (3.4.3) | py | Runtime Error | 28 | 10868 | 327 | n,ma,mb=map(int,input().split())
dpn=10**6
dp=[10**6]*dpn
dp[0]=0
for i in range(n):
a,b,c=map(int,input().split())
for j in range(dpn,-1,-1):
if j==0 or dp[j]!=10**6:
dp[j+a*1000+b]=min(dp[j+a*1000+b],dp[j]+c)
ans=10**6
s=1000*ma+mb
p=1
while s*p<10**6:
ans=min(ans,dp[s*p])
p+=1
pri... |
s144028710 | p03806 | u087776048 | 1580498979 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1636 | from math import gcd
import numpy as np
# Y = XU
# X^T * Y = X^T * XU
# U = (X^T * X)^(-1) * X^T * Y
epsilon = 0.001
def get_stdin():
return list(map(int, input().split()))
N, M_a, M_b = get_stdin()
a = []
b = []
c = []
for _ in range(N):
a_i, b_i, c_i = get_stdin()
a.append(a_i)
b.append(b_i... |
s339496041 | p03806 | u296518383 | 1580408072 | Python | PyPy3 (2.4.0) | py | Runtime Error | 187 | 41072 | 696 | import sys
input = sys.stdin.buffer.readline
N, Ma, Mb = map(int, input().split())
ABC = [list(map(int, input().split())) for _ in range(N)]
sumA = sum([ABC[i][0] for i in range(N)])
sumB = sum([ABC[i][1] for i in range(N)])
INF = 10 ** 15
dp = [[INF for j in range(sumA + 1)] for i in range(sumB + 1)]
dp[0][0] = 0
... |
s658287870 | p03806 | u303039933 | 1580398370 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 38384 | 3405 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <st... |
s883166282 | p03806 | u702786238 | 1580307289 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38256 | 905 | N, Ma, Mb = map(int, input().split())
items = []
mas = []
mbs = []
costs = []
for i in range(N):
ma, mb, c = map(int, input().split())
mas.append(ma)
mbs.append(mb)
costs.append(c)
max_cost = 5000
dp = [[[max_cost for k in range(410)] for j in range(410)] for i in range(41)]
for i in range(N):
for j in ran... |
s680730525 | p03806 | u702786238 | 1580304164 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38640 | 443 | import numpy as np
N, Ma, Mb = map(int, input().split())
items = []
for i in range(N):
items.append(list(map(int, input().split())))
items = np.array(items)
import itertools
l = list(itertools.product([False,True], repeat=N))
min_cost = 1000000000000000000
for comb in l[1:]:
idx = np.where(comb)
cost = items... |
s010514741 | p03806 | u702786238 | 1580304132 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38460 | 438 | import numpy as np
N, Ma, Mb = map(int, input().split())
items = []
for i in range(N):
items.append(list(map(int, input().split())))
items = np.array(items)
import itertools
l = list(itertools.product([False,True], repeat=N))
min_cost = 1000000000000000000
for comb in l[1:]:
idx = np.where(comb)
cost = items... |
s404336664 | p03806 | u053699292 | 1580252196 | Python | Python (3.4.3) | py | Runtime Error | 91 | 5340 | 805 | cost_lst = [''] * 100000
def N_n(N):
return int((-1)**(N%2 + 1) * (N + N%2)/2)
def n_N(n):
if n <= 0:
return int((-2) * n)
else:
return int(2 * n - 1)
def UPDATE(n,c):
N = n_N(n)
if cost_lst[N] == '':
cost_lst[N] = c
elif cost_lst[N] > c:
cost_lst[N] = c
return 0
if __name__ == '__main__':
N, Ma, M... |
s708246456 | p03806 | u190086340 | 1580151010 | Python | PyPy3 (2.4.0) | py | Runtime Error | 465 | 86996 | 1077 | import fractions
def args():
N, MA, MB = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(N):
a, b, c = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
# print(N, MA, MB)
# print(A)
# print(B)
# print(C)
ret... |
s019575638 | p03806 | u190086340 | 1580150847 | Python | PyPy3 (2.4.0) | py | Runtime Error | 443 | 84692 | 1060 | import fractions
def args():
N, MA, MB = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(N):
a, b, c = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
# print(N, MA, MB)
# print(A)
# print(B)
# print(C)
return N... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.