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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s307591523 | p03700 | u658993896 | 1542939774 | Python | Python (3.4.3) | py | Runtime Error | 196 | 7068 | 1127 | import math
"""
def search(min_,max_,A,B,arr):
# print(min_,max_)
if min_==max_:
return min_
mid=(max_+min_)//2
tmp=arr-mid*B
if len(tmp)==0:
return search(min_,mid,A,B,arr)
tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
sum_=sum(list(tmp))
if sum_<=mid:
r... |
s071722271 | p03700 | u658993896 | 1542939304 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 19232 | 1219 | import numpy as np
import math
"""
def search(min_,max_,A,B,arr):
# print(min_,max_)
if min_==max_:
return min_
mid=(max_+min_)//2
tmp=arr-mid*B
if len(tmp)==0:
return search(min_,mid,A,B,arr)
tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
sum_=sum(list(tmp))
if s... |
s834251894 | p03700 | u658993896 | 1542939219 | Python | Python (3.4.3) | py | Runtime Error | 219 | 8284 | 427 | N,A,B=list(map(int,input().split()))
arr=[]
for i in range(N):
h=int(input())
arr.append(h)
arr=sorted(arr,reverse=True)
arr=np.array(arr)
max_=arr[0]//B+1
min_=arr[-1]//A
while min_!=max_:
mid=(max_+min_)//2
tmp=arr-mid*B
tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
sum_=sum(list(tmp))
... |
s077113770 | p03700 | u658993896 | 1542852048 | Python | Python (3.4.3) | py | Runtime Error | 397 | 17480 | 856 | import numpy as np
def search(min_,max_,A,B,arr):
if min_==max_:
return min_
mid=(max_+min_)//2
tmp=arr[:]
tmp+=mid*B
k=mid
if len(tmp)==0:
return search(min_,mid,A,B,arr)
tmp=tmp[tmp<0]
L=len(tmp)
while True:
x=-tmp.pop()
k-=x//(A... |
s912266411 | p03700 | u658993896 | 1542851198 | Python | Python (3.4.3) | py | Runtime Error | 249 | 8296 | 749 | def search(min_,max_,A,B,arr):
if min_==max_:
return min_
mid=(max_+min_)//2
tmp=np.array(arr)
tmp+=mid*B
k=mid
if len(tmp)==0:
return search(min_,mid,A,B,arr)
tmp=list(tmp[tmp<0])
while True:
x=-tmp.pop()
k-=x//(A-B)+(x%(A-B)>0)
... |
s587624650 | p03700 | u214617707 | 1540862704 | Python | Python (3.4.3) | py | Runtime Error | 1358 | 7088 | 433 | import math
N, A, B = map(int, input().split())
H = []
for i in range(N):
h = int(input())
H.append(h)
def enough(T):
num = 0
for i in range(N):
if H[i] >= B * T:
num += math.ceil((H[i] - B * T) / (A - B))
return T > num
left, right = 1, max(H) // B + 1
while right - left > 1... |
s836225940 | p03700 | u214617707 | 1540862521 | Python | Python (3.4.3) | py | Runtime Error | 1427 | 7068 | 432 | import math
N, A, B = map(int, input().split())
H = []
for i in range(N):
h = int(input())
H.append(h)
def enough(T):
num = 0
for i in range(N):
if H[i] >= B * i:
num += math.ceil((H[i] - B * T) / (A - B))
return T > num
left, right = 1, max(H) // B + 1
while right - left > 1... |
s727601313 | p03700 | u170201762 | 1540673941 | Python | Python (3.4.3) | py | Runtime Error | 206 | 7384 | 418 | N,A,B=map(int,input().split())
H = [int(input()) for i in range(N)]
H.sort()
from math import ceil
def KnockOut(t):
base = B*t
res = 0
for i in range(j,N):
h = H[i]
h -= base
if h > 0:
res += ceil(h/(A-B))
return res <= t
l = 1
r = ceil(sum(H)/(N*B))
while l != r-1:
... |
s238964495 | p03700 | u853900545 | 1538341929 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 7392 | 247 | n,a,b = map(int,input().split())
h = list(int(input()) for i in range(n))
h.sort(reverse=True)
cnt = 0
while h[0]>0:
cnt +=1
h[0] -= a
for i in range(1,n):
h[i] -= b
if h[0] < h[1]:
h[0],h[1] = h[1],h[0]
print(cnt) |
s939663451 | p03700 | u853900545 | 1538341618 | Python | Python (3.4.3) | py | Runtime Error | 227 | 7492 | 224 | n,a,b = map(int,input().split())
h = list(int(input()) for i in range(n))
h.sort(reverse=True)
cnt = 0
while h[0]>0:
cnt +=1
h[i] -= a
for j in range(i+1,n):
h[j] -= b
h.sort(reverse=True)
print(cnt) |
s206455504 | p03700 | u667024514 | 1537274068 | Python | Python (3.4.3) | py | Runtime Error | 242 | 7072 | 413 | n,a,b = map(int,input().split())
lis = [int(input()) for i in range(n)]
more = a-b
def tansaku(x):
cou = 0
normal = b * x
for hp in lis:
r = hp -normal
if r <= 0:continue
cou += r // more
if r % more != 0:
cou += 1
return cnt <= t
left = 1
right = max(lis)
while right - left > 1:
... |
s197663089 | p03700 | u667024514 | 1537274031 | Python | Python (3.4.3) | py | Runtime Error | 187 | 7072 | 411 | n,a,b = map(int,input().split())
lis = [int(input()) for i in range(n)]
more = a-b
def tansaku(x):
cou = 0
normal = b * x
for hp in lis:
r = hp -normal
if r <= 0:continue
cou += r // more
if r % ab != 0:
cou += 1
return cnt <= t
left = 1
right = max(lis)
while right - left > 1:
mi... |
s632703947 | p03700 | u419686324 | 1534563516 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 881 | N, M = map(int, input().split())
def bf(links, n, st=1):
inf = float('inf')
dj = [inf] * (n + 1)
dj[st] = 0
for i in range(N):
updated = False
for link in links:
fn, tn, lc = link
lc *= -1
if dj[fn] + lc < dj[tn]:
dj[tn] = dj[fn] + lc
... |
s461914329 | p03700 | u419686324 | 1533704494 | Python | Python (3.4.3) | py | Runtime Error | 965 | 29860 | 435 | N, A, B = map(int, input().split())
H = sorted(int(input()) for _ in range(N))
import bisect, math
def f(ll, ul):
if ul - ll == 1: return ll
cur = (ll + ul) // 2
r = H[bisect.bisect_right(H, B * cur):]
p = sum(math.ceil((x - B * cur) / (A - B)) for x in r)
if p == cur:
return cur
elif ... |
s009269682 | p03700 | u966000628 | 1510345021 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 280 | n,a,b = map(int,input().split())
h = []
for i in range(n):
x = int(input())
h.append(x)
count = 0
while max(h) > 0:
if max(h) % a == 0:
hit = int(max(h)/a)
else:
hit = int(max(h)/a)+1
h[list.index(max(h))] = 0
h = list(map(lambda x: x-(b*hit),h)
count += hit
print hit |
s632976890 | p03700 | u047535298 | 1503427699 | Python | Python (3.4.3) | py | Runtime Error | 1325 | 7120 | 423 | from math import ceil
n, a, b = map(int, input().split())
h = [int(input()) for i in range(n)]
def enough(t):
count = 0
for hp in h:
count += ceil(max(0, hp - b*t) / (a-b))
if(count <= t):
return True
else:
return False
high = ceil(max(h)/b)
low = 0
while(high - low > 1):
... |
s924651800 | p03700 | u846372029 | 1498931208 | Python | Python (3.4.3) | py | Runtime Error | 188 | 7076 | 535 | # Widespread
n,a,b = list(map(int, input().split()))
h = []
for i in range(n):
h.append(int(input()))
import math as m
def check(ary, num, a, b):
bommed = [(hi- b*num) for hi in h if (hi- b*num)>0]
acnt = sum([m.ceil(hi/(a-b)) for hi in bommed])
if acnt > num:
return "NO"
else:
... |
s995060800 | p03700 | u846372029 | 1498930979 | Python | Python (3.4.3) | py | Runtime Error | 185 | 7076 | 547 | # Widespread
n,a,b = list(map(int, input().split()))
h = []
for i in range(n):
h.append(int(input()))
# やり直し
import math as m
def check(ary, num, a, b):
bommed = [(hi- b*num) for hi in h if (hi- b*num)>0]
acnt = sum([m.ceil(hi/(a-b)) for hi in bommed])
if acnt > num:
return "NO"
else:
... |
s403886836 | p03700 | u846372029 | 1498930920 | Python | Python (3.4.3) | py | Runtime Error | 188 | 7196 | 546 | # Widespread
n,a,b = list(map(int, input().split()))
h = []
for i in range(n):
h.append(int(input()))
# やり直し
import math as m
def check(ary, num, a, b):
bommed = [(hi- b*num) for hi in h if (hi- b*num)>0]
acnt = sum([m.ceil(hi/(a-b)) for hi in bommed])
if acnt > num:
return "NO"
else:
... |
s404818300 | p03700 | u817328209 | 1498718043 | Python | Python (3.4.3) | py | Runtime Error | 348 | 13256 | 328 | import numpy as np
import math
N,A,B = map(int, input().split())
h = np.zeros(N)
for i in range(N) :
h[i] = int(input())
ans = 0
mn = 0
mx = np.ceil(h.max()/B)
now = mx//2
while (mx-mn) > 1 :
if now >= sum(np.ceil(tmp[tmp>0]/(A-B))) :
mx = now
else :
mn = now
now = (mx+mn)//2
print(... |
s346686347 | p03700 | u817328209 | 1498717992 | Python | Python (3.4.3) | py | Runtime Error | 347 | 13128 | 329 | import numpy as np
import math
N,A,B = map(int, input().split())
h = np.zeros(N)
for i in range(N) :
h[i] = int(input())
ans = 0
mn = 0
mx = np.ceil(h.max()/B)
now = mx//2
while (mx-mn) <= 1 :
if now >= sum(np.ceil(tmp[tmp>0]/(A-B))) :
mx = now
else :
mn = now
now = (mx+mn)//2
print... |
s287574581 | p03700 | u840684628 | 1498608872 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3068 | 17 | I'm Yata Ryuichi. |
s041500904 | p03700 | u894844146 | 1497734795 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38384 | 720 | import math
n, a, b = map(int, input().split(" "))
h = []
for i in range(n):
h.append(int(input()))
h.sort(reverse=True)
def check(count_target, h, a, b):
count = 0
for i in h:
if i >= count_target * b:
count... |
s601670755 | p03700 | u351527281 | 1497386330 | Python | Python (3.4.3) | py | Runtime Error | 238 | 8284 | 317 | n,a,b = map(int, input().split())
nums = [0 for i in range(n)]
for i in range(n):
nums[i] = int(input())
nums = sorted(nums, reverse = True)
count = 0
while nums[0]>0:
nums[0]=nums[0]-a
for i in range(1,n):
nums[i]=nums[i]-b
nums = sorted(num, reverse = True)
count += 1
print(str(count))
|
s139190870 | p03700 | u341087021 | 1497065880 | Python | Python (3.4.3) | py | Runtime Error | 225 | 8284 | 353 | n,a,b = [int(x) for x in input().split()]
monsters_hp = sorted([int(input()) for _ in range(n)])
use_magic_times = 0
any_monster_alive = True
while any_monster_alive:
for i in range(n-1):
monsters_hp[i] -= a
monsters_hp[n] -= b
monsters_hp.sort()
use_magic_times += 1
if monsters_hp[n] <= 0:
any_monster_aliv... |
s958405531 | p03700 | u552822163 | 1497050315 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 39708 | 797 | class Monster():
def __init__(self, hp, A, B):
self.hp = hp
self.live = 1
self.center = A
self.side = B
def is_die(self):
if self.hp <= 0:
self.live = 0
def center_bombed(self):
self.hp -= self.center
self.is_die()
def side_bombed(self):
self.hp -= self.side
self.is_die()
N, A, B =[int(... |
s318688880 | p03700 | u552822163 | 1497050280 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 806 | class Monster():
def __init__(self, hp, A, B):
self.hp = hp
self.live = 1
self.center = A
self.side = B
def is_die(self):
if self.hp <= 0:
self.live = 0
def center_bombed(self):
self.hp -= self.center
self.is_die()
def side_bombed(self):
self.hp -= self.side
self.is_die()
N, A, B =[int(... |
s600895139 | p03700 | u552822163 | 1497050216 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 804 | class Monster():
def __init__(self, hp, A, B):
self.hp = hp
self.live = 1
self.center = A
self.side = B
def is_die(self):
if self.hp <= 0:
self.live = 0
def center_bombed(self):
self.hp -= self.center
self.is_die()
def side_bombed(self):
self.hp -= self.side
self.is_die()
N, A, B =[int(... |
s449258640 | p03700 | u463836923 | 1496560339 | Python | Python (3.4.3) | py | Runtime Error | 219 | 8276 | 942 | #coding=UTF-8
#ぎりぎり間に合わないので少しがんばってみる
def turn_check(zikan):
nokori_naka=zikan
for idx in range(0,N,1):
rem_hp=kirei_HP[idx]-around*zikan
if rem_hp > 0:
nokori_naka=nokori_naka-(rem_hp//dmgsa + (0 if rem_hp%dmgsa==0 else 1))
if nokori_naka < 0:
ret... |
s001667234 | p03700 | u450956662 | 1496550308 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11332 | 332 | # -*- coding: utf-8 -*-
N, A, B = map(int, input().split())
H = [int(input()) for x in range(N)]
c = 0
while H:
index = max(enumerate(H), key=lambda x: x[1])[0]
H[index] -= A
H = [H[x]-B for x in range(len(H)) if x!=index]
I = [x for x in range(len(H)) if H[x] <= 0]
[H.pop(x) for x in I]
c +=... |
s976295063 | p03700 | u533084327 | 1496544544 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 17916 | 708 | import numpy as np
import math
N, A, B = [int(_) for _ in input().split()]
H = [int(input()) for _ in range(N)]
H = np.sort(H)[::-1]
H = np.delete(H,np.where(H<=int(math.ceil(H[0]/A))*B))
attack = np.ones(len(H)).astype(np.int64)
attack *= B
attack[0] = A
count = 0
p = int(H[0]/A)
order = 0
while p>=10:
p /= 10
... |
s203826317 | p03700 | u102111602 | 1496543698 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 603 | #coding: utf-8
line = input().strip()
N = int(line[0])
A = int(line[2])
B = int(line[4])
monster = [int(input()) for i in range(N)]
times = 0
while len(monster) > 0:
n = monster.index(max(monster)) #一番体力が大きい魔物のインデックス
monster[n] = monster[n] - A
if monster[n] < 1:
monster[n] = 0
for i, x in en... |
s836008881 | p03700 | u533084327 | 1496543668 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 17908 | 720 | import numpy as np
import math
N, A, B = list(map(int,input().split()))
H = []
for i in range(N):
H.append(int(input()))
H = np.sort(H)[::-1]
H = np.delete(H,np.where(H<=int(math.ceil(H[0]/A))*B))
attack = np.ones(len(H)).astype(np.int64)
attack *= B
attack[0] = A
count = 0
p = int(H[0]/A)
order = 0
while p>=10:
... |
s315638797 | p03700 | u102111602 | 1496543561 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 27380 | 656 | #coding: utf-8
line = input().strip()
N = int(line[0])
A = int(line[2])
B = int(line[4])
monster = [int(input()) for i in range(N)]
times = 0
while len(monster) > 0:
n = monster.index(max(monster)) #一番体力が大きい魔物のインデックス
print('max', n)
print('monster', monster)
monster[n] = monster[n] - A
if monste... |
s525359812 | p03700 | u502149531 | 1496543233 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 21512 | 371 | import numpy as np
n, a, b = map(int, input().split())
monster = list(int(input()) for i in range(n))
monster.sort(reverse = True)
c = b * np.ones(n)
c[0] = a
count = 0
for i in range(1000000) :
monster = monster - c
if monster[0] < monster[1] :
sorted(monster, key = int, reverse = True)
count = count + ... |
s462664569 | p03700 | u790865353 | 1496543008 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 7384 | 378 | N,A,B=map(int,input().split())
H=[]
for i in range(N):
h=int(input())
H.append(h)
counter=0
for i in range(max(H)):
H.sort(reverse=True)
if H[0]<=0:
break
counter=counter+1
for j in range(len(H)):
if j==0:
H[j]=H[j]-A
else:
H[j]=H[j]-B
... |
s574238512 | p03700 | u019578976 | 1496542511 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3068 | 408 | n,a,b=map(int,input().split())
m=[]
for i in range(n):
m.append(int(input()))
m.sort(reverse=True)
attack=0
#攻撃
while m[0] > 0:
for i in range(len(m)):
if i == 0:
m[i]= m[i] - a
if m[i] =< 0:
m.pop[i]
else:
m[i]= m[i] - b
if m[i] =... |
s803568673 | p03700 | u040380068 | 1496540784 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 326 | def allzero(lst):
for i in range(0, len(lst)):
if lst[i] != 0:
return False
return True
inpt = map(raw_input().split())
n = inpt[0]
a = inpt[1]
b = inpt[2]
monster = []
for i in range(0, n):
monster.append(int(raw_input()))
cnt = 0
while allzero(monster):
map(lambda x:x-b, monster)
monster[-1] -= a - b
pri... |
s770008247 | p03701 | u894858952 | 1598326219 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9168 | 302 | N = int(input())
S = sorted([int(input()) for _ in range(N)])
non_10s = None
for s in S:
if s % 10 != 0:
non_10s = s
break
answer = sum(S)
if answer % 10 ==0 and non_10s != None:
answer -= non_10s
elif answer % 10 == 0:
answer -= non_10s
else:
answer = answer
print(answer) |
s615321480 | p03701 | u723792785 | 1591845596 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38512 | 1865 | n,k = map(int,input().split())
a = [int(input()) for _ in range(n)]
"""
b := ruisekiwa
b[r]-b[l] >= (r-l)k
b[r]-rk >= b[l]-lk (1-indexed)
c := b[i]-ik
"""
b = [0 for _ in range(n)]
b[0] = a[0]
for i in range(1, n):
b[i] = b[i-1] + a[i]
c = [b[i]-(i+1)*k for i in range(n)]
"""
cr >= cl なる ペア(l, r)の個数を求めたい.
for i in... |
s320752777 | p03701 | u780475861 | 1590251094 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 190 | import sys
n, *lst = map(int, sys.stdin.read().split())
res = sum(lst)
if not res % 10:
tmp = [i if not i % 10 for i in lst]
if tmp:
res -= min(tmp)
else:
res = 0
print(res)
|
s309230349 | p03701 | u545368057 | 1582386945 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 269 | n = sum(Ss)
# INF = 10**10
dp = [False] * (n+1)
dp[0] = True
for i in range(N):
x = Ss[i]
for j in range(n+1):
if j+x > n : continue
dp[j+x] = dp[j] or dp[j+x]
ans = 0
for i in range(n+1):
if dp[i] and i%10 != 0:
ans = i
print(ans) |
s061657572 | p03701 | u638795007 | 1581446844 | Python | Python (3.4.3) | py | Runtime Error | 48 | 5360 | 995 | def examC():
N = I()
S = [I() for _ in range(N)]
S1 = []
for s in S:
if s%10==0:
continue
S1.append(s)
S1.sort()
ans = sum(S)
if ans%10==0:
ans -= S1[0]
print(ans)
return
def examD():
ans = 0
print(ans)
return
def examE():
ans = 0... |
s728122559 | p03701 | u303039933 | 1580221570 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38768 | 1829 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache
class Scanner():
def int():
return int(sys.stdin.readline().rstrip())
def string():
return sys.stdin.readline().rstrip()
... |
s381122334 | p03701 | u936985471 | 1573861755 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 211 | n=int(input())
s=[None]*n
minv=100
for in range(n):
s[i]=int(input())
if minv>s[i]:
if s[i]%10!=0:
minv=s[i]
if minv==100:
print(0)
elif sum(s)%10==0:
print(sum(s)-minv)
else:
print(sum(s))
|
s271343571 | p03701 | u569272329 | 1571087169 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 205 | N = int(input())
A = []
ans = 0
for i in range(0, N):
A.append(int(input()))
ans += A[i]
A.sort()
if (ans % 10) != 0:
print(ans)
else:
s = [a for a in A if a % 10 != 0]
print(ans-s[0])
|
s638547547 | p03701 | u619819312 | 1570397787 | Python | PyPy3 (2.4.0) | py | Runtime Error | 166 | 38256 | 374 | from bisect import bisect_right as br
n,k=map(int,input().split())
b=[0]*(n+1)
def f(x):
c=0
while x>0:
c+=b[x]
x-=x&-x
return c
def g(x,a):
while x<n+1:
b[x]+=a
x+=x&-x
for i in range(n):
g(i+1,int(input())-k)
c=[0]
d=0
for i in range(1,n+1):
t=f(i)
k=br(c,t)... |
s755327208 | p03701 | u626337957 | 1568176568 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 290 | N = int(input())
nums=[int(input()) for _ in range(N)]
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
for i in range(MAX+1)[::-1]:
if dp[i] == 1 and (i + num) <= MAX+1:
dp[i+num] = 1
ans = 0
for i in range(MAX+1):
if dp[i] == 1 and i%10 != 0:
ans = i
print(ans)
|
s910852850 | p03701 | u626337957 | 1568176523 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 292 | N = int(input())
nums=[int(input()) for _ in range(N)]
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
for i in range(MAX+1)[::-1]:
if dp[i] == 1 and (i + num) <= MAX*MAX:
dp[i+num] = 1
ans = 0
for i in range(MAX+1):
if dp[i] == 1 and i%10 != 0:
ans = i
print(ans)
|
s493527080 | p03701 | u626337957 | 1568174543 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 267 | N = int(input())
nums=[int(input()) for _ in range(N)]
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
for i in range(MAX+1)[::-1]:
if dp[i] == 1:
dp[i+num] = 1
ans = 0
for i in range(MAX+1):
if dp[i] == 1 and i%10 != 0:
ans = i
print(ans)
|
s469888945 | p03701 | u626337957 | 1568173372 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 306 | N = int(input())
nums=[int(input()) for _ in range(N)]
sum_nums = sum(nums)
MAX = 10*4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
for i in range(MAX+1):
if dp[i] == 1 and i + num <= MAX:
dp[i+num] = 1
ans = 0
for i in range(sum_nums+1):
if dp[i] == 1 and i%10 != 0:
ans = i
print(ans)
|
s239227717 | p03701 | u481514236 | 1566575599 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 889 | import itertools
N = int(input())
lst = []
# listにN個の数値を格納
for i in range(N):
lst.append(int(input()))
l_sum = sum(lst)
p_list = []
if l_sum % 10 == 0:
# enumerate()関数を使うと、forループの中でリスト(配列)インデックス番号(カウント、順番)を取得できる
# i にインデックス番号が入る
for i, _ in enumerate(lst, 1):
# permutations()を使うと 第2引数... |
s366357555 | p03701 | u390618988 | 1562445079 | Python | Python (3.4.3) | py | Runtime Error | 325 | 3064 | 438 | from sys import stdin, exit
N = int(stdin.readline().rstrip())
s = [int(stdin.readline().rstrip()) for _ in range(N)]
dp = [0] * (100 * N)
dp[0] = 1
for n in range(N):
for p in range(len(dp), 0, -1):
if p - s[n] >= 0:
if dp[p - s[n]] == 1:
dp[p] = 1
for k in range(len(dp)):
... |
s397485759 | p03701 | u390618988 | 1562445028 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 437 | from sys import stdin, exit
N = int(stdin.readline().rstrip())
s = [int(stdin.readline().rstrip()) for _ in range(N)]
dp = [0] * (100 * N)
dp[0] = 1
for n in range(N):
for p in range(len(dp), 0, -1):
if p - s[n] >= 0
if dp[p - s[n]] == 1:
dp[p] = 1
for k in range(len(dp)):
i... |
s783841896 | p03701 | u390618988 | 1562444781 | Python | Python (3.4.3) | py | Runtime Error | 200 | 3064 | 404 | from sys import stdin, exit
N = int(stdin.readline().rstrip())
s = [int(stdin.readline().rstrip()) for _ in range(N)]
dp = [0] * (100 * N)
dp[0] = 1
for n in range(N):
for p in range(len(dp), 0, -1):
if dp[p - s[n]] == 1:
dp[p] = 1
for k in range(len(dp)):
if dp[len(dp) - k - 1] == 1 and (l... |
s104328524 | p03701 | u310678820 | 1554334314 | Python | Python (3.4.3) | py | Runtime Error | 110 | 10932 | 421 | n=int(input())
s=[int(input()) for i in range(n)]
memo=[[0]*10000 for i in range(100)]
def dp(score, i):
if i==n:
if score%10==0:
memo[i][score]=0
return 0
else:
memo[i][score]=score
return score
if memo[i][score]>0:
return memo[i][score]
... |
s679762375 | p03701 | u924406834 | 1552764613 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38512 | 623 | n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
def judige(n):
global h,a,b
check = 0
for i in range(len(h)):
num = h[i]
num -= b*n
if num > 0:
check += num//(abs(b-a)) if num % abs(b-a) == 0 else num//abs(b-a) + 1
if check <= n:return True
r... |
s728782423 | p03701 | u924406834 | 1552764263 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 623 | n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
def judige(n):
global h,a,b
check = 0
for i in range(len(h)):
num = h[i]
num -= b*n
if num > 0:
check += num//(abs(b-a)) if num % abs(b-a) == 0 else num//abs(b-a) + 1
if check <= n:return True
r... |
s979009475 | p03701 | u924406834 | 1552764164 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 599 | n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
def judige(n):
global h,a,b
check = 0
for i in range(len(h)):
num = h[i]
num -= b*n
check += num//(abs(b-a)) if num % abs(b-a) == 0 else num//abs(b-a) + 1
if check <= n:return True
return False
inf = max(h)... |
s144639358 | p03701 | u924406834 | 1552764135 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 599 | n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
def judige(n):
global h,a,b
check = 0
for i in range(len(h)):
num = h[i]
num -= b*n
check += num//(abs(b-a)) if num % abs(b-a) == 0 else num//abs(b-a) + 1
if check <= n:return True
return False
inf = max(h)... |
s444214478 | p03701 | u924406834 | 1552764063 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 623 | n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
def judige(n):
global h,a,b
check = 0
for i in range(len(h)):
num = h[i]
num -= b*n
if num > 0:
check += num//(abs(b-a)) if num % abs(b-a) == 0 else num//abs(b-a) + 1
if check <= n:return True
r... |
s525967227 | p03701 | u924406834 | 1552763960 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 38512 | 623 | n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
def judige(n):
global h,a,b
check = 0
for i in range(len(h)):
num = h[i]
num -= b*n
if num > 0:
check += num//(abs(b-a)) if num % abs(b-a) == 0 else num//abs(b-a) + 1
if check <= n:return True
r... |
s753441158 | p03701 | u598167418 | 1549159618 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 360 | from math import ceil
def solve(val):
z = 0
for i in range(n):
if h[i] <= val*b:
pass
else:
z += ((h[i]-val*b-1)/(a-b))+1
if z <= val:
return True
else:
return False
n,a,b = map(int,raw_input().split())
h = [input() for i in range(n)]
lo,hi = 1,10**9
while lo < hi:
mid = lo+(hi-lo)//2
if solve(mid):... |
s384789333 | p03701 | u803848678 | 1543459742 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 543 | n = int(input())
s = []
geta = 0
for i in range(n):
a = int(input())
if a % 10 == 0:
geta += a
else:
s.append(a)
s.sort(reverse=True)
tmp = sum(s)
ruiseki = [tmp]
for i in range(n-1):
ruiseki.append(ruiseki[-1] - s[i])
ans = 0
def DFS(depth, now):
global ans
if depth == n:
... |
s645207405 | p03701 | u536113865 | 1536606175 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 204 | n = int(input())
s = [int(input()) for i in range(n)]
if sum(s)%10:
print(sum(s))
else:
for i in sorted(s):
if i%10:
print(sum(s)-i)
break
else:
print(0 |
s865972266 | p03701 | u560670090 | 1515291118 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 336 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
int s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
ans += s[i];
}
sort(s, s + n);
for (int i = 0; i < n; i++) {
if (ans % 10 == 0) {
ans -= s[i];
} else {
cout << ans << endl;
return 0;
}
}
cout << 0 << en... |
s944603250 | p03701 | u839537730 | 1502509462 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 462 | N, K = map(int, input().split())
a = []
for _ in range(N):
a.append(int(input())-K)
su = 0
v = [(0, 0)]
for i in range(N):
su += a[i]
v.append((su, i+1))
v = sorted(v)
data = [0]*(N+3)
def sumation(i):
s = 0
while i > 0:
s += data[i]
i -= i & -i
return s
def add(i, x)... |
s715696704 | p03701 | u781758937 | 1498351040 | Python | Python (3.4.3) | py | Runtime Error | 173 | 14440 | 331 | import numpy as np
N = int(input())
S = np.array([int(input()) for i in range(N)])
S = S.reshape(N, 1)
mat = np.zeros([2**N, N])
for i in range(2**N):
for j in range(N):
if (N * "0" + format(i, "b"))[-N+j] == "1":
mat[i,j] = 1
score = np.dot(mat, S)
flg = score % 10 != 0
print(int(np.max(scor... |
s816069261 | p03701 | u177481830 | 1498224173 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 264 | N=int(input())
s_arr=np.zeros(N, dtype=np.int8)
for i in range(N):
s_arr[i]=int(input())
total=np.sum(s_arr)
if total%10!=0:
print(total)
else:
msk=(s_arr%10!=0)
if np.sum(msk)==0:
print(0)
else:
print(total-np.min(s_arr[msk])) |
s154727153 | p03701 | u764782120 | 1497143827 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 412 | # -*- coding:utf-8 -*-
l = input().split()
N = int(l[0])
A = int(l[1])
B = int(l[2])
HP = [int(input()) for i in range(N)]
count = 0
check = 0
while(True):
HP.sort()
print(HP)
for i in range(N):
if i == N-1:
HP[i] = HP[i] - A
count = count + 1
else:
HP[i] = HP[i] - B
for i in range(N):
if HP[N-... |
s293828147 | p03701 | u117182712 | 1496604497 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1251 | import sys
import math
class Solution(object):
def __init__(self):
self.N, self.A, self.B = map(int, sys.stdin.readline().split(' '))
self.h = []
for _ in range(self.N):
self.h.append(int(sys.stdin.readline()))
self.extra_damage = self.A - self.B
def solve(self):
... |
s172421517 | p03701 | u714878632 | 1496586907 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1211 | n, a, b = [int(i) for i in input().split()]
hs = [None]*n
kill_b = [None]*n
all_hp = 0
all_killb = 0
for i in range(n):
hs[i] = int(input())
# all_hp += hs[i]
# kill_b[i] = hs[i] // b
# if((hs[i] % b) != 0):
# kill_b[i] += 1
# all_killb += kill_b[i]
# hs.sort()
max_hp = max(hs)
ret = 0
ab = ... |
s115361232 | p03701 | u765237551 | 1496578509 | Python | PyPy3 (2.4.0) | py | Runtime Error | 194 | 40432 | 387 | import math
n, a, b = map(int, input().split())
hs = list(map(int, (input() for _ in range(n))))
m = sum(hs) // (a + (n-1)*b) - 10
M = sum(math.ceil(h/a) for h in hs)
def killable(p, hs, a, b):
x = sum(max(0, math.ceil((h-p*b) / (a-b))) for h in hs)
return x <= p
while(m+1 < M):
c = (m+M) // 2
if ki... |
s685656118 | p03701 | u765237551 | 1496543678 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 870 | import heapq
from collections import Counter
import math
n, a, b = map(int, input().split())
hs = map(int, (input() for _ in range(n)))
counter = [[-x, c] for x, c in Counter(hs).items()]
cum = 0
p = 0
heapq.heapify(counter)
def f(m, c, a, b):
ans = 0
ans += math.floor(m / (a + b*(c-1))) * c
m -= math.f... |
s981228818 | p03701 | u033407970 | 1496542334 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 659 | import math as mt
store = []
def binarysearch(min, max):
mid = int((max + min)/2)
if (min == max):
return mid
elif count(mid) > mid:
return binarysearch(mid+1, max)
else:
return binarysearch(min, mid)
def count(x):
store = [mt.ceil((n - x*b)/a) for n in hp]
store = [x fo... |
s683701530 | p03701 | u608297208 | 1496540542 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 386 | import math
N,A,B = map(int,input().split())
H = [int(input()) for i in range(N)]
Hs = sum(H)
c = A - B
M = math.ceil(Hs / (B * N))
m = math.ceil(Hs / (A * N))
nibun = [M,m]
while M - m > 1:
n = (M + m) // 2
H2 = [H[i] - n * B for i in range(N) if H[i] - n * B > 0]
cnts = [math.ceil(H2[i] / c) for i in range(len(H... |
s058831827 | p03701 | u330544393 | 1496539617 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 477 | sum_ = sum(s)
if (sum_ % 10) != 0:
return sum_
else:
st = sorted(s)
m = 0
for i in range(len(st)):
s2 = sum(s[:i-1]+s[i+1:])
if (s2 % 10) != 0:
return s2
for i in range(len(st)):
s2 = sum(s[:i-1]+s[i+2:])
... |
s287329586 | p03701 | u290163555 | 1496539326 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 365 | N = int(raw_input())
s = sorted([int(raw_input()) for i in range(N)])
_sum = sum(s)
def select_min(l):
cand = min(l)
if cand % 10 > 0:
return cand
return select_min([i for i in l if i != cand])
if _sum != 0 and _sum % 10 == 0:
cand = filter(lambda x: x > 0 and x % 10 != 0, s)
debt = se... |
s656855937 | p03701 | u290163555 | 1496539265 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 341 | N = int(raw_input())
s = sorted([int(raw_input()) for i in range(N)])
_sum = sum(s)
def select_min(l):
cand = min(l)
if cand % 10 > 0:
return cand
return select_min([i for i in l if i != cand])
if _sum % 10 == 0:
cand = filter(lambda x: x % 10 != 0, s)
debt = select_min(cand)
_sum ... |
s783656556 | p03701 | u477320129 | 1496538519 | Python | PyPy3 (2.4.0) | py | Runtime Error | 197 | 40048 | 310 | N = int(input())
S = [int(input()) for _ in range(N)]
table = [False] * (100 * 100 + 1)
table[0] = True
ma = 0
for s in S:
ma += s
for i in range(ma, -1, -1):
table[i+s] |= table[i]
for i in range(ma, -1, -1):
if i % 10 != 0 and table[i]:
print(i)
break
else:
print(0)
|
s684941319 | p03701 | u477320129 | 1496538466 | Python | PyPy3 (2.4.0) | py | Runtime Error | 187 | 39920 | 291 | N = int(input())
S = [int(input()) for _ in range(N)]
table = [False] * (100 * 100 + 1)
table[0] = True
ma = 0
for s in S:
ma += s
for i in range(ma, -1, -1):
table[i+s] |= table[i]
for i in range(ma, -1, -1):
if i % 10 != 0 and table[i]:
print(i)
break
|
s610059938 | p03702 | u724317441 | 1578978093 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 8154 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// using System.Numerics;
using System.Runtime.CompilerServices;
using System.Diagnostics;
using ll=System.Int64;
using static Contest_D.MyIO;
public class Contest_D
{
static void swap1<T>(ref T a, ref T b) { T t = a; a = b; b = ... |
s957737481 | p03702 | u677523557 | 1566958348 | Python | Python (3.4.3) | py | Runtime Error | 1939 | 7112 | 358 | N, A, B = map(int, input().split())
H = [int(input()) for _ in range(N)]
l = 0
r = max(H)
while r > l+1:
T = (l+r)//2
c = 0
for h in H:
if h > B*T:
c += (h-B*T)//(A-B)
if (h-B*T)%(A-B) != 0:
c += 1
if c <= T:
r = T
else:
l = T
if l =... |
s362054882 | p03702 | u698176039 | 1559345030 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 7072 | 708 | N,A,B = map(int,input().split())
h = [int(input()) for _ in range(N)]
left = 1
right = max(h)//A + 1
import math
def judge(x):
cnt = 0
tmp = 0
for i in range(N):
tmp = h[i] - B * x
if tmp > 0:
cnt += math.ceil(tmp/(A-B))
if cnt <= x:
return True
else:
ret... |
s665414353 | p03702 | u937529125 | 1554330822 | Python | Python (3.4.3) | py | Runtime Error | 224 | 8280 | 538 | a,b,c = map(int, input().split())
l = [int(input()) for _ in range(a)]
flag = True
l = sorted(l)
max_T = 10**18
def ok(k):
s = k
for i in l:
hp = i - c * k
if hp > 0:
s -= -(-hp // (b - c))
if s < 0:
return False
return True
def binary_search(l,r):
mid = (... |
s250181604 | p03702 | u937529125 | 1554330771 | Python | Python (3.4.3) | py | Runtime Error | 228 | 8280 | 521 | a,b,c = map(int, input().split())
l = [int(input()) for _ in range(a)]
flag = True
l = sorted(l)
max_T = 10**18
def ok(k):
s = k
for i in l:
hp = i - c * k
if hp > 0:
s -= -(-hp // (b - c))
if s < 0:
return False
return True
def binary_search(l,r):
mid = (... |
s321583295 | p03702 | u572144347 | 1551661587 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 285 | N,A,B=map(int,input().split())
H=[inp(input()) for _ in range(N)]
H=sorted(H,reverse=True)
ok=max(H)//B+1
ng=0
mid=(ok+ng)//2
while ok-ng>1:
cntlive=0
for h in H:
h-=B*mid
if h>0:
cntlive+=1
if cntlive<=mid:
ok=mid
else:
ng=mid
mid=(ok+ng)//2
print(ok) |
s636378241 | p03702 | u076564993 | 1533960865 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 919 |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#includ... |
s424592875 | p03702 | u497625442 | 1533698942 | Python | Python (3.4.3) | py | Runtime Error | 237 | 8296 | 639 | N, A, B = map(int,input().split())
h = [0 for i in range(N)]
for i in range(N):
h[i] = int(input())
h = sorted(h)
# import math
# N, A, B = 4, 5, 3
# h = [8,7,4,2]
# h = sorted(h,reverse=True)
def enough(T):
tmp = 0
for i in range(N):
if h[i] >= B*T:
tmp += math.ceil((h[i]-B*T)/(A-B))
return True if tmp <= T ... |
s678701796 | p03702 | u503901534 | 1527203694 | Python | Python (3.4.3) | py | Runtime Error | 225 | 7488 | 461 | n , a, b = map(int,input().split())
teki = []
ans = 0
for i in range(n):
teki.append(int(input()))
tekis = teki.sort()
while len(tekis) > 0:
tekis[-1] = tekis[-1] - a
if len(tekis) >= 2:
for i in range(len(tekis) -1):
tekis[i] = tekis[i] - b
tekis = list(sorted(tekis))
for i i... |
s481633084 | p03702 | u503901534 | 1527203614 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 471 | n , a, b = map(int,input().split())
teki = []
ans = 0
for i in range(n):
teki.append(int(input())
tekis = list(sorted(teki))
while len(tekis) > 0:
tekis[-1] = tekis[-1] - a
if len(tekis) >= 2:
for i in range(len(tekis) -1):
tekis[i] = tekis[i] - b
tekis = list(sorted(tekis))
... |
s219099551 | p03702 | u503901534 | 1527203516 | Python | Python (3.4.3) | py | Runtime Error | 215 | 11804 | 466 | n , a, b = map(int,input().split())
teki = []
ans = 0
for i in range(n):
teki.append(input())
tekis = list(sorted(teki))
while len(tekis) > 0:
tekis[-1] = tekis[-1] - a
if len(tekis) >= 2:
for i in range(len(tekis) -1):
tekis[i] = tekis[i] - b
tekis = list(sorted(tekis))
fo... |
s735347214 | p03702 | u766407523 | 1524340206 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 430 | N, A, B = map(int, input().split())
src = [int(input()) for i in range(N)]
def enough(n):
bomb = 0
for h in src:
if h <= B*n: continue
h -= B*n
bomb -= (h+1)//(A-B) + 1
if bomb > n: return False
return True
#ok/ng: 中点が十分かどうか
ng = 0
ok = 10**9
while ok - ng >... |
s161162397 | p03703 | u627417051 | 1596656344 | Python | PyPy3 (7.3.0) | py | Runtime Error | 285 | 165964 | 1512 | import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")
def getlist():
return list(map(int, input().split()))
class SegmentTree(object):
#N:処理する区間の長さ
def __init__(self, N):
self.N = N
self.N0 = 2 ** (N - 1).bit_length(... |
s661013598 | p03703 | u520276780 | 1591676888 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38384 | 448 | import numpy as np
n,k=map(int,input().split())
a=[0]+[int(input())-k for _ in range(n)]
ac=np.cumsum(a)
##BITは分からない
def rec(l):
ll=len(l)
if ll<=1:
return 0
l1=l[:ll//2]
l2=l[ll//2:]
res=rec(l1)+rec(l2)
l1.sort()
l2.sort()
i2=0
for i in range(len(l1)):
while i2<len(l... |
s150320224 | p03703 | u145600939 | 1590197705 | Python | PyPy3 (2.4.0) | py | Runtime Error | 501 | 85824 | 747 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
class BIT:
def __init__(self,n,default = 0):
self.s = [default]*(n+1)
def add(self,val,idx):
while idx < n+1:
self.s[idx] = self.s[idx] + val
idx += idx&(-idx)
return
def get(self,id... |
s989416727 | p03703 | u312025627 | 1589158059 | Python | PyPy3 (2.4.0) | py | Runtime Error | 439 | 109056 | 819 | class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
... |
s587732845 | p03703 | u828766688 | 1577851631 | Python | PyPy3 (2.4.0) | py | Runtime Error | 855 | 76376 | 821 |
def bitadd(a,w,bit): #aにwを加える(1-origin)
x = a
while x <= (len(bit)-1):
bit[x] += w
x += x & (-1 * x)
def bitsum(a,bit): #ind 0~aまでの和を求める
ret = 0
x = a
while x > 0:
ret += bit[x]
x -= x & (-1 * x)
return ret
N,K = map(int,input().split())
a = []
for i in ra... |
s832435719 | p03703 | u633618873 | 1574897124 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 30845 | use std::cmp;
use std::cmp::{max, min};
use std::cmp::Ordering::{self, Greater, Less};
use std::collections::{HashMap, HashSet};
use std::f64::consts::PI;
use std::ops::{AddAssign, Sub};
macro_rules! input {
(source = $s:expr, $($r:tt)*) => {
let mut iter = $s.split_whitespace();
input_inner!{iter,... |
s444246471 | p03703 | u619819312 | 1570400262 | Python | PyPy3 (2.4.0) | py | Runtime Error | 916 | 87088 | 393 | n,k=map(int,input().split())
b=[0]*(n+1)
for i in range(n):
b[i+1]=b[i]+int(input())-k
a=sorted(set(b))
s={a[i-1]:i for i in range(1,len(a)+1)}
c=[]
for i in b:
c.append(s[i])
b=[0]*(n+1)
def f(x):
c=0
while x>0:
c+=b[x]
x-=x&-x
return c
def g(x):
while x<n+1:
b[x]+=1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.