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
s522289971
p04002
u375616706
1548706029
Python
Python (3.4.3)
py
Runtime Error
3330
1693428
514
H, W, N = map(int, input().split()) mat = [[0]*W for _ in range(H)] for _ in range(N): a, b = map(int, input().split()) mat[a-1][b-1] = 1 dp = [[0]*(W-2) for _ in range(H)] ran = range(W) for h in range(H): for a, b, c in zip(ran, ran[1:], ran[2:]): co = mat[h][a]+mat[h][b]+mat[h][c] dp[h...
s441477800
p04002
u375616706
1548704882
Python
Python (3.4.3)
py
Runtime Error
3326
1693684
653
H, W, N = map(int, input().split()) mat = [[0]*W for _ in range(H)] for _ in range(N): a, b = map(int, input().split()) mat[a-1][b-1] = 1 dp = [[0]*W for _ in range(H)] for h in range(H): cnt = 0 if mat[h][0] == 1: dp[h][0] = 1 for w in range(1, W): if mat[h][w] == 1: ...
s113961647
p04002
u375616706
1548704557
Python
Python (3.4.3)
py
Runtime Error
3330
1693556
653
H, W, N = map(int, input().split()) mat = [[0]*W for _ in range(H)] for _ in range(N): a, b = map(int, input().split()) mat[a-1][b-1] = 1 dp = [[0]*W for _ in range(H)] for h in range(H): cnt = 0 if mat[h][0] == 1: dp[h][0] = 1 for w in range(1, W): if mat[h][w] == 1: ...
s776409646
p04002
u024809932
1541257620
Python
Python (3.4.3)
py
Runtime Error
17
2940
888
#include <iostream> #include <algorithm> #include <vector> #include <unordered_map> using namespace std; int main(void){ long long h,w,n,d=1000000000,c[10]={0}; unordered_map<long long,int> m{}; cin>>h>>w>>n; for(int i=0;i<n;i++){ long long a,b; cin>>a>>b; a--; b--; ...
s403265982
p04002
u691493208
1525653761
Python
Python (3.4.3)
py
Runtime Error
17
2940
1211
#include <bits/stdc++.h> using namespace std; #define int long long #define UNIQUE(v) v.erase(unique(all(v)), v.end()); #define ZIP(v) sort(all(v)),UNIQUE(v) #define repi(i,m,n) for(int i = m;i < n;i++) #define drep(i,n,m) for(int i = n;i >= m;i--) #define rep(i,n) repi(i,0,n) #define rrep(i,n) repi(i,1,n+1) #define ch...
s570824002
p04002
u435281580
1519355726
Python
Python (3.4.3)
py
Runtime Error
310
16624
878
def snuke_coloring(h, w, poses): counts = np.zeros(10, np.int64) searched = {} for pos in poses: for y in range(max(1, pos[0] - 2), min(h - 2, pos[0]) + 1): for x in range(max(1, pos[1] - 2), min(w - 2, pos[1]) + 1): index = (y - 1) * w + (x - 1) if index...
s190720751
p04002
u680619771
1473647110
Python
Python (3.4.3)
py
Runtime Error
40
3064
930
import sys grid = [] painted = [] height, width, n = sys.stdin.readline().strip().split() height, width, n = int(height), int(width), int(n) def checkGrid(x, y, grid): count = 0 for col in range(x, x+3): for row in range(y, y+3): if grid[row][col] == 1: count += 1 retur...
s338119834
p04003
u401686269
1600981992
Python
PyPy3 (7.3.0)
py
Runtime Error
3332
862044
1101
from collections import defaultdict N,M=map(int,input().split()) if M == 0: print(-1) exit() INF = 10**20 pqc = [tuple(map(lambda x:int(x)-1,input().split())) for _ in range(M)] G = defaultdict(dict) lines = [set() for _ in range(N)] for p,q,c in pqc: G[(p,c)][(q,c)] = G[(q,c)][(p,c)] = 0 lines[p].add(c) ...
s972527330
p04003
u401686269
1600981158
Python
Python (3.8.2)
py
Runtime Error
3324
544160
1101
from collections import defaultdict N,M=map(int,input().split()) if M == 0: print(-1) exit() INF = 10**20 pqc = [tuple(map(lambda x:int(x)-1,input().split())) for _ in range(N)] G = defaultdict(dict) lines = [set() for _ in range(N)] for p,q,c in pqc: G[(p,c)][(q,c)] = G[(q,c)][(p,c)] = 0 lines[p].add(c) ...
s372568393
p04003
u183422236
1598275201
Python
PyPy3 (7.3.0)
py
Runtime Error
597
113020
660
import collections n, m = map(int, input().split()) g = [[] for _ in range(n)] for _ in range(m): p, q, c = map(lambda x:int(x) - 1, input().split()) g[p].append((q, c)) g[q].append((p, c)) que = collections.deque() que.append((0, c)) cost = [float("INF")] * n cost[0] = 0 while que: ps, pc = que.popl...
s213911564
p04003
u794173881
1593888534
Python
PyPy3 (7.3.0)
py
Runtime Error
3321
381964
1411
import heapq def dijkstra(): dp[sup_v][0] = 1 q = [(0, sup_v, 0)] # q = [(startからの距離, 現在地)] while q: d, v1, v2 = heapq.heappop(q) if dp[v1][v2] < d: continue for nxt_v1, nxt_v2, cost in graph[v1][v2]: if dp[v1][v2] + cost < dp[nxt_v1][nxt_v2]: ...
s222981535
p04003
u608088992
1592531910
Python
PyPy3 (7.3.0)
py
Runtime Error
90
74628
1895
import heapq import sys from collections import defaultdict input = sys.stdin.readline N, M = map(int, input().split()) Rails = [[] for _ in range(N)] def constant_factory(value): return lambda: value def solve(): Costs = defaultdict(constant_factory(1000000000)) Visited = defaultdict(constant_factory(False)...
s960582771
p04003
u754022296
1591596377
Python
PyPy3 (2.4.0)
py
Runtime Error
1209
154624
678
import sys input = sys.stdin.readline from collections import defaultdict, deque n, m = map(int, input().split()) G = defaultdict(set) seen = set() for _ in range(n): p, q, c = map(int, input().split()) G[(p, c)].add(((q, c), 0)) G[(q, c)].add(((p, c), 0)) G[(p, c)].add(((p, -1), 0)) G[(q, c)].add(((q, -1), ...
s221327608
p04003
u754022296
1591596316
Python
PyPy3 (2.4.0)
py
Runtime Error
1107
154596
667
import sys input = sys.stdin.readline from collections import defaultdict, deque n, m = map(int, input().split()) G = defaultdict(set) seen = set() for _ in range(n): p, q, c = map(int, input().split()) G[(p, c)].add(((q, c), 0)) G[(q, c)].add(((p, c), 0)) G[(p, c)].add(((p, -1), 0)) G[(q, c)].add(((q, -1), ...
s531554204
p04003
u358254559
1587501176
Python
PyPy3 (2.4.0)
py
Runtime Error
179
38768
886
input=sys.stdin.readline from collections import defaultdict from heapq import heappush, heappop,heappushpop,heapify n,m = map(int, input().split()) link = defaultdict(list) chg=10**8 for _ in range(m): p,q,c=map(int, input().split()) link[p].append([p+chg*c,1]) link[p+chg*c].append([p,1]) link[q+chg*c...
s840802680
p04003
u358254559
1587499653
Python
PyPy3 (2.4.0)
py
Runtime Error
183
38640
382
import sys input=sys.stdin.readline n,m = map(int, input().split()) link = defaultdict(list) for _ in range(m): p,q,c=map(int, input().split()) p-=1 q-=1 c-=1 link[(p,-1)].append([(p,c),1]) link[(p,c)].append([(p,-1),1]) link[(p,c)].append([(q,c),0]) link[(q,c)].append([(p,c),0]) lin...
s188482754
p04003
u340781749
1581642555
Python
Python (3.4.3)
py
Runtime Error
1419
175880
1110
import sys from collections import deque, defaultdict def bfs01(s, t, links): q = deque([(0, s, -1)]) # cost, station, last-company visited = set() while q: d, v, e = q.popleft() if v == t: return d if (v, e) in visited: continue visited.add((v, e))...
s096665058
p04003
u619819312
1578629970
Python
Python (3.4.3)
py
Runtime Error
3160
79152
435
n,m=map(int,input().split()) s=[[]for i in range(n+1)] for j in range(m): p,q,c=map(int,input().split()) s[p].append([q,c]) s[q].append([p,c]) l=[0]*(n+1) l[1]=1 d=[[1,0,0]] while not l[-1]: a,b,c=d.pop(0) for i,j in s[a]: if not l[i]: if j==b: l[i]=c ...
s447660829
p04003
u892251744
1570495264
Python
PyPy3 (2.4.0)
py
Runtime Error
1245
99888
1229
from collections import deque, defaultdict import sys input = sys.stdin.readline N, M = map(int, input().split()) adj = [[] for _ in range(N+1)] for _ in range(M): p, q, c = map(int, input().split()) adj[p].append((q, c)) adj[q].append((p, c)) deq = deque() cost = [10 ** 7] * (N+1) seen = [0] * (N+1) prev...
s796089193
p04003
u803848678
1563232721
Python
PyPy3 (2.4.0)
py
Runtime Error
2563
218092
1466
# https://juppy.hatenablog.com/entry/2019/04/10/ARC061_-_E_%E3%81%99%E3%81%AC%E3%81%91%E5%90%9B%E3%81%AE%E5%9C%B0%E4%B8%8B%E9%89%84%E6%97%85%E8%A1%8C_-_Python_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0_Atcoder # 参考にさせていただきました。 from collections import deque, defaultdict chg = 10*...
s743137348
p04003
u729133443
1556966817
Python
PyPy3 (2.4.0)
py
Runtime Error
3168
303136
989
from collections import* from heapq import* def dijkstra(s): d=[inf]*n used=[True]*n d[s]=0 used[s]=False edgelist=[] for e in edge[s]: heappush(edgelist,e) while len(edgelist): minedge=heappop(edgelist) if not used[minedge[1]]: continue v=minedge[1] d[v]=minedge[0] used[v]=F...
s651221053
p04003
u729133443
1556966207
Python
PyPy3 (2.4.0)
py
Runtime Error
3166
289436
995
from collections import* from heapq import* def dijkstra(s): d=[inf]*n used=[True]*n d[s]=0 used[s]=False edgelist=[] for e in edge[s]: heappush(edgelist,e) while len(edgelist): minedge=heappop(edgelist) if not used[minedge[1]]: continue v=minedge[1] d[v]=minedge[0] used[v]=F...
s235624518
p04003
u729133443
1556965875
Python
PyPy3 (2.4.0)
py
Runtime Error
2818
278304
979
from collections import* from heapq import* def dijkstra(s): d=[inf]*n used=[True]*n d[s]=0 used[s]=False edgelist=[] for e in edge[s]: heappush(edgelist,e) while len(edgelist): minedge=heappop(edgelist) if not used[minedge[1]]: continue v=minedge[1] d[v]=minedge[0] used[v]=F...
s650050328
p04003
u729133443
1556965347
Python
PyPy3 (2.4.0)
py
Runtime Error
2160
244268
951
from collections import* from heapq import* def dijkstra(s): d=[inf]*n used=[True]*n d[s]=0 used[s]=False edgelist=[] for e in edge[s]: heappush(edgelist,e) while len(edgelist): minedge=heappop(edgelist) if not used[minedge[1]]: continue v=minedge[1] d[v]=minedge[0] used[v]=F...
s186239633
p04003
u729133443
1556964911
Python
PyPy3 (2.4.0)
py
Runtime Error
2146
246888
931
from collections import* from heapq import* def dijkstra(s): d=[inf]*n used=[True]*n d[s]=0 used[s]=False edgelist=[] for e in edge[s]: heappush(edgelist,e) while len(edgelist): minedge=heappop(edgelist) if not used[minedge[1]]: continue v=minedge[1] d[v]=minedge[0] used[v]=F...
s040526336
p04003
u729133443
1556964641
Python
PyPy3 (2.4.0)
py
Runtime Error
2314
251796
938
from collections import* from heapq import* def dijkstra(s): d=[float('inf')]*n used=[True]*n d[s]=0 used[s]=False edgelist=[] for e in edge[s]: heappush(edgelist,e) while len(edgelist): minedge=heappop(edgelist) if not used[minedge[1]]: continue v=minedge[1] d[v]=minedge[0] ...
s698287477
p04003
u368780724
1553032287
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38384
892
import sys from collections import deque N, M = map(int, input().split()) Edge = [[] for _ in range(N+1)] comp = set() for _ in range(M): p, q, c = map(int, sys.stdin.readline().split()) Edge[p].append((q, c)) Edge[q].append((p, c)) comp.add(c) dist = {(1, 0): 0} Q = deque() Q.append((1, 0)) visited = s...
s446321557
p04003
u368780724
1553031649
Python
Python (3.4.3)
py
Runtime Error
3169
204376
820
import sys from collections import deque N, M = map(int, input().split()) Edge = [[] for _ in range(N+1)] comp = set() for _ in range(M): p, q, c = map(int, sys.stdin.readline().split()) Edge[p].append((q, c)) Edge[q].append((p, c)) comp.add(c) dist = {(1, 0): 0} Q = deque() Q.append((1, 0)) visited = s...
s047606489
p04003
u368780724
1553031616
Python
PyPy3 (2.4.0)
py
Runtime Error
3171
240380
820
import sys from collections import deque N, M = map(int, input().split()) Edge = [[] for _ in range(N+1)] comp = set() for _ in range(M): p, q, c = map(int, sys.stdin.readline().split()) Edge[p].append((q, c)) Edge[q].append((p, c)) comp.add(c) dist = {(1, 0): 0} Q = deque() Q.append((1, 0)) visited = s...
s242660882
p04003
u631277801
1550278944
Python
PyPy3 (2.4.0)
py
Runtime Error
2485
259124
2350
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip(...
s479356914
p04003
u631277801
1550278147
Python
PyPy3 (2.4.0)
py
Runtime Error
2467
185772
2392
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip(...
s063981454
p04003
u631277801
1550277776
Python
PyPy3 (2.4.0)
py
Runtime Error
2070
163056
2584
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip(...
s911821410
p04003
u236127431
1545250339
Python
PyPy3 (2.4.0)
py
Runtime Error
2204
232564
808
from collections import defaultdict,deque import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline N,M=map(int,input().split()) if M==0: print(-1) exit() G=defaultdict(set) for i in range(M): a,b,c=map(int,input().split()) G[a+(c<<30)].add(b+(c<<30)) G[b+(c<<30)].add(a+(c<<30)) G[a].add(a+(c<<30)) ...
s723047080
p04003
u236127431
1545250098
Python
PyPy3 (2.4.0)
py
Runtime Error
2065
232564
779
from collections import defaultdict,deque import sys input=sys.stdin.readline N,M=map(int,input().split()) if M==0: print(-1) exit() G=defaultdict(set) for i in range(M): a,b,c=map(int,input().split()) G[a+(c<<30)].add(b+(c<<30)) G[b+(c<<30)].add(a+(c<<30)) G[a].add(a+(c<<30)) G[b].add(b+(c<<30)) G[a+(c...
s479146398
p04003
u236127431
1545249539
Python
PyPy3 (2.4.0)
py
Runtime Error
1979
216064
761
from collections import defaultdict,deque import sys input=sys.stdin.readline N,M=map(int,input().split()) if M==0: print(-1) exit() G=defaultdict(set) for i in range(M): a,b,c=map(int,input().split()) G[a+c<<30].add(b+c<<30) G[b+c<<30].add(a+c<<30) G[a].add(a+c<<30) G[b].add(b+c<<30) G[a+c<<30].add(a) ...
s753061269
p04003
u236127431
1545245466
Python
PyPy3 (2.4.0)
py
Runtime Error
2774
292460
829
from collections import defaultdict,deque import sys input=sys.stdin.readline N,M=map(int,input().split()) G=defaultdict(set) for i in range(M): a,b,c=map(int,input().split()) G[(a-1,c-1)].add((b-1,c-1)) G[(b-1,c-1)].add((a-1,c-1)) G[(a-1,-1)].add((a-1,c-1)) G[(b-1,-1)].add((b-1,c-1)) G[(a-1,c-1)].add((a-1,...
s443834586
p04003
u236127431
1545240536
Python
PyPy3 (2.4.0)
py
Runtime Error
3171
287852
806
from collections import defaultdict,deque import sys input=sys.stdin.readline N,M=map(int,input().split()) G=defaultdict(set) for i in range(M): a,b,c=map(int,input().split()) G[(a-1,c-1)].add((b-1,c-1)) G[(b-1,c-1)].add((a-1,c-1)) G[(a-1,-1)].add((a-1,c-1)) G[(b-1,-1)].add((b-1,c-1)) G[(a-1,c-1)].add((a-1,...
s858940406
p04003
u075012704
1535465421
Python
PyPy3 (2.4.0)
py
Runtime Error
2834
286504
2166
from collections import defaultdict import heapq N, M = map(int, input().split()) D = {} Edges = [] Edge_dict = {} class UnionFind: def __init__(self, n): self.par = [i for i in range(n)] self.rank = [0] * n # 検索 def find(self, x): if self.par[x] == x: return x ...
s826861239
p04003
u180908266
1529881376
Python
Python (3.4.3)
py
Runtime Error
2463
213896
1566
from collections import deque N, M = map(int, input().split()) if M == 0: print(-1) exit() F_C_of_S = [{} for i in range(N)] # Companies of Station C_of_S = {} # def Union-find parent = {i:i for i in range(M)} def root(x): if x == parent[x]: return x parent[x] = y = root(parent[x]) return ...
s861248931
p04003
u180908266
1529859607
Python
Python (3.4.3)
py
Runtime Error
2554
186312
1802
from collections import deque N, M = map(int, input().split()) F_C_of_S = [{} for i in range(N)] #Companies of Station C_of_S = {} #def Union-find parent = [-1]*M def root(x): if (parent[x] < 0): return x else: parent[x] = y = root(parent[x]) return y def unite(x, y): px = root(x) py = root(y) if (px == py):...
s569342838
p04003
u180908266
1529803596
Python
Python (3.4.3)
py
Runtime Error
1965
125600
1753
from collections import deque N, M = map(int, input().split()) F_C_of_S = [{} for i in range(N)] #Companies of Station C_of_S = {} #def Union-find parent = [-1]*M def root(x): if (parent[x] < 0): return x else: parent[x] = y = root(parent[x]) return y def unite(x, y): px = root(x) py = root(y) if (px == py):...
s293986699
p04003
u180908266
1529717342
Python
Python (3.4.3)
py
Runtime Error
17
2940
692
from heapq import heappop, heappush N,M = map(int, input().split()) edges = [[] for _ in range(N)] cs = set{} for i in range(M): p,q,c = map(int, input().split()) cs += c edges[p-1] += [[q-1, c]] edges[q-1] += [[p-1, c]] c_num = len(cs) distance = [[float('inf')]*(c_num+1) for _ in range(N)] distance[0][0] = 0 min_...
s579180862
p04003
u180908266
1529716680
Python
Python (3.4.3)
py
Runtime Error
3699
1615072
757
from collections import deque N,M = map(int, input().split()) edges = [[] for _ in range(N)] c_max = 0 for i in range(M): p,q,c = map(int, input().split()) c_max = max(c, c_max) edges[p-1] += [[q-1, c]] edges[q-1] += [[p-1, c]] distance = [[float('inf')]*(c_max+1) for _ in range(N)] distance[0][0] = 0 min_distance ...
s277314546
p04003
u180908266
1529716456
Python
Python (3.4.3)
py
Runtime Error
3284
1615080
679
from collections import deque N,M = map(int, input().split()) edges = [[] for _ in range(N)] c_max = 0 for i in range(M): p,q,c = map(int, input().split()) c_max = max(c, c_max) edges[p-1] += [[q-1, c]] edges[q-1] += [[p-1, c]] distance = [[float('inf')]*(c_max+1) for _ in range(N)] distance[0][0] = 0 Q = deque([[0...
s591339347
p04003
u180908266
1529716418
Python
Python (3.4.3)
py
Runtime Error
3380
1873872
675
from collections import deque N,M = map(int, input().split()) edges = [[] for _ in range(N)] c_max = 0 for i in range(M): p,q,c = map(int, input().split()) c_max = max(c, c_max) edges[p-1] += [[q-1, c]] edges[q-1] += [[p-1, c]] distance = [[float('inf')]*(c+1) for _ in range(N)] distance[0][0] = 0 Q = deque([[0,0]]...
s435197331
p04003
u180908266
1529700215
Python
Python (3.4.3)
py
Runtime Error
3170
289676
1157
from collections import deque N,M = map(int, input().split()) if M == 0: print(-1) exit() Q = {0:deque([1])} distance = {1:0} #辺へ重み付け edges = {} for _ in range(M): p,q,c = map(int, input().split()) edge = {} edge[c*10**6+q] = 0 edge[p] = 0 edges.setdefault(c*10**6+p, {}) edges[c*10**6+p].update(edge) edge = {...
s137441303
p04003
u180908266
1529692450
Python
Python (3.4.3)
py
Runtime Error
3170
267120
1175
from collections import deque N,M = map(int, input().split()) if M == 0: print(-1) exit() Q = {0:deque([1])} distance = {1:0} #辺へ重み付け edges = {} for p,q,c in (list(map(int, input().split())) for _ in range(M)): edge = {} edge[c*10**6+q] = 0 edge[p] = 0 edges.setdefault(c*10**6+p, {}) edges[c*10**6+p].upda...
s183394629
p04003
u180908266
1529556723
Python
Python (3.4.3)
py
Runtime Error
3614
2002640
1456
N,M = map(int, input().split()) if M == 0: print(-1) exit() pqcs = [list(map(int, input().split())) for _ in range(M)] c_max = max(list(map(lambda x: x[2],pqcs))) node_num = (c_max+1)*N unsearached_nodes = list(range(node_num))#0~N-1(n-1)が乗換経由ノード/路線iの駅nは3*i+(n-1)番ノード #opt_nodes = [-1]*node_num distance = [float...
s315008567
p04003
u180908266
1529556427
Python
Python (3.4.3)
py
Runtime Error
5656
2002640
1404
N,M = map(int, input().split()) if M == 0: print(-1) exit() pqcs = [list(map(int, input().split())) for _ in range(M)] c_max = max(list(map(lambda x: x[2],pqcs))) node_num = (c_max+1)*N unsearached_nodes = list(range(node_num))#0~N-1(n-1)が乗換経由ノード/路線iの駅nは3*i+(n-1)番ノード #opt_nodes = [-1]*node_num distance = [float...
s556250449
p04003
u180908266
1529556319
Python
Python (3.4.3)
py
Runtime Error
3758
2002900
1412
N,M = map(int, input().split()) """ if M == 0: print(-1) exit() """ pqcs = [list(map(int, input().split())) for _ in range(M)] c_max = max(list(map(lambda x: x[2],pqcs))) node_num = (c_max+1)*N unsearached_nodes = list(range(node_num))#0~N-1(n-1)が乗換経由ノード/路線iの駅nは3*i+(n-1)番ノード #opt_nodes = [-1]*node_num distance ...
s127124546
p04003
u180908266
1529556232
Python
Python (3.4.3)
py
Runtime Error
3705
2002768
1411
N,M = map(int, input().split()) """ if M == 0: print(-1) exit() """ pqcs = [list(map(int, input().split())) for _ in range(M)] c_max = max(list(map(lambda x: x[2],pqcs))) node_num = (c_max+1)*N unsearached_nodes = list(range(node_num))#0~N-1(n-1)が乗換経由ノード/路線iの駅nは3*i+(n-1)番ノード #opt_nodes = [-1]*node_num distance ...
s010712249
p04003
u180908266
1529555497
Python
Python (3.4.3)
py
Runtime Error
4712
2002896
1346
N,M = map(int, input().split()) if M == 0: print(-1) exit() pqcs = [list(map(int, input().split())) for _ in range(M)] c_max = max(list(map(lambda x: x[2],pqcs))) node_num = (c_max+1)*N unsearached_nodes = list(range(node_num))#0~N-1(n-1)が乗換経由ノード/路線iの駅nは3*i+(n-1)番ノード #opt_nodes = [-1]*node_num distance = [float...
s605573397
p04003
u898651494
1520666331
Python
Python (3.4.3)
py
Runtime Error
18
2940
3732
#include <iostream> #include <fstream> #include <string> #include <cmath> #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <functional> using namespace std; using ll = long long; us...
s443598302
p04003
u435281580
1519677926
Python
Python (3.4.3)
py
Runtime Error
3179
307652
573
import numpy as np N, M = map(int, input().split()) routes = np.array([list(map(int, input().split())) for _ in range(M)], 'i') queue = [(1, 0, 0)] dist = np.zeros(N + 1, 'i') dist[:] = 10000 while len(queue) > 0: start, lastm, cost = queue[0] del queue[0] if start == N: print(cost) exit()...
s753859761
p04003
u435281580
1519677032
Python
Python (3.4.3)
py
Runtime Error
3180
331532
462
import numpy as np N, M = map(int, input().split()) routes = np.array([list(map(int, input().split())) for _ in range(M)], 'i') queue = [(1, 0, 0)] while len(queue) > 0: start, lastm, cost = queue[0] del queue[0] if start == N: print(cost) exit() for (f, t, m) in routes[routes[:, 0] =...
s664043234
p04003
u435281580
1519676266
Python
Python (3.4.3)
py
Runtime Error
3163
69444
595
import numpy as np N, M = map(int, input().split()) routes = np.array([list(map(int, input().split())) for _ in range(M)], 'i') # i駅まで到達したときの最小コスト(最終電車がjで示される) dp = [{} for _ in range(N + 1)] dp[1][0] = 0 for i in range(2, N + 1): for (f, t, m) in routes[routes[:, 1] == i]: if m in dp[f]: dp[...
s852151449
p04003
u435281580
1519674454
Python
Python (3.4.3)
py
Runtime Error
3189
1600312
584
import numpy as np N, M = map(int, input().split()) routes = np.array([list(map(int, input().split())) for _ in range(M)], 'i') #print(routes) # i駅まで到達したときの最小コスト(最終電車がjで示される) dp = np.zeros((N + 1, M + 1), 'i') dp[:, :] = 10000 dp[1, 0] = 0 for i in range(2, N + 1): for (f, t, m) in routes: if t != i: ...
s754363807
p04003
u435281580
1519674408
Python
Python (3.4.3)
py
Runtime Error
3182
1600344
583
import numpy as np N, M = map(int, input().split()) routes = np.array([list(map(int, input().split())) for _ in range(M)], 'i') print(routes) # i駅まで到達したときの最小コスト(最終電車がjで示される) dp = np.zeros((N + 1, M + 1), 'i') dp[:, :] = 10000 dp[1, 0] = 0 for i in range(2, N + 1): for (f, t, m) in routes: if t != i: ...
s774543354
p04004
u100858029
1562436209
Python
Python (3.4.3)
py
Runtime Error
17
2940
1045
#include<iostream> #define MOD 1000000007 #define N 1000 using namespace std; typedef long long LL; LL mod_pow(LL base, LL exp) { if(exp==0) return 1; if(exp&1) return (mod_pow(base,exp-1)*base)%MOD; else return mod_pow((base*base)%MOD,exp/2); } LL fac[3*N+1]; LL fac_inv[3*N+1]; LL C(LL n, LL k) { if(k < 0 || n < k...
s034516980
p04004
u089230684
1538857794
Python
Python (3.4.3)
py
Runtime Error
3156
3188
383
mod=int(1E9+7) JS=[1] for i in range(1,5000): JS.append(JS[-1]*i%mod) Cs=lambda x,y:js(x)*inv(js(y))*inv(js(x-y))%mod inv =lambda x:pow(x,mod-2,mod) js=lambda x:JS[x] #while True: A,B,C=map(int,input().split()) A-=1;B+=1;C+=1; ans=0 for x in range(1,B+1): for y in range(1,C+1): ans+=Cs(A+B-x+C-y,A)*Cs(B...
s874727383
p04004
u863370423
1538857702
Python
Python (3.4.3)
py
Runtime Error
3156
3188
383
mod=int(1E9+7) JS=[1] for i in range(1,4000): JS.append(JS[-1]*i%mod) Cs=lambda x,y:js(x)*inv(js(y))*inv(js(x-y))%mod inv =lambda x:pow(x,mod-2,mod) js=lambda x:JS[x] #while True: A,B,C=map(int,input().split()) A-=1;B+=1;C+=1; ans=0 for x in range(1,B+1): for y in range(1,C+1): ans+=Cs(A+B-x+C-y,A)*Cs(B...
s952328387
p04005
u468972478
1599785033
Python
Python (3.8.2)
py
Runtime Error
26
9100
124
s = sorted(list(map(int, input().split()))) a = s.pop(-1) b,c = a // 2, a - (a//2) d = s[0] * a[1] print(abs(d * b - d * c))
s442961607
p04005
u547537397
1593489059
Python
Python (3.8.2)
py
Runtime Error
30
9044
252
import sys input = sys.stdin.readline def linput(ty=int, cvt=list): return cvt(map(ty,input().split())) def gcd(a: int, b: int): while b: a, b = b, a%b return a def lcm(a: int, b: int): return a * b // gcd(a, b) def main(): #n=int(input())
s714040157
p04005
u131453093
1593376777
Python
Python (3.8.2)
py
Runtime Error
29
9032
197
A, B, C = map(int, input().split()) if any(i % 2 == 0 for i in [A, B, C]): print(0) else: AB = A * B lis = [AB] * C mid = len(lis) // 2 print(sum(lis[mid:]) - sum(lis[0:mid]))
s436471343
p04005
u556589653
1593314873
Python
PyPy3 (7.3.0)
py
Runtime Error
96
74332
66
a,b,c = map(int,input().split()) print(min(B * C,C * A,A * B))
s506737742
p04005
u322171361
1592254203
Python
Python (3.4.3)
py
Runtime Error
18
2940
80
a,b,c=input().split() a=int(a) b=int(b) c=int(c) a,b,c=[a,b,c].sort() print(a*b)
s903013426
p04005
u961683878
1591593071
Python
Python (2.7.6)
py
Runtime Error
224
16264
396
#! /usr/bin/env python3 import sys import numpy as np int1 = lambda x: int(x) - 1 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) A, B, C = map(int, readline().split()) if (A % 2 == 0) or (B % 2 == 0) or (C % 2 == 0): print(0)...
s844579471
p04005
u810288681
1590103493
Python
Python (3.4.3)
py
Runtime Error
18
2940
127
l = sorted(list(map((int, input().split())))) ans = 0 if l[0]%2!=0 and l[1]%2!=0 and l[2]%2!=0: ans += l[0]*l[1] print(ans)
s116251230
p04005
u026788530
1589904058
Python
Python (3.4.3)
py
Runtime Error
18
2940
115
a=[int(_) for i in range(n)] if a[0]%2==0 or a[1]%2==0 or a[2]%2==0: print(0) else: a.sort() print(a[0]*a[1])
s556267653
p04005
u252828980
1588794407
Python
Python (3.4.3)
py
Runtime Error
18
2940
134
a,b,c = list(map(int,input().split())) if any([i%2==0 for i in (a,b,c)]): print(0) else: ans = min(a*b , c*b , a*c) print(ans)
s446199180
p04005
u252828980
1588794025
Python
Python (3.4.3)
py
Runtime Error
18
3060
200
a,b,c = list(map(int,input().split())) if any([i%2==0 for i in (a,b,c)]): print(0) else: ans = min(a*b*(c//2+1) - a*b*(c//2) , c*b*(a//2+1) - c*b*(a//2) , a*c*(b//2+1) - a*c*(b//2)) print(ans)
s811185887
p04005
u309141201
1587861668
Python
PyPy3 (2.4.0)
py
Runtime Error
174
38640
286
A, B, C = map(int, input().split()) if (A * B * C) % 2 == 0: ans = 0 else: V = A*B*C AB = A*B BC = B*C CA = C*A ans = min(V-(A//2)*BC, V-((A//2) + 1)*BC) ans = min(V-(B//2)*CA, V-((B//2) + 1)*CA) ans = min(V-(C//2)*AB, V-((C//2) + 1)*AB) print(V - 2*ans)
s969846267
p04005
u368563078
1587484022
Python
Python (3.4.3)
py
Runtime Error
17
3060
164
A,B,C = map(int,input()) num_list = [A,B,C] list_s = sorted(num_list) if A % 2 == 1 and B % 2 == 1 and C % 2 == 1: print(list_s[0]*list_s[1]) else: print(0)
s435884578
p04005
u368563078
1587483958
Python
Python (3.4.3)
py
Runtime Error
17
2940
171
A,B,C = map(int,input()) num_list = [A,B,C] list_s = sorted(num_list) if A % 2 == 1 and B % 2 == 1 and C % 2 == 1: print(list_s[0]*list_s[1]) else: print(0)
s993966385
p04005
u746428948
1587149937
Python
Python (3.4.3)
py
Runtime Error
17
2940
702
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) #define rrep(i,n) for(int i=1; i<=(int)(n); i++) #define pb push_back #define all(v) v.begin(),v.end() #define fi first #define se second #define bigger (char)toupper #define smaller (char)tolower using namespace std; typedef pair<int,int> pii; typedef ...
s534081873
p04005
u098982053
1585506429
Python
Python (3.4.3)
py
Runtime Error
18
3064
300
Cube = [int(i) for i in input().split(" ")] # 一番長い辺で切れば断面の数は最小 L = max(Cube) plane = [i for i in Cube if i!=L] if len(plane)==0: A = L B = L elif len(plane)==1: A = plane[0] B = L else: A,B = map(int,plabe) print(abs((A*B*(L//2))-(A*B*(L-(L//2)))))
s835226544
p04005
u098982053
1585506133
Python
Python (3.4.3)
py
Runtime Error
18
3060
192
Cube = [int(i) for i in input().split(" ")] # 一番長い辺で切れば断面の数は最小 L = max(Cube) A,B = map(int,[i for i in Cube if i!=L]) print(abs((A*B*(L//2))-(A*B*(L-(L//2)))))
s299925517
p04005
u835924161
1583748439
Python
Python (3.4.3)
py
Runtime Error
17
2940
110
a,b,c=map(int,input().split()) if a%2==0 or b%2==0 or c%2==0: print(0) exit() print(min[a*b,b*c,c*a])
s849433957
p04005
u693716675
1583556488
Python
Python (3.4.3)
py
Runtime Error
17
2940
155
a,b,c = [int(i) for i in input().split()] if (a*b*c)%2==0: print(0) else: ans = a*b ans = min(ans, b*c) ans = min(aans, c*a) print(ans)
s275727255
p04005
u252828980
1575689170
Python
Python (3.4.3)
py
Runtime Error
17
3064
394
a,b,c = map(int,input().split()) p = any((a%2 == 0,b%2 == 0,c%2 == 0)) if p: print(0) else: L = [] for i in range(a//2,a//2+2): L.append(i*b*c) aa = abs(L[0]-L[1]) L = [] for j in range(b//2,b//2+2): L.append(j*a*c) bb = abs(L[0]-L[1]) L = [] for k in range(c//2,c//2...
s034724514
p04005
u754022296
1573265653
Python
Python (3.4.3)
py
Runtime Error
17
2940
117
a, b, c = map(int, input().split()) if a%2 and b%2 and c%2: l = sorted(a, b, c) print(l[0]*l[1]) else: print(0)
s979365264
p04005
u204236873
1560577191
Python
Python (3.4.3)
py
Runtime Error
18
3064
660
if __name__ == "__main__": N, x = input().split(" ") N = int(N) x = int(x) a = [] for e in input().split(" "): a.append(int(e)) min_cost = [] for i in range(N): min_cost.append([0] * N) min_total_cost = -1 for k in range(N): temp_sum = 0 if k==0: for i in range(N): min_cost[k][i] = a[i] te...
s494821604
p04005
u623687794
1557718590
Python
Python (3.4.3)
py
Runtime Error
17
2940
113
a=list(map(int,input().split())) a.sort() if a%2!=0 and b%2!=0 and c%2!=0: print(a[0]*a[1]) else: print("0")
s964849111
p04005
u623687794
1557718522
Python
Python (3.4.3)
py
Runtime Error
17
2940
112
a=list(map(int,input().split())) a.sort() if a%2!=0 and b%2!=0 and c%2!=0: print(a[0]*a[1]) elif: print("0")
s480796509
p04005
u507116804
1557718284
Python
Python (3.4.3)
py
Runtime Error
17
2940
111
a,b,c=map(int,input().split()) m=a*b*c k=max(a,b,c) if m%2==0: print(int(0)) else: h=m/k print(int((h))
s447316080
p04005
u507116804
1557717757
Python
Python (3.4.3)
py
Runtime Error
18
2940
126
a,b,c=map(int,input().split()) m=a*b*c k=max(a,b,c) if m%2==0: print(int(0)) else: n=k//2 h=m/k print(int((k-2n)*h))
s631290542
p04005
u227082700
1553833804
Python
Python (3.4.3)
py
Runtime Error
17
2940
88
a=list(int,input().split());a.sort();s=a[0]*a[1] if (a[2]*s)%2==0:print(0) else:print(s)
s190317035
p04005
u394721319
1552782742
Python
Python (3.4.3)
py
Runtime Error
19
3316
165
li = [int(i) for i in input().split()] for i in li: if i%2 == 0: print(0) exit() li.pop(max(li)) ans = 1 for i in li: ans *= i print(ans)
s913342716
p04005
u263933075
1549821610
Python
Python (3.4.3)
py
Runtime Error
18
3060
149
s=input().split();a,b,c=int(s[0]),int(s[1]),int(s[2]) ma,mi=max(a,b,c),min(a,b,c);me=sum(a,b,c)-ma-mi if ma%2==0: print(0) else: print(mi*me)
s309691044
p04005
u459233539
1546475161
Python
Python (3.4.3)
py
Runtime Error
18
2940
63
a,b,c=map(int,input().split()) print(min(a%*b*c,b%*a*c,c%*a*b))
s634536664
p04005
u459233539
1546475097
Python
Python (3.4.3)
py
Runtime Error
18
2940
70
a,b,c=map(int,input().split()) print(min((a%)*b*c,a*(b%)*c,a*b*(c%)))
s916052211
p04005
u459233539
1546475061
Python
Python (3.4.3)
py
Runtime Error
18
2940
63
a,b,c=map(int,input().split()) print(min(a%*b*c,a*b%*c,a*b*c%))
s475049765
p04005
u311944296
1542796102
Python
Python (3.4.3)
py
Runtime Error
17
2940
504
#include <bits/stdc++.h> using namespace std; typedef long long int64; int64 a, b, c, ans = LLONG_MAX; void calc(int64 a, int64 b, int64 c) { int64 r = a / 2; for(int64 i = max(1LL, r - 5); i <= min(r + 5, a - 1); i++) { int64 v1 = i * b * c; int64 v2 = (a - i) * b * c; ans = min(ans, llabs(v1 - v2)); } } ...
s362840031
p04005
u311944296
1542795914
Python
Python (3.4.3)
py
Runtime Error
17
3064
455
from math import * a, b, c = map(int, input().split()) def calc(a, b, c): r = sqrt(a) ans = a * b * c for i in range(max(1, r - 5), min(r + 5, a - 1) + 1): v1 = i * b * c v2 = (a - i) * b * c ans = min(ans, abs(v1 - v2)) return ans res = a * b * c res = min(res, calc(a, b, c)) res = min(res, calc(a, c, ...
s801701820
p04005
u884982181
1541732213
Python
Python (3.4.3)
py
Runtime Error
18
2940
111
a = list(map(int,input().split())) a.sort() for i in a: if a%2 == 0: print(0) exit() print(a[0]*a[1])
s607652352
p04005
u333139319
1539111550
Python
Python (3.4.3)
py
Runtime Error
17
2940
124
[a,b,c] == [int(i) for i in input().split()] if (a * b * c) % 2 == 0: print(0) else: print(min(a * b,b * c,c * a))
s032473004
p04005
u824237520
1538510995
Python
Python (3.4.3)
py
Runtime Error
17
3064
393
n, x = map(int, input().split()) a = list(map(int, input().split())) temp = 0 check = 0 for i in range(1, n): if a[i] <= a[i - 1] + x: check = 1 temp = i break if check == 1: a = a[temp:] + a[:temp] check = 1 for i in range(1, n): if a[i] >= a[i - check] + x: a[i] = a[i -...
s170651349
p04005
u790301364
1537202448
Python
Python (3.4.3)
py
Runtime Error
17
3064
462
def main10(): buf = int(input("")); strbuf = input(""); strbufs = strbuf.split(); buf2 = []; for i in range(buf): buf2.append(int(strbufs[i])); if len(buf2) == 1: return("YES"); else: ki = 0; for i in range(buf): if buf2[i] % 2 == 1: ...
s179742963
p04005
u627417051
1531460529
Python
Python (3.4.3)
py
Runtime Error
17
2940
147
A, B, C = list(map(int, input().split())) if A % 2 == 0 or B % 2 == 0 or C % 2 == 0: print(0) else: ABC = sort([A, B, C]) print(ABC[0] * ABC[1])
s810180512
p04005
u813356465
1475473420
Python
PyPy2 (5.6.0)
py
Runtime Error
40
8944
532
def min_k_shift(k, a, N, x, range_min): cost = k*x for j in range(N): cost += range_min[(j-k)%N][j] #min(a[(j-sj)%N] for sj in range(k)) return cost N, x = [int(s) for s in raw_input().split()] a = [int(s) for s in raw_input().split()] range_min = [[0]*N for st in range(N)] for st in range(N): ...