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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s588001679 | p03617 | u018679195 | 1587158172 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 253 | a,b,c,d=map(int, input().split())
n=int(input)
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, c+b+2*a,c+4*a,4*a+2*b,b+6*a,3*b+2*a)
if(n%2==0) :
print((n//2)*twoltr)
else :
print(oneltr+((n-1)//2)*twoltr)
|
s989173238 | p03617 | u018679195 | 1587157951 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 244 | a,b,c,d=map(int, input().split)
n=int(input)
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, c+b+2*a,c+4*a,4*a+2*b,b+6*a,3*b+2*a)
if n%2==0 :
print((n//2)*twoltr)
else :
print(oneltr+two*(n-1)//2)
|
s085812018 | p03617 | u089230684 | 1587157633 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 258 | a,b,c,d=map(int, input().split)
n=int(input)
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, c+b+2*a,c+4*a,4*a+2*b,b+6*a,3*b+2*a)
if(n%2==0) :
print(n//2*twoltr)
else :
print(oneltr+(n-1)//2*twoltr)
|
s298851343 | p03617 | u749512407 | 1585263647 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 164 | Q,H,S,D = map(int,input().spllit())
N = int(input())
h = min(H , 2*Q)
s = min(2*h,S)
d = min(2*s,D)
if N % 2 == 0:
print((N//2 * d))
else:
print((N//2)*d + s) |
s549228400 | p03617 | u749512407 | 1585263560 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 164 | Q,H,S,D = map(int,input().spllit())
N = int(input())
h = min(H , 2*Q)
s = min(2*h,S)
d = min(2*s,D)
if N % 2 == 0:
print((N//2 * d))
else:
print((N//2)*d + s) |
s477766356 | p03617 | u749512407 | 1585263339 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 127 | Q,H,S,D = map(int,input().spllit())
N = int(input())
h = min(H , 2*Q)
s = min(2*h,S)
d = min(2*s,D)
print((N//2)*d + (N%2)*s) |
s105385741 | p03617 | u749512407 | 1585263064 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 125 | Q,H,S,D = map(int,input().spllit())
N = int(input())
h = min(2*Q,H)
s = min(2*h,S)
d = min(2*s,D)
print((N//2)*d + (N%2)*s) |
s142924404 | p03617 | u749512407 | 1585263036 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38408 | 125 | Q,H,S,D = map(int,input().spllit())
N = int(input())
h = min(2*Q,H)
s = min(2*h,S)
d = min(2*s,D)
print((N//2)*d + (N%2)*s) |
s068430416 | p03617 | u749512407 | 1585262795 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38384 | 265 | m = input().split()
Q = int(m[0])
H = int(m[1])
S = int(m[2])
D = int(m[3])
N = int(input())
list_1 = [S, 2*H, 4*D]
list_1.sort()
min_1 = list[0]
if D < (min_1 * 2):
total_cost = D * (N // 2) + min_1 * (N % 2)
else:
total_cost = min_1 * N
print(total_cost)
|
s534168952 | p03617 | u749512407 | 1585262708 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38384 | 265 | m = input().split()
Q = int(m[0])
H = int(m[1])
S = int(m[2])
D = int(m[3])
N = int(input())
list_1 = [S, 2*H, 4*D]
list_1.sort()
min_1 = list[0]
if D < (min_1 * 2):
total_cost = D * (N // 2) + min_1 * (N % 2)
else:
total_cost = min_1 * N
print(total_cost)
|
s788051614 | p03617 | u047102107 | 1585187555 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38512 | 78 | print((n // 2) * min(8 * q, 4 * h, 2 * s, d) + (n % 2) * min(4 * q, 2 * h, s)) |
s832684902 | p03617 | u620755587 | 1583032634 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2115 | 2096548 | 443 | q, h, s, d = map(int, input().split())
n = int(input())
n4 = n * 4
# jリットルになるようにしたi番目までの総和最小値
# dp[i][j] =
w = [1, 2, 4, 8]
v = [q, h, s, d]
dp = [[10**8+1]*(n4+1) for i in range(4)]
for i in range(4):
dp[i][0] = 0
for i in range(4):
for j in range(n4+1):
if j >= w[i] and i >= 1:
dp[i][j] = min(dp[i-1][j... |
s096853668 | p03617 | u620755587 | 1583032381 | Python | Python (3.4.3) | py | Runtime Error | 2121 | 2065396 | 430 | q, h, s, d = map(int, input().split())
n = int(input())
n4 = n * 4
# jリットルになるようにしたi番目までの総和最小値
# dp[i][j] =
w = [1, 2, 4, 8]
v = [q, h, s, d]
dp = [[10**9]*(n4+1) for i in range(4)]
for i in range(4):
dp[i][0] = 0
for i in range(4):
for j in range(n4+1):
if j >= w[i]:
dp[i][j] = min(dp[i-1][j], dp[i][j-w[... |
s159638437 | p03617 | u306142032 | 1578169463 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 117 | q,h,s,d=map(int,input().split())
n=int(input())
a=min(q*4,h*2,s)
b=min(q*8,h*4,s*2,d)
print(min(a*n,a*(n%2)+b*(n//2)) |
s440003719 | p03617 | u861141787 | 1578107956 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 323 | N = int(input())
PS = [[Q * 4, 0.25], [H * 2, 0.5], [S, 1], [D / 2, 2]]
PS.sort(key=lambda x: x[0])
# print(PS)
R = N
ans = 0
for i in range (4):
if R == 0:
break
elif R >= PS[i][1]:
ans += PS[i][0] * PS[i][1] * (R // PS[i][1])
R = R % PS[i][1]
# print("ans :", ans)
print(int(an... |
s356966481 | p03617 | u977642052 | 1577572264 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 249 | def main(q: int, h: int, s: int, d: int, n: int):
print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))
if __name__ == "__main__":
q, h, s, d = map(int, input().split())
n = int(input)
main(q, h, s, d, n)
|
s999528922 | p03617 | u814986259 | 1574962581 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 269 | price=list[map(int,input().split())]
k=[0.25,0.5,1.0,2.0]
N=int(input())
from itertools import permutations
ans=float("Inf")
for x in permutations([0,1,2,3]):
tmp=0
n=N
for y in x:
tmp+= (n//k[y])*price[y]
n=n%k[y]
ans=min(tmp,ans)
print(ans)
|
s324684789 | p03617 | u473291366 | 1566933265 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 146 | Q, H, S, D = map(int,input().split())
N = int(input())
if N % 2 == 1:
ans = min(4*Q,2*H,S)
ans += (N//2) * min(8*Q, 4*H, 2*S, D)
print(ans)
|
s284786388 | p03617 | u668503853 | 1566866689 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 97 | q,h,s,d=map(int,input().split())
N=int(input())
s=min(q*4,h*2,s)
print(min(s*N,d*(N//2)+a*(N%2))) |
s430590870 | p03617 | u623349537 | 1565879461 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 303 | Q, H, S, D = map(int, input().split())
N = int(input())
most_bargain = min(8 * Q, 4 * H, 2 * S, D)
if most_bargain != D:
print((most_bargain // 2) * N)
else:
if N % 2 == 0:
print((N // 2) * D)
else:
print((N // 2) * D + min(4 * Q, 2 * H, S))5410760474836152
1524157763907942 |
s957437282 | p03617 | u172111219 | 1563812736 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38384 | 161 | q,h,s,d = map(int,input().split())
n = int(input())
a = min([q*4,h*2,s])
if n%2==0:
print(min([a*n,int(b*n/2)]))
else:
print(min([a*n,int(b*(n-1)/2+a)])) |
s657026859 | p03617 | u463655976 | 1560119829 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 249 | VS = [(Y, Y*(2/q), q) for Y, q in ((int(input()), q) for q in (0.25, 0.5, 1, 2))]
N = int(input())
tanka = 0
for Y, _, q in sorted(VS, key=lambda x:x[1], reverse=True):
u = N // q
N -= q * u
tanka += Y * u
if N <= 0:
break
print(tanka)
|
s988362855 | p03617 | u509094491 | 1558760384 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 138 | Q,H.S,D=input().split()
N=input()
answer=(N/2) × min(8 ∗ Q, 4 ∗ H, 2 ∗ S, D) + (N mod 2) × min(4 ∗ Q, 2 ∗ H, S).
print(answer) |
s769374227 | p03617 | u509094491 | 1558760224 | Python | Python (3.4.3) | py | Runtime Error | 1711 | 518516 | 222 | answer=1000000000
q,h,s,d=input().split()
n=int(input())
qq=int(n/0.25)
hh=int(n/0.5)
ss=int(n)
dd=int(n/2)
i[0]=qq*q
i[1]=hh*h
i[2]=ss*s
i[3]=dd*d
for s in range(3):
if answer > i[s] :
answer=i[s]
print(answer) |
s384543290 | p03617 | u509094491 | 1558760150 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 227 | answer=1000000000
q,h,s,d=int(input().split())
n=int(input())
qq=int(n/0.25)
hh=int(n/0.5)
ss=int(n)
dd=int(n/2)
i[0]=qq*q
i[1]=hh*h
i[2]=ss*s
i[3]=dd*d
for s in range(3):
if answer > i[s] :
answer=i[s]
print(answer) |
s181023235 | p03617 | u368780724 | 1558224976 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38384 | 2210 | import bisect
import sys
from math import atan
def lis(L):
if not L:
return 0
seq = [L[0]]
for i in L[1:]:
if seq[-1] < i:
seq.append(i)
else:
seq[bisect.bisect_left(seq, i)] = i
return len(seq)
def mhd(x, y):
return abs(x) + abs(y)
x1, y1, x2, y2 = ... |
s811627893 | p03617 | u543954314 | 1553350648 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 239 | q,h,s,d = map(int,input().split())
r = [q,h,s,d]
n = int(input())*4
l = [q,h/2,s/4,d/8]
v = [1,2,4,8]
cost = 0
while n:
now = l2.index(min(l))
cost += n//v[now] * r[now]
n %= v[now]
v.pop(now)
r.pop(now)
l.pop(now)
print(cost)
|
s134944961 | p03617 | u543954314 | 1553350549 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 200 | q,h,s,d = map(int,input().split())
r = [q,h,s,d]
n = int(input())
l = [q,h/2,s/4,d/8]
cost = 0
while n:
now = l2.index(min(l))
cost += n//r[now]
n %= r[now]
r.pop(now)
l.pop(now)
print(cost) |
s709249288 | p03617 | u099918199 | 1538633963 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 903 | q,h,s,d = map(int, input().split())
n = int(input())
q_perf = q / 0.25
h_perf = h / 0.5
s_perf = s
d_perf = d / 2
list_amo = [0.25,0.5,1.0,2.0]
list_price = [q,h,s,d]
list_perf = [q_perf,h_perf,s_perf,d_perf]
cost = 0
ind4 = list_perf.index(min(list_perf))
ind3 = list_perf.index(min(list_perf[0:3]))
ind2 = list_perf.in... |
s531080753 | p03617 | u675317308 | 1534285838 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 533 | x1,y1,x2,y2=map(int,input().split())
fx=1
fy=1
if x1>x2:
x1,x2=x2,x1
fx=-1
if y1>y2:
y1,y2=y2,y1
fy=-1
n=int(input())
p=[]
for i in range(n):
x,y=map(int,input().split())
if x1<=x<=x2 and y1<=y<=y2:
p.append((fx*x,fy*y))
p=[y for x,y in sorted(p)]
from bisect import bisect_left as bl
b=[]
for y in p:
pos=b... |
s485347281 | p03617 | u858196007 | 1525663368 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 266 | Q,H,S,D = list(map(int,input().split()))
N = int(input())
if N%2 == 0:
A = (N/2) * min(Q*8,H*4,S*2,D)
else:
if N == 1:
A = min(Q*4,H*2,S)
else:
A = min(Q*4,H*2,S) + ((N-1)/2) * min(Q*8,H*4,S*2,D)
print(int(A)) |
s818258958 | p03617 | u858196007 | 1525663325 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 267 | Q,H,S,D = list(map(int,input().split()))
N = int(input())
if N%2 == 0:
A = (N/2) * min(Q*8,H*4,S*2,D)
else:
if: N == 1:
A = min(Q*4,H*2,S)
else:
A = min(Q*4,H*2,S) + ((N-1)/2) * min(Q*8,H*4,S*2,D)
print(int(A)) |
s217611699 | p03617 | u225528554 | 1515895572 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 464 | def main():
rt = 0
Q,H,S,D = map(int,input())
N = float(input())
count_1 = N//2
count_2 = (N-count_1)//1
count_3 = (N-count_1-count_2)*100//50
count_4 = (((N-count_1-count_2)*100)-50*count_3)//25
if count_1:
rt+=count_1*min(2*S,D,4*H,8*Q)
if count_2:
rt+=count_2*min(S,... |
s281117505 | p03617 | u495415554 | 1511619460 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 696 | # -*- coding: utf-8 -*-
import pulp
Q, H, S, D = map(int, input().split())
N = int(input())
problem = pulp.LpProblem('iceteastore', pulp.LpMinimize)
a = pulp.LpVariable('Qa', lowBound=0, cat='Integer')
b = pulp.LpVariable('Hb', lowBound=0, cat='Integer')
c = pulp.LpVariable('Sc', lowBound=0, cat='Integer')
d = pulp... |
s435286904 | p03617 | u636176595 | 1510006831 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 281 | l = map(int, raw_input().split())
N = raw_input
l[0] = Q
l[1] = H
l[2] = S
l[3] = D
if Q*2 > H:
M1 = H
else:
M1 = Q*2
if M1*2 > S:
M = S
else:
M = M1*2
if M*2 < D:
print(M*N)
else:
if N%2 == 0:
print(D*(N//2))
else:
print(D*(N//2) + M) |
s843522011 | p03617 | u636176595 | 1510006355 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 258 | Q, H, S, D, N = input(), input(), input(), input(), input()
if Q*2 > H:
M1 = H
else:
M1 = Q*2
if M1*2 > S:
M = S
else:
M = M1*2
if M*2 < D:
print(M*N)
else:
if N%2 == 0:
print(D*(N//2))
else:
print(D*(N//2) + M)
|
s443583211 | p03617 | u227888331 | 1506666089 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 1092 | from math import pi
input1 = list(map(int,input("").split(" ")))
N = int(input(""))
src = {"x":input1[0],"y":input1[1]}
dist = {"x":input1[2],"y":input1[3]}
spring = []
for i in range(N):
temp = list(map(int,input("").split(" ")))
if temp[0] in range(min(src['x'],dist['x']),max(src['x'],dist['x'])+1):
if temp[1] ... |
s510502456 | p03617 | u984838588 | 1506569859 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3064 | 371 | #get parameters
Qc, Hc, Sc, Dc = map(int, input().split())
Nv = input()
Nc = 0
# creat lists
Volumes = [0.25,0.50,1.00,2.00]
Costs = [Qc, Hc, Sc, Dc]
V_ = Nv
Number_bottles = [0,0,0,0]
for i in range(len(Volumes)):
Number_bottles[i] = V_//Volumes[i]
V_ = Volumes[i] * Number_bottles[i]
for i in range(len(Volumes)):... |
s898449368 | p03617 | u937164028 | 1506496569 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1088 | import math
if __name__ == '__main__':
Q, H, S, D = map(int, input().split())
N = int(input())
q, h ,s ,d = [0.25, 0.5, 1, 2]
cost_d = math.inf
cost_s = math.inf
cost_h = math.inf
cost_q = math.inf
if N > d:
N_d=N
while N_d > d:
N_d -= d
cost_d +... |
s294830568 | p03617 | u937164028 | 1506496240 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1046 | if __name__ == '__main__':
Q, H, S, D = map(int, input().split())
N = int(input())
q, h ,s ,d = [0.25, 0.5, 1, 2]
cost_d = 0
cost_s = 0
cost_h = 0
cost_q = 0
if N > d:
N_d=N
while N_d > d:
N_s -= d
cost_d += D
while N_d > s:
N_s... |
s495302724 | p03617 | u937164028 | 1506496138 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1046 | if __name__ == '__main__':
Q, H, S, D = map(int, input().split())
N = int(input())
q, h ,s ,d = [0.25, 0.5, 1, 2]
cost_d = 0
cost_s = 0
cost_h = 0
cost_q = 0
if N > d:
N_d=N
while N_d > d:
N_s -= d
cost_d += D
while N_d > s:
N_s... |
s239436273 | p03617 | u040276237 | 1506005448 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2692 | 1112 | #coding:UTF-8
#
#問題:AtCoder Grand Contest019 #A Ice Tea Store
#
#手法:入力Nは整数で与えられるので、Nが2以上のときは2リットル当たりの値段が安いドリンクをN/2個買い、
#Nが奇数だったら、残りの1リットルは1リットル当たりの値段が安いドリンク買う
sum=0#合計金額
#入力(0.25リットル,0.5リットル,1リットル,2リットル)
Q,H,S,D=input().split()
Q=int(Q)
H=int(H)
S=int(S)
D=int(D)
#入力チェック
if not(1<=Q<=10**8 and 1<=H<=10**8 and 1<=S<=10*... |
s823618072 | p03617 | u735154525 | 1503851183 | Python | Python (2.7.6) | py | Runtime Error | 2452 | 2002052 | 838 | n025, n05, n1, n2 = map(int, raw_input().split())
n = input()
ans = [0 for i in range(4)]
if n >= 2:
arr = []
arr.append(n025 * 8)
arr.append(n05 * 4)
arr.append(n1 * 2)
arr.append(n2)
for i in range(n / 2):
m = arr.index(min(arr))
if m == 0:
ans[m] += 8
eli... |
s552498161 | p03617 | u772180901 | 1503804399 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 454 | q,h,s,d = map(int,input().split())
n = int(input())
n = n * 1000
a = 2000
b = 1000
c = 500
d2 = 250
tmp = int(n % a)
ans = int(n / a) * d
def max
if tmp > 0:
ans1 = int(tmp/b) * s
ans += int(tmp/b) * s
tmp = int(tmp % b)
if tmp > 0:
ans2 = int(tmp / c) * h
tmp += int(tmp % c) * h
tmp = int(tmp... |
s634602289 | p03617 | u264362411 | 1503803551 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2572 | 11 | contest1.py |
s766103960 | p03617 | u341926204 | 1503803381 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 406 | def one_row():
res = tuple(map(int, input().split()))
return res
def multi_rows(n):
return [one_line() for _ in range(
def a():
import numpy as np
q, h, s, d = one_row()
l = [.25, .5, 1, 2]
p = [q, h, s, d]
n = int(input())
price = [q*8, h*4, s*2, d]
order = np.argsort(price)
total = 0
for i in order:
ti... |
s146870197 | p03617 | u177721681 | 1503803282 | Python | Python (2.7.6) | py | Runtime Error | 2111 | 118396 | 1888 | import sys
import math
def link( pool, f):
def subset( a, b):
return a[0] > b[0] and a[1] > b[0]
notsubset = []
max_value = 0
for n,p in enumerate(pool): ##(X, Y, V)
if subset(p[:2], f):
max_value = max(max_value, p[2])
else:
notsubset.append(n)
new_po... |
s421414570 | p03617 | u443170850 | 1503798830 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1193 | Q, H, S, D = input().split()
Q, H, S, D = int(Q), int(H), int(S), int(D) # price 0.25 0.5 1.0 2.0
N = int(input())
per_2l_price = [Q*8, H*4, S*2, D]
per_1l_price = [Q*4, H*2, S]
per_05_price = [Q*2, H]
per_025_price = [Q]
needtobuy_l = N
needtobuy_m = 0
def st_min(lt):
min_num = 0
min_ = 10000000000000000000... |
s393364789 | p03617 | u762008592 | 1503798413 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 484 | a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())
if M[0]==min(M):
print(N*M[0])
elif M[1]==min(M):
print(N*M[1])
elif M[2]==min(M):
print(N*M[2])
else:
if N%2==0:
print(int(N//2*int(M[3]*2))
else:
if M[0]==min([4*a,2*b,c]):
print(N//2*int(M[3]*2... |
s084023503 | p03617 | u777923818 | 1503796536 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 277 | volume = [1,2,4, 8]
value = tuple(map(int, input().split())
N = int(input())
counts = [10**10 for _ in range(N*4 + 1)]
counts[0] = 0
for i in range(4):
for n in range(volume[i], N*4+1):
counts[n] = min(counts[n], counts[n-volume[i]] + value[i])
print(counts[-1]) |
s305252543 | p03617 | u280269055 | 1503796227 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 167 | q,h,s,d = int(input().strip().split())
n = int(input())
h = min(h, q*2)
s = min(s, h*2)
d = min(d, s*2)
d_num, s_num = n//2, n%2
cost = d_num*d + s_num*s
print(cost) |
s511119103 | p03618 | u119148115 | 1599443375 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 75976 | 1074 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def S(): return s... |
s924345547 | p03618 | u145231176 | 1597509956 | Python | Python (3.8.2) | py | Runtime Error | 38 | 11292 | 1423 | def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(input()) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
return random.randint(ran1,... |
s345238597 | p03618 | u588794534 | 1597371199 | Python | Python (3.8.2) | py | Runtime Error | 70 | 10476 | 159 | a=list(input())
unko=[0]*(ord("z")+1-ord("a"))
for aa in a:
unko[ord(aa)-ord("a")]+=1
tmp=0
for u in unko:
tmp+=(u*(u-1))//2
print((n*(n-1))//2-tmp) |
s083057494 | p03618 | u559126797 | 1593099703 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9272 | 126 | A = input()
ans = 1
for i in range(len(A)):
for j in range(j,len(A)):
if A[i] != A[j]:
ans += 1
print(ans)
|
s019480354 | p03618 | u559126797 | 1593099667 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9332 | 125 | A = input()
ans = 1
for i in range(len(A)):
for j in range(len(j,A)):
if A[i] != A[j]:
ans += 1
print(ans) |
s280520859 | p03618 | u538632589 | 1591766234 | Python | Python (3.4.3) | py | Runtime Error | 99 | 3500 | 179 | a = input()
n = len(a)
cnt = [0]*(ord('z')-ord('a'))
res = 0
for s in a:
idx = ord(s) - ord('a')
res += cnt[idx]
cnt[idx]+= 1
ans = (n*(n-1)/2)-res+1
print(int(ans)) |
s832086179 | p03618 | u572142121 | 1584105221 | Python | Python (3.4.3) | py | Runtime Error | 761 | 5436 | 308 | A=input()
cnt={chr(code): 0 for code in range(ord('a'),ord('z')+1)}
for i in A:
cnt[i]+=1
from math import factorial
def c(n,r):
return factorial(n)/factorial(r)/factorial(n - r)
a=len(A)
if a==1:
print(1)
exit()
b=0
for i in cnt.values():
if i>=2:
b+=i*(i-1)//2
ans=int(c(a,2)-b)
print(ans+1) |
s063076138 | p03618 | u572142121 | 1584105153 | Python | Python (3.4.3) | py | Runtime Error | 756 | 5428 | 279 | A=input()
cnt={chr(code): 0 for code in range(ord('a'),ord('z')+1)}
for i in A:
cnt[i]+=1
from math import factorial
def c(n,r):
return factorial(n)/factorial(r)/factorial(n - r)
a=len(A)
b=0
for i in cnt.values():
if i>=2:
b+=i*(i-1)//2
ans=int(c(a,2)-b)
print(ans+1) |
s209804688 | p03618 | u905582793 | 1579056145 | Python | Python (3.4.3) | py | Runtime Error | 24 | 5220 | 137 | from collections import Counter
s=list(input())
n=len(s)
c=s.Counter()
ans=1+n*(n-1)//2
for i in c.values():
ans-=i*(i-1)//2
print(ans) |
s142485676 | p03618 | u671481129 | 1578831745 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 2207 | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define INF (int)1e9
typedef long long int int64;
void print() {
cout << endl;
}
void print(const char* s, bool endline = true) {
cout << s;
if (endline) print();
}
void print(char s, bool ... |
s098012329 | p03618 | u073852194 | 1578073417 | Python | Python (3.4.3) | py | Runtime Error | 75 | 3500 | 195 | A = input()
char = [0 for _ in range(26)]
for i in range(len(A)):
char[ord(A[i])-96] += 1
ans = 1
for i in range(25):
for j in range(i+1,26):
ans += char[i]*char[j]
print(ans) |
s362041349 | p03618 | u780962115 | 1570553137 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 284 | s=input()
def cal(n):
if len(s)==1:
return 0
else:
new=s[0]
ans=0
cnt=0
for i in range(1,n):
if s[i]!=new:
new=s[i]
cnt=0
ans+=(i+1)
else: s[i]==new:
cnt+=1
ans+=cnt
return ans
|
s845180654 | p03618 | u677523557 | 1569433075 | Python | Python (3.4.3) | py | Runtime Error | 1349 | 690292 | 403 | from collections import Counter
import sys
sys.setrecursionlimit(5000000)
S = list(input())
L = len(S)
A = Counter(S)
nCr = {}
def cmb(n, r):
if r == 0 or r == n: return 1
if r == 1: return n
if (n,r) in nCr: return nCr[(n,r)]
nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
return nCr[(n,r)]
ans = cmb(L, ... |
s304589821 | p03618 | u677523557 | 1569432975 | Python | Python (3.4.3) | py | Runtime Error | 1364 | 690292 | 403 | from collections import Counter
import sys
sys.setrecursionlimit(1000000)
S = list(input())
L = len(S)
A = Counter(S)
nCr = {}
def cmb(n, r):
if r == 0 or r == n: return 1
if r == 1: return n
if (n,r) in nCr: return nCr[(n,r)]
nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
return nCr[(n,r)]
ans = cmb(L, ... |
s446527366 | p03618 | u551909378 | 1568967273 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4840 | 342 | A = list(input())
N, ans = len(A), 0
for i in range(1, N-1):
j = 1
while i-j >= 0 and i+j-1 < N:
if A[i-j] == A[i+j-1]:
ans += 1
j += 1
j = 1
while i-j >= 0 and i+j < N:
if A[i-j] == A[i+j]:
ans += 1
j += 1
if A[-1] == A[-2]:
ans += 1
print... |
s571524417 | p03618 | u623687794 | 1568161509 | Python | Python (3.4.3) | py | Runtime Error | 32 | 3756 | 193 | from collections import Counter
a=input()
c=Counter(a)
if n==1:print(1)
else:
ans=n*(n-1)//2
for i in c.values():
if i==1:continue
else:ans-=i*(i-1)//2
print(ans+1)
|
s486520880 | p03618 | u623687794 | 1568161204 | Python | Python (3.4.3) | py | Runtime Error | 956 | 19612 | 767 | from collections import Counter
a=input()
c=Counter(a)
MOD = 10**9+7
n=len(a)
def inv_mod(a, p=MOD):
def inv_mod_sub(a, p):
if a == 1:
return 1, 0
else:
d, r = p//a, p%a
x, y = inv_mod_sub(r, a)
return y-d*x, x
if p < 0: p = -p
a %= p
retur... |
s206931642 | p03618 | u543954314 | 1553272477 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 129 | from collections import Count
s = input()
n = len(s)
d = Count(s)
c = 0
for x in d:
c += d[x]*(d[x]-1)//2
print(n*(n-1)//2 - c) |
s600681742 | p03618 | u667024514 | 1539862671 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3500 | 194 | n = str(input())
lis = [0 for i in range(26)]
ans = 1
for i in range(1,len(n)+1):
ans += i
lis[ord(n[i])-"a"] += 1
for i in range(26):
for k in range(lis[i]-1):
ans -= (k+1)
print(ans) |
s517821712 | p03618 | u924406834 | 1539232640 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 169 | strs = [x for x in input()]
ans = 1
for i in range(len(strs)):
for j in range(i+1,len(strs)+1):
if strs[i] == strs[j]:
pass
else:
ans ++
print(ans) |
s446329520 | p03618 | u427014358 | 1530518727 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 281 | a = input()
freq = [0 for __ in range(26)]
for i in range(len(a)):
freq[ord(a[i]) - ord('a')] += 1
n = len(a)
# total number of pairs
total_pairs = n * (n - 1) / 2
for x in freq:
# total number of pairs with i-th character equal
total_pairs -= x * (x - 1) / 2
print total_pairs |
s618383010 | p03618 | u856232850 | 1524958807 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 6040 | 174 | import math
a = input()
b = len(a)
c = math.factorial(b) // (math.factorial(b - 2) * math.factorial(2)) +1
for i in a:
d = (a.count(i) - 1)*0.5
c -= d
print(int(c)) |
s527125403 | p03618 | u161911516 | 1506627241 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 711 | words = raw_input()
N = len(words)
word = list(words)
print word
ans = 0
def before_after(i, j):
count = 0
print "関数呼び出し"
print i
print j
for k in range (0, j-i+1):
print word[i+k-1]
print word[j-k-1]
if(word[i+k-1] == word[j-k-1]):
count += 1
print "count is " + str(count)
if(c... |
s699523988 | p03618 | u343128979 | 1504294637 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 135844 | 231 | str = list(input())
ans = 0
for i in range(len(str)):
for j in range(i, len(str)+1, 1):
if str[i:j] != list(reversed(str[i:j])):
print (str[i:j], list(reversed(str[i:j])))
ans += 1
print (ans+1)
|
s717572906 | p03618 | u280269055 | 1503802919 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 3500 | 592 | A = input()
l = len(A)
count = 1 + l*(l-1)//2
j = 1
if A[1] == A[0]:
count -= 1
for i in range(2,l):
if A[i] == A[i-1]:
while i-j:
if i+j == l:
break
elif A[i+j] == A[i-j-1]:
j += 1
else:
break
count -=... |
s308804977 | p03618 | u280984565 | 1503801020 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3500 | 169 | s = input()
count = 1
for i in range(1, len(s)):
ss = s[0:i]
# print(ss, s[i])
n = len(ss) - ss.count(s[i])
count += n
# print(n, count)
print(n)
|
s412233378 | p03619 | u002023395 | 1583973017 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1590 | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
const double PI = acos(-1.0);
template<typename T>
int LIS(const vector<T>& v){
if(v.empty()) return 0;
vector<T> a(v.size(), v[0]);
auto end = a.begin();
++end;
for(int i=1;i<v.size();i++... |
s279976247 | p03619 | u218843509 | 1583134502 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1329 | 123996 | 1880 | import sys
pi = 3.1415926535897932384626
def input():
return sys.stdin.buffer.readline()[:-1]
class Rmax():
def __init__(self, size):
#the number of nodes is 2n-1
self.n = 1
while self.n < size:
self.n *= 2
self.node = [0] * (2*self.n-1)
def Access(self, x):
return self.node[x+self.n-1]
def Update(... |
s312464350 | p03619 | u440566786 | 1577224409 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1131 | 71260 | 935 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from math import pi
from bisect import bisect_left
def resolve():
x1,y1,x2,y2=map(int,input().split())
if(x1>x2): x1,y1,x2,y2=x2,y2,x1,y1 # x1<=x2
trans=False
if(y1>y2):
y1,y2=10*... |
s844761193 | p03619 | u440566786 | 1577223163 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1118 | 71260 | 919 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from math import pi
from bisect import bisect_left
def resolve():
x1,y1,x2,y2=map(int,input().split())
if(x1>x2): x1,y1,x2,y2=x2,y2,x1,y1 # x1<=x2
trans=False
if(y1>y2):
y1,y2=10*... |
s975595297 | p03619 | u368780724 | 1558223428 | Python | PyPy3 (2.4.0) | py | Runtime Error | 850 | 105300 | 1874 | import bisect
import sys
from math import atan
def lis(L):
seq = [L[0]]
for i in L[1:]:
if seq[-1] < i:
seq.append(i)
else:
seq[bisect.bisect_left(seq, i)] = i
return len(seq)
def mhd(x, y):
return abs(x) + abs(y)
x1, y1, x2, y2 = map(int, sys.stdin.readline().s... |
s709890691 | p03619 | u761320129 | 1536851435 | Python | Python (3.4.3) | py | Runtime Error | 1034 | 32288 | 1286 | import math
from bisect import bisect
x1,y1,x2,y2 = map(int,input().split())
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
if x1 > x2:
x1,x2 = x2,x1
y1,y2 = y2,y1
arc = 5 * math.pi
if x1 == x2:
if y1 > y2:
y1,y2 = y2,y1
ans = 100 * (y2-y1)
for x,y in... |
s895069543 | p03619 | u761320129 | 1536851299 | Python | Python (3.4.3) | py | Runtime Error | 1163 | 32488 | 1285 | import math
from bisect import bisect
x1,y1,x2,y2 = map(int,input().split())
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
if x1 > x2:
x1,x2 = x2,x1
y1,y2 = y2,y1
arc = 5 * math.pi
if x1 == x2:
if y1 > y2:
y1,y2 = y2,y1
ans = 100 * (y2-y1)
for x,y in... |
s562029652 | p03619 | u761320129 | 1536851159 | Python | Python (3.4.3) | py | Runtime Error | 1069 | 32356 | 1306 | import math
from bisect import bisect
x1,y1,x2,y2 = map(int,input().split())
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
if x1 > x2:
x1,x2 = x2,x1
y1,y2 = y2,y1
arc = 5 * math.pi
if x1 == x2:
if y1 > y2:
y1,y2 = y2,y1
ans = 100 * (y2-y1)
for x,y in... |
s007041101 | p03619 | u761320129 | 1536850838 | Python | Python (3.4.3) | py | Runtime Error | 1146 | 44256 | 1321 | import math
from bisect import bisect
x1,y1,x2,y2 = map(int,input().split())
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
if x1 > x2:
x1,x2 = x2,x1
y1,y2 = y2,y1
arc = 5 * math.pi
if x1 == x2:
if y1 > y2:
y1,y2 = y2,y1
ans = 100 * (y2-y1)
for x,y in... |
s611878669 | p03619 | u391475811 | 1519076443 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 39692 | 783 | import math
M=[int(x) for x in input().split()]
N=int(input())
xd=abs(M[0]-M[2])
yd=abs(M[1]-M[3])
F=[]
for i in range(N):
a,b=map(int,input().split())
if min(M[0],M[2])<= a <= max(M[0],M[2]) and min(M[1],M[3])<= b <= max(M[1],M[3]):
F.append([a,b])
F.sort(key=lambda x:x[0])
dp=[200001 for x in range(len(F)+1)... |
s646064730 | p03619 | u391475811 | 1519074471 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 39692 | 781 | import math
M=[int(x) for x in input().split()]
N=int(input())
xd=abs(M[0]-M[2])
yd=abs(M[1]-M[3])
F=[]
for i in range(N):
a,b=map(int,input().split())
if min(M[0],M[2])<= a <= max(M[0],M[2]) and min(M[1],M[3])<= b <= max(M[1],M[3]):
F.append([a,b])
F.sort(key=lambda x:x[0])
dp=[200000 for x in range(len(F))]
... |
s045240675 | p03619 | u391475811 | 1518801140 | Python | Python (3.4.3) | py | Runtime Error | 2136 | 526536 | 704 | import math
M=[int(x) for x in input().split()]
N=int(input())
xd=abs(M[0]-M[2])+1
yd=abs(M[1]-M[3])+1
dp=[[0 for i in range(yd)] for j in range(xd)]
res=0
for i in range(N):
a,b=map(int,input().split())
if min(M[0],M[2])<= a <= max(M[0],M[2]) and min(M[1],M[3])<= b <= max(M[1],M[3]):
dp[a-min(M[0],M[2])][b-mi... |
s847161080 | p03619 | u391475811 | 1518800405 | Python | Python (3.4.3) | py | Runtime Error | 2139 | 526536 | 700 | import math
M=[int(x) for x in input().split()]
N=int(input())
xd=abs(M[0]-M[2])+1
yd=abs(M[1]-M[3])+1
dp=[[0 for i in range(yd)] for j in range(xd)]
res=0
for i in range(N):
a,b=map(int,input().split())
if min(M[0],M[2])<= a <= max(M[0],M[2]) and min(M[1],M[3])<= b <= max(M[1],M[3]):
dp[a-min(M[0],M[2])][b-mi... |
s368575344 | p03619 | u391475811 | 1518800020 | Python | Python (3.4.3) | py | Runtime Error | 2141 | 526536 | 699 | import math
M=[int(x) for x in input().split()]
N=int(input())
xd=abs(M[0]-M[2])+1
yd=abs(M[1]-M[3])+1
dp=[[0 for i in range(yd)] for j in range(xd)]
res=0
for i in range(N):
a,b=map(int,input().split())
if min(M[0],M[2])<= a <= max(M[0],M[2]) and min(M[1],M[3])<= b <= max(M[1],M[3]):
dp[a-min(M[0],M[2])][b-mi... |
s603686525 | p03619 | u227888331 | 1506997231 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1473 | from math import pi
input1 = list(map(int,input("").split(" ")))
N = int(input(""))
xs = [ input() for _ in range(N) ]
src_x = input1[0]
src_y = input1[1]
dist_x = input1[2]
dist_y = input1[3]
spring = []
for i in range(N):
temp = list(map(int,xs[i].split(" ")))
if (src_x <= temp[0]) and (temp[0] <= dist_x) or (dis... |
s534274053 | p03619 | u227888331 | 1506991742 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 80404 | 1361 | from math import pi
input1 = list(map(int,input("").split(" ")))
N = int(input(""))
src = {"x":input1[0],"y":input1[1]}
dist = {"x":input1[2],"y":input1[3]}
spring = []
for i in range(N):
temp = list(map(int,input("").split(" ")))
if temp[0] in range(min(src['x'],dist['x']),max(src['x'],dist['x'])+1):
if temp[1] ... |
s141093019 | p03619 | u227888331 | 1506664532 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1100 | from math import pi
input1 = list(map(int,input("").split(" ")))
N = int(input(""))
src = {"x":input1[0],"y":input1[1]}
dist = {"x":input1[2],"y":input1[3]}
spring = []
for i in range(N):
temp = list(map(int,input("").split(" ")))
if temp[0] in range(min(src['x'],dist['x']),max(src['x'],dist['x'])+1):
if temp[1] ... |
s889966155 | p03619 | u340781749 | 1504021944 | Python | Python (3.4.3) | py | Runtime Error | 928 | 38036 | 1435 | import operator
from bisect import bisect_left
from math import pi
import decimal
def lis(A):
L = [A[0]]
for a in A[1:]:
if a > L[-1]:
L.append(a)
else:
L[bisect_left(L, a)] = a
return len(L)
def solve():
x1, y1, x2, y2 = map(int, input().split())
if x1 > ... |
s835736246 | p03619 | u667084803 | 1503918864 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 647 | def LIS(L):
from bisect import bisect
seq=[]
for i in L:
pos=bisect(seq,i)
if len(seq)<=pos:
seq.append(i)
else:
seq[pos]=i
return len(seq)
import math
x1,y1,x2,y2=map(int,input().split())
N=int(input())
W=abs(x2-x1)
H=abs(y2-y1)
xsgn=2*(x2>x1)-1
ysgn=2*(y2>y1)-1
XY=[]
for i in range(N):... |
s003229333 | p03619 | u667084803 | 1503918847 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 648 | def LIS(L):
from bisect import bisect
seq=[]
for i in L:
pos=bisect(seq,i)
if len(seq)<=pos:
seq.append(i)
else:
best[seq]=i
return len(seq)
import math
x1,y1,x2,y2=map(int,input().split())
N=int(input())
W=abs(x2-x1)
H=abs(y2-y1)
xsgn=2*(x2>x1)-1
ysgn=2*(y2>y1)-1
XY=[]
for i in range(N)... |
s228214275 | p03619 | u556812955 | 1503804521 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1090 | 93540 | 1607 | from sys import stdin
from math import pi
# 그냥 가면 100(|x1 - x2| + |y1 - y2|)
# junction 통과할 때마다 답이 좋아짐. 이 개수를 늘려야?
C = 100
J90 = -20 + pi * 2*10/4
J180 = -20 + pi * 2*10/2
x1, y1, x2, y2 = map(int, stdin.readline().split())
N = int(stdin.readline())
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = map(int,... |
s831003292 | p03619 | u556812955 | 1503804493 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1052 | 93496 | 1605 | from sys import stdin
from math import pi
# 그냥 가면 100(|x1 - x2| + |y1 - y2|)
# junction 통과할 때마다 답이 좋아짐. 이 개수를 늘려야?
C = 100
J90 = -20 + pi * 2*10/4
J180 = -20 + pi * 2*10/2
x1, y1, x2, y2 = map(int, stdin.readline().split())
N = int(stdin.readline())
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = map(int,... |
s870216295 | p03619 | u382748202 | 1503804314 | Python | Python (3.4.3) | py | Runtime Error | 2154 | 1564944 | 1629 | import math
def step(cur_y, cur_idx, S, dp, end_y):
if cur_idx >= len(S):
return
for idx, (x, y) in enumerate(S[cur_idx:], cur_idx):
if cur_y <= y and dp[y] < dp[cur_y] + 1:
dp[y] = dp[cur_y] + 1
step(y, idx + 1, S, dp, end_y)
x_1, y_1, x_2, y_2 = map(int, input().split... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.