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
s559200601
p03734
u576917603
1582203435
Python
PyPy3 (2.4.0)
py
Runtime Error
2159
40380
627
N,W=map(int,input().split()) w,v=[0]*N,[0]*N for i in range(N): w[i],v[i]=map(int,input().split()) V=sum(v) # dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値 dp=[[float("inf")]*(V+1) for _ in range(N+1)] dp[0][0]=0 for i in range(N): for j in range(V+1): # i+1番目を選ぶ場合 if j-v[i]>=0: dp[i+1][j]=min(dp[i+1][j], dp[...
s460025334
p03734
u540761833
1582040058
Python
Python (3.4.3)
py
Runtime Error
240
3064
674
from itertools import accumulate N,W = map(int,input().split()) w = [[] for i in range(4)] w1,v1 = map(int,input().split()) w[0].append(v1) for i in range(N-1): wi,vi = map(int,input().split()) w[wi-w1].append(vi) num = [] for i in range(4): w[i].sort(reverse= 1) w[i] = [0]+list(accumulate(w[i])) nu...
s649753294
p03734
u623819879
1581702771
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38512
3317
from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter import itertools from functools import * from itertools import permutations,combinations,groupby import sys import bisect import string import math import time import random def Golf(): *a,=map(int,open(0)) def S_(): re...
s199775372
p03734
u644907318
1580413565
Python
PyPy3 (2.4.0)
py
Runtime Error
326
67792
741
INFTY = 10**10 N,W = map(int,input().split()) X = [list(map(int,input().split())) for _ in range(N)] dp = [[[-INFTY for _ in range(3*N+1)] for _ in range(N+1)] for _ in range(N+1)] for i in range(N+1): dp[i][0][0] = 0 for i in range(1,N+1): for j in range(1,i+1): for k in range(3*N+1): if i>...
s901069521
p03734
u644907318
1580413222
Python
PyPy3 (2.4.0)
py
Runtime Error
311
67036
617
INFTY = 10**10 N,W = map(int,input().split()) X = [list(map(int,input().split())) for _ in range(N)] dp = [[[-INFTY for _ in range(3*N+1)] for _ in range(N+1)] for _ in range(N+1)] for i in range(N+1): dp[i][0][0] = 0 for i in range(1,N+1): for j in range(1,i+1): for k in range(3*N+1): dp[i]...
s969511434
p03734
u644907318
1580412533
Python
PyPy3 (2.4.0)
py
Runtime Error
306
67036
582
INFTY = 10**10 N,W = map(int,input().split()) X = [list(map(int,input().split())) for _ in range(N)] dp = [[[-INFTY for _ in range(301)] for _ in range(N+1)] for _ in range(N+1)] for i in range(N+1): dp[i][0][0] = 0 for i in range(1,N+1): for j in range(1,i+1): for k in range(301): dp[i][j][...
s127125340
p03734
u644907318
1579884902
Python
PyPy3 (2.4.0)
py
Runtime Error
2146
674468
1412
INFTY = 10**8 N,W = map(int,input().split()) A = [list(map(int,input().split())) for _ in range(N)] w = A[0][0] C = {i:0 for i in range(4)} for i in range(N): C[A[i][0]-w] += 1 dp = [[[[[-INFTY for _ in range(C[3]+1)] for _ in range(C[2]+1)] for _ in range(C[1]+1)] for _ in range(C[0]+1)] for _ in range(N+1)] for n...
s885786285
p03734
u644907318
1579883818
Python
PyPy3 (2.4.0)
py
Runtime Error
2149
674568
1441
INFTY = 10**10 N,W = map(int,input().split()) A = [list(map(int,input().split())) for _ in range(N)] w = A[0][0] C = {i:0 for i in range(4)} for i in range(N): C[A[i][0]-w] += 1 dp = [[[[[-INFTY for _ in range(C[3]+1)] for _ in range(C[2]+1)] for _ in range(C[1]+1)] for _ in range(C[0]+1)] for _ in range(N+1)] for ...
s722011557
p03734
u399721252
1573158917
Python
Python (3.4.3)
py
Runtime Error
1992
3552
837
n, w = [ int(v) for v in input().split() ] knapsack = [ [ int(v) for v in input().split() ] for i in range(n) ] dp_list = [ [ None for i in range(4*n+1) ] for i in range(n+1) ] dp_list[0][0] = 0 base = knapsack[0][0] for wi, vi in knapsack: wi -= base for i in range(n-1,-1,-1): for j in range(4*n,-1,...
s793308422
p03734
u399721252
1573158165
Python
Python (3.4.3)
py
Runtime Error
1567
3548
817
n, w = [ int(v) for v in input().split() ] knapsack = [ [ int(v) for v in input().split() ] for i in range(n) ] dp_list = [ [ None for i in range(4*n+1) ] for i in range(n+1) ] dp_list[0][0] = 0 base = knapsack[0][0] for wi, vi in knapsack: wi -= base for i in range(n-1,-1,-1): for j in range(4*n,-1,...
s564421661
p03734
u196697332
1568339507
Python
Python (3.4.3)
py
Runtime Error
19
3188
755
from itertools import accumulate N, W = map(int, input().split()) w_0, v_0 = map(int, input().split()) v_list = [[] for _ in range(4)] v_list[0].append(v_0) for _ in range(n - 1): w_in, v_in = map(int, input().split()) v_list[w_in - w_0].append(v_in) v_list = [[0] + list(accumulate(sorted(v, reverse=True))) fo...
s148546633
p03734
u077291787
1567566347
Python
PyPy3 (2.4.0)
py
Runtime Error
2607
1242376
612
# ARC073D - Simple Knapsack (ABC060D) def knapsack_heavy(W: int, weight: "Array[int]", value: "Array[int]") -> int: lim = sum(value) dp = [0] + [float("inf")] * lim # dp[i] := minimum weight at value i for w, v in zip(weight, value): for cur_v in range(lim, v - 1, -1): dp[cur_v] = min(d...
s610080876
p03734
u077291787
1567566282
Python
Python (3.4.3)
py
Runtime Error
2122
332660
612
# ARC073D - Simple Knapsack (ABC060D) def knapsack_heavy(W: int, weight: "Array[int]", value: "Array[int]") -> int: lim = sum(value) dp = [0] + [float("inf")] * lim # dp[i] := minimum weight at value i for w, v in zip(weight, value): for cur_v in range(lim, v - 1, -1): dp[cur_v] = min(d...
s235843105
p03734
u091051505
1566964362
Python
Python (3.4.3)
py
Runtime Error
2123
528792
557
n, w = map(int, input().split()) a = [] for _ in range(n): w_in, v_in = map(int, input().split()) a.append([w_in, v_in]) dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)] for j in range(w + 1): for i in range(n): w_in, v_in = a[i] if j + w_in <= w: dp[i + 1][j + w_in] = max...
s287280400
p03734
u497596438
1559972249
Python
PyPy3 (2.4.0)
py
Runtime Error
270
66908
789
N,W=map(int,input().split()) wv=[] for i in range(N): a,b=map(int,input().split()) wv.append((a,b)) if wv[0][0]<300: dp=[[0]*(30000+1) for i in range(N+1)] for i in range(1,N+1): wi,vi=wv[i-1] for j in range(1,30000+1): dp[i][j]=dp[i-1][j] if j-wi<0: ...
s261517299
p03734
u497596438
1559971305
Python
PyPy3 (2.4.0)
py
Runtime Error
270
66028
758
N,W=map(int,input().split()) wv=[] for i in range(N): a,b=map(int,input().split()) wv.append((a,b)) if wv[0][0]<300: dp=[[0]*(30000+1) for i in range(N+1)] for i in range(1,N+1): wi,vi=wv[i-1] for j in range(1,30000+1): dp[i][j]=dp[i-1][j] if j-wi<0: ...
s328238505
p03734
u497596438
1559970722
Python
PyPy3 (2.4.0)
py
Runtime Error
275
66028
758
N,W=map(int,input().split()) wv=[] for i in range(N): a,b=map(int,input().split()) wv.append((a,b)) if wv[0][0]<300: dp=[[0]*(30000+1) for i in range(N+1)] for i in range(1,N+1): wi,vi=wv[i-1] for j in range(1,30000+1): dp[i][j]=dp[i-1][j] if j-wi<0: ...
s600701458
p03734
u497596438
1559970681
Python
Python (3.4.3)
py
Runtime Error
2111
105972
758
N,W=map(int,input().split()) wv=[] for i in range(N): a,b=map(int,input().split()) wv.append((a,b)) if wv[0][0]<300: dp=[[0]*(30000+1) for i in range(N+1)] for i in range(1,N+1): wi,vi=wv[i-1] for j in range(1,30000+1): dp[i][j]=dp[i-1][j] if j-wi<0: ...
s788201011
p03734
u565204025
1556946611
Python
PyPy3 (2.4.0)
py
Runtime Error
1389
42500
503
# -*- coding: utf-8 -*- n,W = map(int,input().split()) w = [0] * n v = [0] * n for i in range(n): w[i],v[i] = map(int,input().split()) max_v = sum(v) dp = [[float("inf")] * (n * max_v + 1) for i in range(n + 1)] dp[0][0] = 0 for i in range(n): for j in range(n * max_v): if j < v[i]: dp[i...
s676105112
p03734
u565204025
1556946532
Python
Python (3.4.3)
py
Runtime Error
2111
3436
502
# -*- coding: utf-8 -*- n,W = map(int,input().split()) w = [0] * n v = [0] * n for i in range(n): w[i],v[i] = map(int,input().split()) max_v = sum(v) dp = [[10000000000] * (n * max_v + 1) for i in range(n + 1)] dp[0][0] = 0 for i in range(n): for j in range(n * max_v): if j < v[i]: dp[i ...
s926221503
p03734
u565204025
1556946336
Python
Python (3.4.3)
py
Runtime Error
1837
3064
503
# -*- coding: utf-8 -*- n,W = map(int,input().split()) w = [0] * n v = [0] * n for i in range(n): w[i],v[i] = map(int,input().split()) max_v = sum(v) dp = [[float("inf")] * (n * max_v + 2) for i in range(n + 2)] dp[0][0] = 0 for i in range(n): for j in range(n * max_v): if j < v[i]: dp[i...
s751273341
p03734
u565204025
1556945909
Python
Python (3.4.3)
py
Runtime Error
1852
3064
503
# -*- coding: utf-8 -*- n,W = map(int,input().split()) w = [0] * n v = [0] * n for i in range(n): w[i],v[i] = map(int,input().split()) max_v = sum(v) dp = [[float("inf")] * (n * max_v + 1) for i in range(n + 1)] dp[0][0] = 0 for i in range(n): for j in range(n * max_v): if j < v[i]: dp[i...
s288115587
p03734
u367130284
1556786882
Python
Python (3.4.3)
py
Runtime Error
2109
211492
173
from numpy import* N,W=map(int, input().split()) dp=zeros(W+1) for i in range(N): w,v=map(int, input().split()) dp[w:]=maximum(dp[w:], dp[:-w]+v) print(int(max(dp)))
s533620103
p03734
u041075929
1556055505
Python
PyPy3 (2.4.0)
py
Runtime Error
174
38640
847
import sys, os import numpy as np f = lambda:list(map(int,input().split())) if 'local' in os.environ : sys.stdin = open('./input.txt', 'r') def solve(): N, W = f() w = np.zeros((N+1,1), dtype = int) v = np.zeros((N+1,1), dtype = int) for i in range(1,1+N): wtmp, vtmp = f() w[i] = ...
s173898248
p03734
u977389981
1555375459
Python
Python (3.4.3)
py
Runtime Error
1759
1974388
354
n, w = map(int, input().split()) A = [[int(i) for i in input().split()] for i in range(n)] dp = [[0] * (w + 1) for i in range(n + 1)] for i in range(n): for j in range(w + 1): if j < A[i][0]: dp[i + 1][j] = dp[i][j] else: dp[i + 1][j] = max(dp[i][j], dp[i][j - A[i][0]] + A[i...
s776567118
p03734
u977389981
1555375098
Python
Python (3.4.3)
py
Runtime Error
1741
1974388
778
import sys sys.setrecursionlimit(10 ** 8) N, W = map(int, input().split()) A = [[int(i) for i in input().split()] for i in range(N)] dp = [[-1] * (W + 1) for i in range(N + 1)] def rec(i, w): if dp[i][w] >= 0: return dp[i][w] #すでに調べたことがあるならばその結果を再利用 #すでにテーブルに記録してあるので、この時点でreturnして良い if i == N:...
s617661786
p03734
u977389981
1555374747
Python
Python (3.4.3)
py
Runtime Error
1818
1974388
468
import sys sys.setrecursionlimit(10 ** 8) N, W = map(int, input().split()) A = [[int(i) for i in input().split()] for i in range(N)] memo = [[-1] * (W + 1) for i in range(N + 1)] def dfs(i, j): if memo[i][j] >= 0: ans = memo[i][j] elif i == N: ans = 0 elif A[i][0] > j: ans = dfs(i ...
s974491794
p03734
u977389981
1555374561
Python
Python (3.4.3)
py
Runtime Error
1728
1974388
473
import sys sys.setrecursionlimit(10 ** 8) N, W = map(int, input().split()) A = [[int(i) for i in input().split()] for i in range(N)] memo = [[0] * (W + 1) for i in range(N + 1)] def dfs(i, j): if memo[i][j] != 0: ans = memo[i][j] elif i == N: return 0 elif A[i][0] > j: return dfs(i...
s219119241
p03734
u977389981
1555374495
Python
Python (3.4.3)
py
Runtime Error
1755
1974388
430
N, W = map(int, input().split()) A = [[int(i) for i in input().split()] for i in range(N)] memo = [[0] * (W + 1) for i in range(N + 1)] def dfs(i, j): if memo[i][j] != 0: ans = memo[i][j] elif i == N: return 0 elif A[i][0] > j: return dfs(i + 1, j) else: ans = max(dfs(i...
s219206265
p03734
u977389981
1555368025
Python
Python (3.4.3)
py
Runtime Error
1936
1974388
418
N, W = map(int, input().split()) A = [[int(i) for i in input().split()] for i in range(N)] memo = [[0] * (W + 1) for i in range(N + 1)] def dfs(i, j): if memo[i][j] != 0: ans = memo[i][j] elif i == N: return 0 elif A[i][0] > j: return 0 else: ans = max(dfs(i + 1, j), A[...
s084565987
p03734
u543954314
1553119212
Python
Python (3.4.3)
py
Runtime Error
454
3064
467
n, w = map(int, input().split()) di = dict() m = 0 for _ in range(n): x,y = map(int, input().split()) if x not in di: di[x] = [] di[x].append(y) for i in di: di[i].sort(reverse=True) a,b,c,d = di.keys() for i in range(len(di[a])): for j in range(len(di[b])): for k in range(len(di[c])): for l in ...
s134017087
p03734
u267325300
1552366929
Python
Python (3.4.3)
py
Runtime Error
1915
1974388
442
N, W = map(int, input().split()) items = [] for _ in range(N): w, v = map(int, input().split()) items.append({"w": w, "v": v}) dp = [[0] * (W + 1) for _ in range(N + 1)] for i in range(N): item_w = items[i]["w"] item_v = items[i]["v"] for w in range(W + 1): if w >= item_w: dp[...
s330191072
p03734
u267325300
1552366715
Python
Python (3.4.3)
py
Runtime Error
1862
1974388
447
N, W = map(int, input().split()) items = [] for _ in range(N): w, v = map(int, input().split()) items.append((w, v)) dp = [[0] * (W + 1) for _ in range(N + 1)] for i in range(1, N + 1): item_w = items[i - 1][0] item_v = items[i - 1][1] for w in range(W + 1): if w >= item_w: dp...
s946921854
p03734
u267325300
1552366537
Python
Python (3.4.3)
py
Runtime Error
1928
1974388
461
N, W = map(int, input().split()) items = [] for _ in range(N): w, v = map(int, input().split()) items.append({"w": w, "v": v}) dp = [[0] * (W + 1) for _ in range(N + 1)] for i in range(1, N + 1): item_w = items[i - 1]["w"] item_v = items[i - 1]["v"] for w in range(W + 1): if w >= item_w: ...
s033373127
p03734
u572144347
1551625045
Python
Python (3.4.3)
py
Runtime Error
18
3064
690
N,W=map(int,input().split()) wv=[[int(j) for j in input().split()] for _ in range(N) ] w0=wv[0][0] w1=w0+1 w2=w1+1 w3=w2+1 wv=sorted(wv,key=lambda x:x[1],reverse=True) wv=sorted(wv) ans=0 from bisect import bisect_left as bll for e1 in range(0,W//w0+1): l2=W-w0*e1 for e2 in range(0,l2//(w0+1)+1): l3=l2-(w0+1)...
s771381410
p03734
u375616706
1550867145
Python
PyPy3 (2.4.0)
py
Runtime Error
231
43884
1151
from itertools import accumulate import heapq # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, W = map(int, input().split()) first_item = list(map(int, input().split())) basew = first_item[0] w0 = [] w1 = [] w2 = [] w3 = [] heapq.heappush(w0, first_item[1]) for _ in ...
s081794233
p03734
u054106284
1549650025
Python
Python (3.4.3)
py
Runtime Error
2080
33516
699
N, W = (int(i) for i in input().split()) w = [0]*N v = [0]*N for i in range(N): w[i], v[i] = (int(j) for j in input().split()) w0 = w[0] wh = [a - w0 for a in w] dp = [[[-1]*(N+1) for i in range(3*N+1)] for j in range(N+1)] dp[0][0][0] = 0 for i in range(N): for j in range(3*N+1): for k in range(N+1): if ...
s279767174
p03734
u054106284
1549649328
Python
PyPy3 (2.4.0)
py
Runtime Error
179
38256
648
N, W = (int(i) for i in input().split()) w = [0]*N v = [0]*N for i in range(N): w[i], v[i] = (int(j) for j in input().split()) w0 = w[0] wh = [a - w0 for a in w] dp = [[[-1]*(N+1) for i in range(3*N+1)] for j in range(N+1)] dp[0][0][0] = 0 for i in range(N): for j in range(3*N+1): for k in range(N+1): if ...
s195383836
p03734
u054106284
1549629094
Python
Python (3.4.3)
py
Runtime Error
18
2940
632
N, W = (int(i) for i in input().split()) w = [0]*N w0 = w[0] wh = [a - w0 for a in W] v = [0]*N for i in range(N): w[i], v[i] = (int(i) for i in input().split()) dp = [[[0]*(N+1) for i in range(3N+1)] for j in range(N+1)] for i in range(N): for j in range(3N+1): for k in range(N+1): dp[i+1][j][k] = max(dp...
s560874041
p03734
u375616706
1549166707
Python
Python (3.4.3)
py
Runtime Error
1816
1974388
504
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, W = map(int, input().split()) items = [] for _ in range(N): a, b = map(int, input().split()) items.append([a, b]) dp = [[0]*(W+1) for _ in range(N+1)] for i in reversed(range(N)): for j in range(W+1): ...
s832995935
p03734
u391331433
1532489774
Python
Python (2.7.6)
py
Runtime Error
1087
41500
1103
import sys from collections import deque import copy from math import * def get_read_func(fileobject): if fileobject == None : return raw_input else: return fileobject.readline def main(): if len(sys.argv) > 1: f = open(sys.argv[1]) else: f = None read_func = get_...
s600355862
p03734
u391331433
1532489306
Python
Python (2.7.6)
py
Runtime Error
56
3564
1102
import sys from collections import deque import copy from math import * def get_read_func(fileobject): if fileobject == None : return raw_input else: return fileobject.readline def main(): if len(sys.argv) > 1: f = open(sys.argv[1]) else: f = None read_func = get_...
s019406843
p03734
u858748695
1509829057
Python
Python (3.4.3)
py
Runtime Error
2031
1974388
386
#!/usr/bin/env python3 N, W = map(int, input().split()) w = [0] * N v = [0] * N for i in range(N): w[i], v[i] = map(int, input().split()) dp = [[0] * (W + 1) for i in range(N + 1)] for i in range(N): for j in range(W + 1): if j < w[i]: dp[i + 1][j] = dp[i][j] else: dp[i...
s249375885
p03734
u804395358
1494526958
Python
Python (3.4.3)
py
Runtime Error
1482
18400
1111
import numpy as np temp = [int(i) for i in input().split()] N = temp[0] maxWeight = temp[1] # matrix = [[0 for i in range(maxWeight+1)] for j in range(N)] # for i in range(N): # matrix[i][0] = 0 value = [] weight = [] matrix = np.zeros((N,maxWeight+1), dtype=np.int) # items are stored as tuples (w, v) for...
s565210460
p03734
u252883287
1494476348
Python
Python (2.7.6)
py
Runtime Error
851
15588
1115
#!/usr/bin/env python # coding: utf-8 N, W = map(int, raw_input().split(' ')) w, v = [], [] for i in range(N): _w, _v = map(int, raw_input().split(' ')) w.append(_w) v.append(_v) toriuru_w = [0] for p in range(N): toriuru_w.extend([w[0]*(p+1) + i for i in range(3*p+4)]) toriuru_w = list(set(toriuru_w)...
s611412345
p03734
u119303585
1494279149
Python
Python (3.4.3)
py
Runtime Error
17
3064
437
import itertools a = list(map(int, input().split())) N,W = a[0],a[1] tup =zip(a[2::2], a[3::2]) dic = {} for val in tup: if val[0] in dic.keys(): if val[1] >= dic[val[0]]: dic.update({val[0]:val[1]}) else: dic.update({val[0]:val[1]}) t = max([max([sum(map(lambda x: dic[x], element))...
s584881704
p03734
u057916330
1493794025
Python
Python (3.4.3)
py
Runtime Error
1770
1974516
861
N, W = map(int, input().split()) w, v = [0] * N, [0] * N for i in range(N): w[i], v[i] = map(int, input().split()) def simple_dp(): offset = w[0] maximum = min(100 * (w[0] + 3), W + 1) dp = [[-1] * (maximum + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): if w[i] <= W: ...
s761438344
p03734
u057916330
1493792977
Python
Python (3.4.3)
py
Runtime Error
1766
1974388
625
N, W = map(int, input().split()) w, v = [0] * N, [0] * N for i in range(N): w[i], v[i] = map(int, input().split()) def simple_dp(): dp = [[-1] * (W + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): for j in [0] + list(range(w[0], min(100 * (w[0] + 3), W + 1))): if dp[i][j...
s169756711
p03734
u557791172
1493784739
Python
Python (2.7.6)
py
Runtime Error
1012
16512
618
#-*- coding: utf-8 -*- import numpy as np def knapsack2(items, W): N = len(items) C = np.zeros((N+1, W+1)) for i in range(N+1)[1:]: v, w = items[i-1] for j in range(W+1)[1:]: if j < w: C[i][j] = C[i-1][j] else: C[i][j] = max(C[i-1][j-w...
s174583480
p03734
u557791172
1493784539
Python
Python (2.7.6)
py
Runtime Error
997
16512
617
#-*- coding: utf-8 -*- import numpy as np def knapsack2(items, W): N = len(items) C = np.zeros((N+1, W+1)) for i in range(N+1)[1:]: v, w = items[i-1] for j in range(W+1)[1:]: if j < w: C[i][j] = C[i-1][j] else: C[i][j] = max(C[i-1][j-w...
s849771682
p03734
u557791172
1493783386
Python
Python (2.7.6)
py
Runtime Error
11
2696
506
#-*- coding: utf-8 -*- def knapsack2(items, W): N = len(items) C = [[0 for _i in xrange(W+1)] for _j in xrange(N+1)] for i in range(N+1)[1:]: v, w = items[i-1] for j in range(W+1)[1:]: if j < w: C[i][j] = C[i-1][j] else: C[i][j] = max(C...
s073356055
p03734
u556160473
1493519312
Python
Python (3.4.3)
py
Runtime Error
426
16868
779
import bisect if 1: N,W = map(int, input().split(' ')) w,v = [],[] for i in range(N): w_,v_ = map(int, input().split(' ')) w.append(w_) v.append(v_) else: N,W = 4,6 w = [2,3,4,3] v = [1,4,10,4] w0 = w[0] idxs = set() for i in range(N): for j in range(3*i+1): ...
s354456723
p03734
u199826065
1493517991
Python
Python (2.7.6)
py
Runtime Error
43
4332
1103
import sys import random def rd(): return sys.stdin.readline().rstrip() def rdi(): return [ int(x) for x in rd().split() ] m = {} def update(W, wi, vi): if wi > W: return global m ks = m.keys() a = set() for wj in ks: wk = wj + w...
s289002634
p03734
u243492642
1493516428
Python
Python (3.4.3)
py
Runtime Error
1680
1975532
897
# coding: utf-8 import array, bisect, collections, heapq, itertools, math, random, re, string, sys, time sys.setrecursionlimit(10 ** 7) INF = 10 ** 20 MOD = 10 ** 9 + 7 def II(): return int(input()) def ILI(): return list(map(int, input().split())) def IAI(LINE): return [ILI() for __ in range(LINE)] def IDI(): retur...
s333885706
p03734
u955900923
1493515743
Python
Python (2.7.6)
py
Runtime Error
2011
11652
367
# -*- coding: utf-8 -*- N,W=map(int,raw_input().split()) w=[0]*N v=[0]*N dp = [[0 for i in range(W + 1)] for j in range(N + 1)] for i in range(N): w[i],v[i]=map(int,raw_input().split()) for i in range(N - 1, -1, -1): for j in range(W + 1): if j < w[i]: dp[i][j] = dp[i + 1][j] else: dp[i][j] = max(dp[i + 1][j]...
s306886058
p03734
u776189585
1493515340
Python
Python (2.7.6)
py
Runtime Error
2111
1974020
484
#coding: utf-8 N, W = map(int, raw_input().split()) items = [] for i in range(N): items.append(map(int, raw_input().split())) #weight, value dp = [[-1] * (W+1) for _ in range(N+1)] def proc(i, j): if dp[i][j] != -1: return dp[i][j] if i == N: res = 0 elif j < items[i][0]: res ...
s912310297
p03734
u776189585
1493515073
Python
Python (2.7.6)
py
Runtime Error
2112
1974020
660
#coding: utf-8 N, W = map(int, raw_input().split()) items = [] for i in range(N): items.append(map(int, raw_input().split())) #weight, value ...
s558173508
p03735
u828766688
1585107725
Python
PyPy3 (2.4.0)
py
Runtime Error
2111
126060
2622
""" Writer: SPD_9X2 https://atcoder.jp/contests/arc073/tasks/arc073_c 全体の最大値と、最小値は必ず4つ中に含まれる 最大を必ず赤に割り振るとする (1)最小が最大とペアでないとき、→自由な方における (2)ペアの時、→青にしか置けない ありうる分け方は2つ (A)最小を赤にすると決めた時 青の最大値を最小化して、最小値を最大化するのがよさそう? (B)最小を青にするとき →赤の最小値を最大化、青の最大値を最小化するのが良い →貪欲に大きい方を赤&小さい方を青に選んでいけばよい 問題は(A)の時か… 青には、最小と最大の余り物は...
s173718847
p03735
u828766688
1585107572
Python
PyPy3 (2.4.0)
py
Runtime Error
1026
76632
2621
""" Writer: SPD_9X2 https://atcoder.jp/contests/arc073/tasks/arc073_c 全体の最大値と、最小値は必ず4つ中に含まれる 最大を必ず赤に割り振るとする (1)最小が最大とペアでないとき、→自由な方における (2)ペアの時、→青にしか置けない ありうる分け方は2つ (A)最小を赤にすると決めた時 青の最大値を最小化して、最小値を最大化するのがよさそう? (B)最小を青にするとき →赤の最小値を最大化、青の最大値を最小化するのが良い →貪欲に大きい方を赤&小さい方を青に選んでいけばよい 問題は(A)の時か… 青には、最小と最大の余り物は...
s356661649
p03735
u062147869
1554498137
Python
PyPy3 (2.4.0)
py
Runtime Error
537
84196
461
import sys input = sys.stdin.readline N=int(input()) A=[] C=[] D=[] for i in range(N): a,b=map(int,input().split()) c,d=min(a,b),max(a,b) A.append((c,d)) C.append(c) D.append(d) #print(A,C,D,si,ti) if N==1: print(0) sys.exit() ans=(max(C)-min(C))*(max(D)-min(D)) cur=min(D) ma=min(D) T=10**19...
s345877143
p03735
u024612773
1493534447
Python
Python (3.4.3)
py
Runtime Error
1261
59032
314
from bisect import insort n=int(input()) x,y,p=[],[],[] for i in range(n): a,b=map(int,input().split()) if a > b: a,b=b,a x.append(a) y.append(b) p.append((a,i,True)) p.append((b,i,False)) p.sort() ans=(max(x)-min(x))*(max(y)-min(y)) if p[0][1] != p[-1][1]: raise ValueError print(ans)
s031340051
p03735
u226155577
1493520448
Python
Python (2.7.6)
py
Runtime Error
1014
61796
844
n = input() P = [] mx = {} my = {} for i in xrange(n): x, y = map(int, raw_input().split()) if x > y: x, y = y, x mx[x] = i my[y] = i P.append((x, y)) kx = sorted(mx) mi_x = min(mx); ma_x = max(mx) ky = sorted(my) mi_y = min(my); ma_y = max(my) if ma_x < mi_y or ma_y < mi_x: print (ma_x - mi_x...
s843623117
p03735
u226155577
1493520400
Python
Python (2.7.6)
py
Runtime Error
937
61796
834
n = input() P = [] mx = {} my = {} for i in xrange(n): x, y = map(int, raw_input().split()) if x > y: x, y = y, x mx[x] = i my[y] = i P.append((x, y)) kx = sorted(mx) mi_x = min(mx); ma_x = max(mx) ky = sorted(my) mi_y = min(my); ma_y = max(my) if ma_x < mi_y or ma_y < mi_x: print (ma_x - mi_x...
s847338924
p03735
u637175065
1493519696
Python
Python (3.4.3)
py
Runtime Error
18
3064
1740
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x...
s931404760
p03736
u886633618
1596073096
Python
PyPy3 (7.3.0)
py
Runtime Error
87
74664
725
import sys sys.setrecursionlimit(10**8) stdin = sys.stdin def ni(): return int(ns()) def na(): return list(map(int, stdin.readline().split())) def naa(N): return [na() for _ in range(N)] def ns(): return stdin.readline().rstrip() # ignore trailing spaces N, W = na() INF = 10 ** 12 dp = [[-INF] * (N*3+1) for ...
s208631620
p03736
u886633618
1596072978
Python
PyPy3 (7.3.0)
py
Runtime Error
182
74568
725
import sys sys.setrecursionlimit(10**8) stdin = sys.stdin def ni(): return int(ns()) def na(): return list(map(int, stdin.readline().split())) def naa(N): return [na() for _ in range(N)] def ns(): return stdin.readline().rstrip() # ignore trailing spaces N, W = na() INF = 10 ** 12 dp = [[-INF] * (N*3+1) for ...
s510320271
p03736
u557791172
1493777566
Python
Python (2.7.6)
py
Runtime Error
401
119164
1109
# -*- coding: utf-8 -*- import collections import functools from random import randint from sys import setrecursionlimit class memoized(object): def __init__(self, func): self.func = func self.cache = {} def __call__(self, *args): if not isinstance(args, collections.Hashable): ...
s953980544
p03736
u557791172
1493776705
Python
Python (2.7.6)
py
Runtime Error
124
21432
1022
# -*- coding: utf-8 -*- import collections import functools class memoized(object): def __init__(self, func): self.func = func self.cache = {} def __call__(self, *args): if not isinstance(args, collections.Hashable): return self.func(*args) elif args in self.cache:...
s398526792
p03737
u847033024
1599989175
Python
Python (3.8.2)
py
Runtime Error
23
9020
64
a, b, c = input().split() print((s1[0] + s2[0] + s3[0]).upper())
s991533891
p03737
u365156087
1599624390
Python
Python (3.8.2)
py
Runtime Error
23
8936
85
a=int(input()) b=int(input()) print("GREATER" if a>b else "LESS" if a<b else "EQUAL")
s495422895
p03737
u365156087
1599624367
Python
Python (3.8.2)
py
Runtime Error
28
9156
93
A = int(input()) B = int(input()) print('GREATER' if A > B else 'LESS' if A < B else 'EQUAL')
s126633695
p03737
u365156087
1599624133
Python
Python (3.8.2)
py
Runtime Error
25
9148
94
A = int(input()) B = int(input()) print('GREATER' if A > B else 'EQUAL' if A == B else 'LESS')
s198653157
p03737
u708211626
1598901222
Python
Python (3.8.2)
py
Runtime Error
25
9020
98
a=input().split() b=[] for i in range(3): b.append(a[0][i].upper()) print(b[0]+b[1]+b[2])
s758411673
p03737
u158290747
1598631971
Python
Python (3.8.2)
py
Runtime Error
26
9028
60
a,b,c=map(input().split()) s=a[0]+b[0]+c[0] print(s.upper())
s269847113
p03737
u226779434
1596973010
Python
Python (3.8.2)
py
Runtime Error
25
9000
86
a,b,c =map(input().split()) print(a[0].isupper(),b[0].isupper(),c[0].isupper(),sep="")
s350481757
p03737
u226779434
1596972936
Python
Python (3.8.2)
py
Runtime Error
21
9020
56
a,b,c =map(input().split()) print(a[0],b[0],c[0],sep="")
s738000975
p03737
u174536291
1596684150
Python
Python (3.8.2)
py
Runtime Error
30
9036
91
a, b, c = list(map(str, input().split())) print(a[0].upper() + a[1].upper() + a[2].upper())
s743979308
p03737
u174536291
1596684097
Python
Python (3.8.2)
py
Runtime Error
24
9072
91
a, b, c = list(map(int, input().split())) print(a[0].upper() + a[1].upper() + a[2].upper())
s391875979
p03737
u891847179
1596258793
Python
Python (3.8.2)
py
Runtime Error
115
27196
1231
# # Make IO faster # import sys # input = sys.stdin.readline # # get single (or) multiple str # X = input() # # get single int # N = int(input()) # # get multiple int (e.g., 2) # X, Y = map(int, input().split()) # # get multiple int (e.g., 2) for N lines # XY = [list(map(int, input().split())) for _ in range(N)] # f...
s170648974
p03737
u562015767
1596076089
Python
Python (3.8.2)
py
Runtime Error
25
9204
292
a,b,c = map(int,input().split()) acnt = 0 bcnt = 0 ccnt = 0 cnt = 0 if a == b and a== c and a%2 == 0: print(-1) exit() while a%2 == 0 and b%2 == 0 and c%2 == 0: cnt += 1 acnt = (b+c)//2 bcnt = (a+c)//2 ccnt = (a+b)//2 a = acnt b = bcnt c = ccnt print(cnt)
s694807438
p03737
u426205961
1595987338
Python
Python (3.8.2)
py
Runtime Error
23
9000
67
a, b, c = map(str,input().split()) print(upper(a[0] + b[0] + c[0]))
s250303518
p03737
u629709614
1595819585
Python
Python (3.8.2)
py
Runtime Error
22
8936
122
s1, s2, s3 = map(input().split()) s1 = s1[0].str.upper() s2 = s2[0].str.upper() s3 = s3[0].str.upper() print(s1, s2, s3)
s121396745
p03737
u629607744
1595746844
Python
Python (3.8.2)
py
Runtime Error
26
9164
76
a,b,c = map(int,input().split()) ans = a[0] + b[0] + c[0] print(ans.upper())
s813987409
p03737
u185806788
1594863658
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74664
53
a,b,c=input().split x=a[0]+b[0]+c[0] print(x.upper())
s413270006
p03737
u780698286
1594216529
Python
Python (3.8.2)
py
Runtime Error
22
9016
68
a, b, c = map(int, input().split()) print(upper(a[0] + b[0] + c[0]))
s518803935
p03737
u729133443
1593255459
Python
Python (3.8.2)
py
Runtime Error
26
8980
42
print([*zip(*input().split())][0].upper())
s834903263
p03737
u446711904
1591731842
Python
Python (3.4.3)
py
Runtime Error
17
2940
62
a,b,c=map(str,input().split());print((a[0]+b[0]+v[0]).upper())
s453122179
p03737
u085334230
1591410577
Python
Python (3.4.3)
py
Runtime Error
17
2940
69
a,b,c = input().split() print(a.upper()[0]+b.upper()[0].c.upper()[0])
s279642078
p03737
u931938233
1591302179
Python
Python (3.4.3)
py
Runtime Error
18
2940
53
for s in input().split(): print(upper(s[0]),end='')
s481586917
p03737
u378157957
1590961885
Python
Python (3.4.3)
py
Runtime Error
17
3060
359
N = int(input()) seq = [int(x) for x in input().split()] a_sum = seq[0] op = 0 for a in seq[1:]: tmp = a_sum + a if tmp * a_sum < 0: a_sum = tmp elif a_sum < 0: diff = 1 - a_sum - a a_sum = 1 op += abs(diff) elif a_sum > 0: diff = -1 - a_sum - a a_sum =...
s916150968
p03737
u559346857
1590418681
Python
Python (3.4.3)
py
Runtime Error
17
3068
1
;
s280171891
p03737
u537976628
1590351093
Python
Python (3.4.3)
py
Runtime Error
17
2940
82
s1, s2, s3 = input().split()) print(s1[0].upper() + s2[0].upper() + s3[0].upper())
s489266380
p03737
u689835643
1590024815
Python
Python (3.4.3)
py
Runtime Error
17
2940
24
atcoder beginner contest
s353520176
p03737
u855378574
1589055560
Python
PyPy3 (2.4.0)
py
Runtime Error
185
38256
655
N = int(input()) A = list(map(int, input().split())) counter = 0 ####操作回数 A.reverse() S = 0 a = A.pop() if a==0: counter += 1 while A: b = A.pop() if b == 0: counter += 2 elif b>0: A.append(b) S = -1 break elif b<0: A.append(b) S = 1 br...
s313738255
p03737
u078349616
1588908891
Python
Python (3.4.3)
py
Runtime Error
18
2940
63
a,b,c=map(int, input().split()) print((a[0]+b[0]+c[0]).upper())
s566766803
p03737
u802387801
1588215675
Python
Python (3.4.3)
py
Runtime Error
17
2940
119
A = int(input()) B = int(input()) if A > B: print('GREATER') elif A < B: print('LESS') else: print('EQUAL')
s523470690
p03737
u802387801
1588215467
Python
Python (3.4.3)
py
Runtime Error
17
2940
128
A = int(input()) B = int(input()) if A > B: print("GREAT") elif A < B: print("LESS") else: print("EQUAL")
s757888151
p03737
u802387801
1588214482
Python
Python (3.4.3)
py
Runtime Error
18
2940
103
s1,s2,s3 = map(int,input().split()) print(s1[0].capitalize() + s2[0].capitalize() + s3[0].capitalize())
s346711400
p03737
u802387801
1588214256
Python
Python (3.4.3)
py
Runtime Error
17
2940
102
s1,s2,s3 = map(int,input().split()) print(s1[0].capitalize() + s2[0].capitalize() + s3[0]capitalize())
s571904248
p03737
u830162518
1588035375
Python
Python (3.4.3)
py
Runtime Error
18
2940
61
a,b,c=input().split() print(a[0].upper+b[0].upper+c[0].upper)