input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
F = tuple(map(int, input().split()))
def can_eat(t):
F_time = sorted([t // f for f in F])
training = 0
for i in range(N):
training += max(0, A[i] - F_time[i])
return training <= K
# bisect
l, r =... | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
F = tuple(map(int, input().split()))
def can_eat(t):
F_time = sorted([t // f for f in F])
training = 0
for i in range(N):
training += max(0, A[i] - F_time[i])
... | p02883 |
import heapq
class Heapq:
def __init__(self, arr, desc=False):
if desc:
arr = [-a for a in arr]
self.sign = -1 if desc else 1
self.hq = arr
heapq.heapify(self.hq)
def pop(self):
return heapq.heappop(self.hq) * self.sign
def push(self, a):
... | class Contest:
def __init__(self, member_cost,food_cost,k):
self.member_cost = member_cost
self.food_cost = food_cost
self.max_training_times = k
def canAchieve(self,target):
sum_training_times = 0
for i in range(len(self.member_cost)):
sum... | p02883 |
import heapq
import bisect
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
F = sorted(F, reverse = True)
A = sorted(A)
flg = 0
lst = []
for i in range(N):
if A[i] == 0 or F[i] == 0:
break
else:
lst.insert(bisect.bisect_left(lst, [A[... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse = True)
ng = -1
ok = 10 ** 12
while ok - ng > 1:
mid = (ok + ng) // 2
ctr = 0
for i in range(N):
ctr += max(0, A[i] - mid // F[i])
if ctr <= K:
ok = mid
els... | p02883 |
# -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | p02883 |
from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
la = 10**6+1
cnt = [0] * la
for u in a:
cnt[u] += 1
for i in range(1, la):
cnt[i] += cnt[i-1]
def judge(x):
y = k
... | from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
def judge(x):
y = k
for i in range(n):
goal = x//f[i]
if a[i] > goal:
y -= a[i] - goal
... | p02883 |
import sys
import math
from collections import deque
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(eval(input()))
NMI = lambda: list(map(int, input().split()))
NLI = lambda: list(NMI())
SI = lambda: eval(input())
def make_grid(h, w, num): ... | import sys
import math
from collections import deque
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(eval(input()))
NMI = lambda: list(map(int, input().split()))
NLI = lambda: list(NMI())
SI = lambda: eval(input())
def make_grid(h, w, num): ... | p02883 |
import sys
from bisect import bisect_left
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
F = [int(f) for f in input().split()]
A.sort(reverse = True)
F.sort()
low, high = -1, 10 ** 12 + 1
while high - low... | import sys
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
F = [int(f) for f in input().split()]
A.sort(reverse = True)
F.sort()
low, high = -1, 10 ** 12 + 1
while high - low > 1:
mid = (low + high) ... | p02883 |
import heapq
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
f = list(map(int,input().split()))
hq = []
a.sort()
f.sort(reverse = True)
for i in range(n):
heapq.heappush(hq, (-a[i]*f[i], a[i], f[i]))
for i in range(k):
s,a1,f1 = heapq.heappop(hq)
if s == 0:
... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
f = list(map(int,input().split()))
def hantei(c):
tmp = 0
for i in range(n):
if af[i] > c:
a1 = c // f[i]
tmp += a[i]- a1
if tmp <= k:
return True
else:
return False
h... | p02883 |
from heapq import heappop, heappush
N, K = list(map(int, input().split()))
digests = list(map(int, input().split()))
foods = list(map(int, input().split()))
foods.sort()
digests.sort(reverse=True)
hq = []
for i in range(N):
heappush(hq, (-digests[i]*foods[i], digests[i], foods[i]))
for _ in range(K):
co... | N, K = list(map(int, input().split()))
costs = list(map(int, input().split()))
foods = list(map(int, input().split()))
foods.sort()
costs.sort(reverse=True)
def can_eat(x):
count = 0
for i in range(N):
count += max(0, costs[i]-x//foods[i])
return count <= K
l, r = -1, 10**12+1
while r-l > 1:
... | p02883 |
#設定
import sys
input = sys.stdin.buffer.readline
from heapq import heappop, heappush
INF = float("inf")
def getlist():
return list(map(int, input().split()))
#処理内容
def main():
N, K = getlist()
A = getlist()
F = getlist()
A = sorted(A)
F = sorted(F)
Q = []
for i in range(N):
heappush(Q,... | #設定
import sys
input = sys.stdin.buffer.readline
INF = float("inf")
def getlist():
return list(map(int, input().split()))
#二分探索基本形 L:リスト x:値 n:リスト長
def Binary_Search(A, F, N, K):
#初期化
left = 0
right = 10 ** 12
ans = INF
#二分探索
while left <= right:
mid = (left + right) // 2
cnt = 0
f... | p02883 |
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
if K >= sum(A):
print((0))
exit()
A.sort(reverse=True)
F.sort()
#print('A:', A)
#print('F:', F)
res = K
lot = [A[k]*F[k] for k in range(N)]
#print(lot)
#print(res)
now = []
for k i... | from math import ceil
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
if K >= sum(A):
print((0))
exit()
A.sort(reverse=True)
F.sort()
lot = []
for k in range(N):
lot.append((A[k]*F[k], k))
lot.sort(key = lambda x:x[0],reverse=True)
high ... | p02883 |
import math
import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input())
def judge(x):
cnt = 0
for i in range(N... | import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input())
def judge(x):
cnt = 0
for i in range(N):
tmp =... | p02883 |
import math
N,K = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
F = sorted(list(map(int,input().split())),reverse=True)
high = 0
for i in range(N):
high = max(high,A[i]*F[i])
low = -1
while high-low>1:
mid = (high+low)//2
flag = 1
T = K
for i in range(N):
... | N,K = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
F = sorted(list(map(int,input().split())),reverse=True)
if K>=sum(A):
ans = 0
else:
low = 0
high = 10**12
while high-low>1:
mid = (high+low)//2
B = A[:]
cnt = 0
for i in range(N):
... | p02883 |
def main():
n, k = list(map(int, input().split()))
*a, = list(map(int, input().split()))
*f, = list(map(int, input().split()))
a.sort()
f.sort(reverse=1)
prod = [(y, x * y) for x, y in zip(a, f)]
l = -1
r = 10 ** 12
while r - l > 1:
m = (l + r) // 2
s = sum(max(0, 0 - (m - p) // y) for y, p in p... | def main():
n, k = list(map(int, input().split()))
*a, = list(map(int, input().split()))
*f, = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
prod = sorted([(x * y, y) for x, y in zip(a, f)], reverse=True) + [(0, -1)]
l = -1
r = 10 ** 12
while r - l > 1:
m = (l + r) // 2
s = 0
... | p02883 |
import math
n, k = list(map(int, input().split()))
# a = [int(x) for x in input().split()]
# f = [int(x) for x in input().split()]
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
lx = 0
rx = a[-1] * f[0]
for i in range(1000):
if lx == rx:
bre... | n, k = list(map(int, input().split()))
# a = [int(x) for x in input().split()]
# f = [int(x) for x in input().split()]
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
lx = -1
rx = a[-1] * f[0]
while rx-lx>1 :
cx = (lx + rx) // 2
kk = 0
for j ... | p02883 |
import copy
import math
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort()
A.reverse()
maxX = max(F) * max(A)
x = [-1 for i in range(maxX + 1)]
def is_able(low, up):
target = (low + up) // 2
if low == up - 1:
retu... | import copy
import math
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort()
A.reverse()
maxX = max(F) * max(A)
def is_able(low, up):
target = (low + up) // 2
if low == up - 1:
return up
if check(target):
... | p02883 |
import heapq
n,k=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
d=[[-a[i]*f[i],f[i]] for i in range(n)]
d.sort(key=lambda x:x[0])
heapq.heapify(d)
for _ in range(k):
i,j=heapq.heappop(d)
i+=j
heapq.heappush(d,[i,j])
ans,_=he... | n,k=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
d=[[a[i]*f[i],f[i]] for i in range(n)]
r=max([di[0] for di in d])+1
l=0
x=(l+r)//2
while r-l>1:
if r-l==2:
cnt=0
for di,fi in d:
cnt+=max(0,(di-l+fi-1)//fi)
i... | p02883 |
N,K = list(map(int,input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
if sum(A) <= K:
print((0))
exit()
A.sort()
F.sort(reverse=True)
def check(x):
k = 0
for a,f in zip(A, F):
if a*f > x:
while a > 0:
a -= 1
k += 1
i... | N,K = list(map(int,input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
if sum(A) <= K:
print((0))
exit()
A.sort()
F.sort(reverse=True)
def check(x):
k = 0
for a,f in zip(A, F):
k += max(0, a-(x//f))
return k <= K
# AをX以下にできるか??
ng,ok = 0, 10**1... | p02883 |
from heapq import heappush, heappushpop, heappop
N, K = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
F = list(map(int, input().split()))
A.sort()
F.sort()
hq = []
for a, f in zip(A, F):
heappush(hq, (a * f, f))
c, f = heappop(hq)
while K > 0:
c += f
K -= 1... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True)
F.sort()
C = [None] * N
for i, (a, f) in enumerate(zip(A, F)):
C[i] = (a * f, f)
def solve(x):
global K, N
t = 0
for c, f in C:
temp = ((c - x) + ... | p02883 |
def solve(mid):
l=k
for b,g in zip(a,f):
if b*g>mid:
l-=b-mid//g
if l<0:return False
return True
n,k,*a=list(map(int,open(0).read().split()))
a,f=sorted(a[:n])[::-1],sorted(a[n:])
ok=10**12
ng=-1
while abs(ok-ng)>1:
mid=(ok+ng)//2
if solve(mid):
ok=mid
... | def main():
n,k,*a=list(map(int,open(0).read().split()))
a,f=sorted(a[:n])[::-1],sorted(a[n:])
ok=10**12
ng=-1
while abs(ok-ng)>1:
mid=(ok+ng)//2
l=k
for b,g in zip(a,f):
if b*g>mid:
l-=b-mid//g
if l<0:ng=mid
else:ok=mid... | p02883 |
def main():
n,k,*a=list(map(int,open(0).read().split()))
a,f=sorted(a[:n]),sorted(a[n:],reverse=1)
ok=10**12
ng=-1
while ok-ng>1:
mid=(ok+ng)//2
l=k
for b,g in zip(a,f):
if b*g>mid:l-=b-mid//g
if l<0:ng=mid
else:ok=mid
print(ok)
ma... | def main():
n,k,*a=list(map(int,open(0).read().split()))
a,f=sorted(a[:n]),sorted(a[n:],reverse=1)
ok=10**12
ng=-1
while ok-ng>1:
mid=(ok+ng)//2
l=k
for b,g in zip(a,f):
t=b-mid//g
if t>0:l-=t
if l<0:ng=mid
else:ok=mid
... | p02883 |
n,k,*a=list(map(int,open(0).read().split()))
z=sorted(a[:n]),sorted(a[n:])[::-1]
o=10**12
g=-1
while o-g>1:
m,l=o+g>>1,k
for a,f in zip(*z):l-=max(0,a-m//f)
if l<0:g=m
else:o=m
print(o) | i,s=lambda:list(map(int,input().split())),sorted
n,k=i()
z=s(i()),s(i())[::-1]
o=10**12
g=-1
while o-g>1:
m,l=o+g>>1,k
for a,f in zip(*z):l-=max(0,a-m//f)
if l<0:g=m
else:o=m
print(o) | p02883 |
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
ng = -1
ok = 10**18
while ok - ng > 1:
mid = (ok + ng) // 2
c = 0
for i in range(N):
c += max(0,A[i]-mid//F[i])
if c <= K:
ok = mid
... | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
ng = -1
ok = 10**12+100
while ok - ng > 1:
mid = (ok + ng) // 2
c = 0
for a,f in zip(A,F):
c += max(0,a-mid//f)
if c <= K:
ok = mid
e... | p02883 |
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
ng = -1
ok = 10**12+100
while ok - ng > 1:
mid = (ok + ng) // 2
if sum(max(0,a-mid//f) for a,f in zip(A,F)) <= K:
ok = mid
else:
ng = mid
pr... | import sys
readline = sys.stdin.readline
N,K = list(map(int,readline().split()))
A = list(map(int,readline().split()))
F = list(map(int,readline().split()))
A.sort()
F.sort(reverse=True)
ng = -1
ok = 10**12+100
while ok - ng > 1:
mid = (ok + ng) // 2
if sum(max(0,a-mid//f) for a,f in zip(A,F)) <=... | p02883 |
import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, k = list(map(int, readline().split()))
a = list(map(int, readline().split()))
a.sort()
f = list(map(int, readline().split()))
f.sort(reverse=True)
cor_v = 10 ** 22
inc_v = -1
while ... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, k = list(map(int, readline().split()))
a = list(map(int, readline().split()))
a.sort()
f = list(map(int, readline().split()))
f.sort(reverse=True)
cor_v = 10 ** 13
inc_v = -1
while ... | p02883 |
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, k = list(map(int, input().rstrip('\n').sp... | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, k = list(map(int, input().rstrip('\n').split()))
a = list(map(int, input().rstrip('\n').split()))
a.sort()
f = list(map(int, input().rstrip('\n').split()))
f.sort(reverse=True)
cor_v = 10 ** 13
inc_... | p02883 |
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=sorted(a,reverse=True)
b=sorted(b)
def ok(N):
sums=0
for i in range(n):
sums+=max(0,a[i]-N//b[i])
if sums<=k:
return True
else:
return False
import math
... | # いきぬきreview 忘れた問題
# gluttony
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
F.sort()
A.sort(reverse=True)
def func(X):
s = 0
for i in range(N):
a, f = A[i], F[i]
s += max(0, a-X//f)
return s <= K
R = 10**12... | p02883 |
from math import ceil
N,K=list(map(int, input().split()))
A=list(map(int, input().split()))
F=list(map(int, input().split()))
A=sorted(A)
F=sorted(F, reverse=True)
left=0
right=10**12+1
ans=float("INF")
while True:
mid=(left+right)//2
now=0
for i in range(N):
if F[i]*A[i]>mid:
... | from math import ceil
N,K=list(map(int, input().split()))
A=list(map(int, input().split()))
F=list(map(int, input().split()))
A=sorted(A)
F=sorted(F, reverse=True)
left=0
right=10**12+1
ans=float("INF")
while True:
mid=(left+right)//2
now=0
for i in range(N):
if F[i]*A[i]>mid:
... | p02883 |
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse = True)
M = 0
for i in range(N):
M=max(F[i]*A[i],M)
def judge(n):
score = 0
for i in range(N):
score += max(A[i] - n//F[i],0)
return score<=K
de... | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
def check(v):
ans = 0
for i in range(N):
ans += max(A[i] - v//F[i],0)
return ans<=K
if check(0):
print((0))
else:
l = 0
r = 10**1... | p02883 |
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
r = A[-1]*F[0]
l = -1
while(r-l > 1):
tmp = (l+r)//2
k = 0
for x, y in zip(A, F):
if x*y > tmp:
k += x - (tmp // y)
#k += ma... | def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
r = A[-1]*F[0]
l = -1
while(r-l > 1):
tmp = (l+r)//2
k = 0
for x, y in zip(A, F):
if ... | p02883 |
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a = sorted(a)
f = sorted(f)[::-1]
def c(x):
# x決めると必要な修行回数も決まる
res = 0
for O, K in zip(a, f):
d = max(0, O * K - x)
res += (d + K - 1) // K
return res <= k
l... | n, k = list(map(int, input().split()))
a = sorted(map(int, input().split()))
f = sorted(map(int, input().split()))[::-1]
# 成績 Σ{i=1~n}a[i]*f[i]
# a[i]小さいの、f[i]でかいの組み合わせるとよい(交換しても悪化しない)
def c(x):
need = 0
for i in range(n):
if a[i] * f[i] > x:
# f[i]を何回減らしてx以下にできるか
dif... | p02883 |
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A = sorted(A)
F = sorted(F, reverse=True)
l = -1 # 絶対にfalse
r = 10**12+5
while (l+1<r):
c = (l+r)//2
s = 0
for i in range(N):
s += max(0, A[i]-(c//F[i]))
if s <= K:
r = c
el... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A = sorted(A)
F = sorted(F, reverse=True)
l = -1
r = 10**12+5
while (l+1<r):
c = (l+r)//2
tmp = 0
for i in range(N):
tmp += max(0, A[i]-(c//F[i]))
if tmp <= K:
r = c
e... | p02883 |
n,k = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
def isOk(x):
cost = 0
for a, f in zip(A,F):
eatable = x//f
if eatable >= a:
continue
cost += a - eatable
if cost <= k:... | n,k = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
def isOk(x):
cost = 0
for a, f in zip(A,F):
eatable = x//f
if eatable >= a:
continue
cost += a - eatable
if cost <= k:... | p02883 |
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A = sorted(A)
F = sorted(F, reverse=True)
mul = [A[i]*F[i] for i in range(N)]
if K >= sum(A)*N:
print((0))
exit()
ma = 2**40
mi = 0
while 1:
tgt = mi + (ma - mi)//2
num = 0
f... | N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A = sorted(A)
F = sorted(F, reverse=True)
mul = [A[i]*F[i] for i in range(N)]
if K >= sum(A):
print((0))
exit()
ma = 2**40
mi = 0
while 1:
tgt = mi + (ma - mi)//2
num = 0
for... | p02883 |
import sys
from io import StringIO
import unittest
import math
def check(A, F, x, N, K):
for i in range(N):
if A[i] * F[i] > x:
k = math.ceil(A[i] - x / F[i])
K -= k
if K < 0:
return False
else:
return True
def resolve():
N, K = list(... | import math
def check(A, F, x, N, K):
for i in range(N):
if A[i] * F[i] > x:
k = math.ceil(A[i] - x / F[i])
K -= k
if K < 0:
return False
else:
return True
def resolve():
N, K = list(map(int, input().split()))
A = list(map(int, inpu... | p02883 |
import heapq
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort(reverse=True)
f.sort()
pq = []
for i in range(n):
heapq.heappush(pq, (-a[i]*f[i], a[i], f[i]))
for i in range(k):
score, ai, fi = heapq.heappop(pq)
if score == ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort(reverse=True)
f.sort()
ori = [0] * n
for i in range(n):
ori[i] = a[i]*f[i]
ok = max(ori)
ng = -1
mid = (ok+ng) // 2
while ok - ng > 1:
cnt = 0
flg = 0
for i in range(n)... | p02883 |
import sys
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()... | import sys
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()... | p02883 |
N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)
def isEaten(x):
temp = 0
for i in range(N):
t = x // F[i]
if t < A[i]:
temp += (A[i] - t)
if temp > K:
return False
... | N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)
def isEaten(x):
temp = 0
for i in range(N):
t = x // F[i]
if t < A[i]:
temp += (A[i] - t)
return temp <= K
def bitSearch... | p02883 |
import sys
import heapq
def main():
n, k = [int(s) for s in sys.stdin.readline().strip().split()]
a = [int(s) for s in sys.stdin.readline().strip().split()]
f = [int(s) for s in sys.stdin.readline().strip().split()]
# n, k = 3, 5
# a = [4, 2,1]
# f = [2, 3, 1]
a.sort(reverse=T... | import sys
import heapq
def main():
n, k = [int(s) for s in sys.stdin.readline().strip().split()]
a = [int(s) for s in sys.stdin.readline().strip().split()]
f = [int(s) for s in sys.stdin.readline().strip().split()]
# n, k = 3, 5
# a = [4, 2,1]
# f = [2, 3, 1]
a.sort(reverse=T... | p02883 |
import math
N, K = list(map(int, input().split()))
As = sorted(list(map(int, input().split())))
Bs = sorted(list(map(int, input().split())))[::-1]
Cs = [a*b for a, b in zip(As, Bs)]
BCs = list(zip(Bs, Cs))
def func(target):
r = 0
for b, c in BCs:
r += math.ceil(max(0, c - target) / b)
re... | import math
N, K = list(map(int, input().split()))
As = sorted(list(map(int, input().split())))
Bs = sorted(list(map(int, input().split())))[::-1]
Cs = [a*b for a, b in zip(As, Bs)]
BCs = list(zip(Bs, Cs))
def func(target):
r = 0
for b, c in BCs:
r += math.ceil(max(0, c - target) / b)
re... | p02883 |
import math
N,K=list(map(int,input().split()))
X=[(b,a*b)for a,b in zip(sorted(list(map(int,input().split()))),sorted(list(map(int,input().split())))[::-1])]
m,M,i=0,10**12,1
exec("i,M,m=((i+m)//2,i,m) if sum(math.ceil(max(0,c-i)/b)for b, c in X)<=K else((i+M)//2,M,i);"*50)
print(M) | N,K=list(map(int,input().split()))
X=[(b,a*b)for a,b in zip(sorted(list(map(int,input().split()))),sorted(list(map(int,input().split())))[::-1])]
m,M,i=0,2**40,1
exec("i,M,m=((i+m)//2,i,m) if -sum(min(0,i-c)//b for b, c in X)<=K else((i+M)//2,M,i);"*50)
print(M) | p02883 |
(_,K),*T=[list(map(int,t.split()))for t in open(0)]
A,B=list(map(sorted,T))
m,M,i=0,2**40,1
exec("i,M,m=((i+m)//2,i,m) if -sum(min(0,i-a*b)//b for a,b in zip(A,B[::-1]))<=K else((i+M)//2,M,i);"*41)
print(M) | (_,K),*T=[list(map(int,t.split()))for t in open(0)]
A,B=list(map(sorted,T))
d=[0,2**40]
exec("i=sum(d)//2;d[-sum(min(0,i-a*b)//b for a,b in zip(A,B[::-1]))<=K]=i;"*41)
print((d[1])) | p02883 |
import heapq as hq
N, K = list(map(int, input().split()))
A = list(map(int,input().split()))
A.sort()
F = list(map(int,input().split()))
F.sort()
q = [(-A[i]*F[N-1-i], F[N-1-i]) for i in range(N)]
hq.heapify(q)
cnt = 0
while cnt < K:
cnt += 1
c = hq.heappop(q)
if c[0] < 0:
hq.heappush(q, (c[0]+c[1], c... | import heapq as hq
N, K = list(map(int, input().split()))
A = list(map(int,input().split()))
A.sort()
F = list(map(int,input().split()))
F.sort()
if sum(A) <= K:
print((0))
exit()
ans = max([A[i]*F[N-1-i] for i in range(N)])
def achievable(score):
cnt = 0
for i in range(N):
a,f = A[i], F[N-1-i]
... | p02883 |
#!/usr/bin/env python3
import sys
INF = float("inf")
import math
import heapq
import copy
def solve(N: int, K: int, A: "List[int]", F: "List[int]"):
h = []
A.sort()
F.sort(reverse=True)
for a, f in zip(A, F):
heapq.heappush(h, (-a*f, a, f))
maxtime = heapq.nsmallest(1, h)
... | #!/usr/bin/env python3
import sys
INF = float("inf")
from bisect import bisect_left
def solve(N: int, K: int, A: "List[int]", F: "List[int]"):
A.sort()
F.sort(reverse=True)
h = []
for a, f in zip(A, F):
h.append((a*f, a, f))
h.sort()
maxtime = h[-1][0]
def isOK(y):
... | p02883 |
import sys
input = sys.stdin.readline
import math
def solve():
n,k = (int(i) for i in input().split())
a = sorted(list(int(i) for i in input().split()))
f = sorted(list(int(i) for i in input().split()),reverse = True)
if sum(a) <= k:
print((0))
exit()
ng = 0
ok = 10**15
while ok-... | import sys
input = sys.stdin.readline
import math
def solve():
n,k = (int(i) for i in input().split())
a = sorted(list(int(i) for i in input().split()))
f = sorted(list(int(i) for i in input().split()),reverse = True)
if sum(a) <= k:
print((0))
exit()
ng = 0
ok = 10**12
while ok-... | p02883 |
def ints():
return [int(x) for x in input().split()]
def ii():
return int(eval(input()))
import math
N, K = ints()
A = list(sorted(ints()))
F = list(reversed(sorted(ints())))
AF = [A[i]*F[i] for i in range(N)]
afmax = max(AF)
def can(max_af):
k = K
for i in range(N):
af = AF[i]
if ... | def ints():
return [int(x) for x in input().split()]
def ii():
return int(eval(input()))
import math
N, K = ints()
A = list(sorted(ints()))
F = list(reversed(sorted(ints())))
AF = [A[i]*F[i] for i in range(N)]
afmax = max(AF)
def can(seiseki):
k = K
for i in range(N):
af = AF[i]
if... | p02883 |
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *AF = list(map(int, read().split()))
A = AF[:N]
F = AF[N:]
A.sort()
F.sort(reverse=True)
C = [a * f ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *AF = list(map(int, read().split()))
A = AF[:N]
F = AF[N:]
A.sort()
F.sort(reverse=True)
C = [a * f ... | p02883 |
n,k=list(map(int,input().split()))
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]
A.sort()
F.sort()
def chk(x):
ct=0
for i in range(n):
a,f=A[i],F[-i-1]
ct+=max(0,a-x//f)
if ct<=k:
return True
else:
return False
l,r=0,A[-1]*F[-1]
while r-l>1:
m=(l... | n,k=list(map(int,input().split()))
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]
A.sort()
F.sort()
def chk(x):
ct=0
for i in range(n):
a,f=A[i],F[-i-1]
ct+=max(0,a-x//f)
if ct>k:
return False
if ct<=k:
return True
else:
return False
l=0
r=0
... | p02883 |
n,k=list(map(int,input().split()))
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]
A.sort()
F.sort()
def chk(x):
ct=0
for i in range(n):
a,f=A[i],F[-i-1]
ct+=max(0,a-x//f)
if ct>k:
return False
if ct<=k:
return True
else:
return False
l=0
r=0
... | n,k=list(map(int,input().split()))
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]
A.sort()
F.sort()
def chk(x):
ct=0
for i in range(n):
a,f=A[i],F[-i-1]
ct+=max(0,a-x//f)
if ct<=k:
return True
else:
return False
l,r=0,A[-1]*F[-1]
while r-l>1:
m=(l... | p02883 |
import bisect
import math
(n,k),a,f = [list(map(int, s.split())) for s in open(0)]
a.sort()
f.sort(reverse=True)
for ans in range(a[-1] * f[-1] + 1):
tmp = 0
for x, y in zip(a,f):
tmp += x - math.floor(ans / y)
if tmp <= k:
break
print(ans) | import math
(n,k),a,f = [list(map(int, s.split())) for s in open(0)]
a.sort()
f.sort(reverse=True)
low = 0
high = 0
for x, y in zip(a,f):
high = max(high, x*y)
while high != low:
test = int((high + low) // 2)
tmp = 0
for x, y in zip(a,f):
tmp += max(0, x - math.floor(test / y))... | p02883 |
import math
(n,k),a,f = [list(map(int, s.split())) for s in open(0)]
a.sort()
f.sort(reverse=True)
low = 0
high = 0
for x, y in zip(a,f):
high = max(high, x*y)
while high != low:
test = int((high + low) // 2)
tmp = 0
for x, y in zip(a,f):
tmp += max(0, x - math.floor(test / y))... | (n,k),a,f = [list(map(int, s.split())) for s in open(0)]
a.sort(reverse=True)
f.sort()
low = 0
high = 0
for x, y in zip(a,f):
high = max(high, x*y)
while high != low:
test = int((high + low) // 2)
tmp = 0
for x, y in zip(a,f):
tmp += max(0, x - int(test / y))
if tmp > k... | p02883 |
import bisect
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a = sorted(a)
f = sorted(f, reverse=True)
score = sorted(((x * y, x, y) for (x, y) in zip(a, f)))
for _ in range(k):
p, x, y = score.pop()
if x > 0:
x -= 1
bi... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a = sorted(a)
f = sorted(f, reverse=True)
def judge(n):
s = 0
for x, y in zip(a, f):
s += max(0, x - n // y)
if s <= k:
return True
else:
return False
... | p02883 |
import math
n,k=list(map(int,input().split()))
a=sorted([int(i) for i in input().split()],reverse=True)
f=sorted([int(i) for i in input().split()])
c=[[a[i],f[i]] for i in range(n)]
c.sort(key=lambda x:x[0]*x[1],reverse=True)
if n==1:
print((max(0,(c[0][0]-k)*c[0][1])))
else:
while True:
#... | n,k=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
#こっちは変えられない
f=sorted(list(map(int,input().split())),reverse=True)
l,r=0,10**12
def cal(x):
global n,f,a,k
ret=0
for i in range(n):
ret+=max(0,a[i]-(x//f[i]))
#print(ret,x)
return ret
while l+1<r:
x=l... | p02883 |
import bisect
import sys
sys.setrecursionlimit(10**9)
INF = 10**20
def main():
N,K = list(map(int,input().split()))
A=list(map(int,input().split()))
F=list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
B=[]
for i in range(N):
B.append((A[i]*F[i],F[i]))
... | import sys
sys.setrecursionlimit(10**9)
INF = 10**20
def main():
N,K = list(map(int,input().split()))
A=list(map(int,input().split()))
F=list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
def c(s): # sに対して単調減少
sum_x = 0
for i in range(N):
a... | p02883 |
def floor_sum(n, m, a, b):
res = 0
while True:
res += (n - 1) * n * (a // m) // 2
a %= m
res += n * (b // m)
b %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_max = y_max * m - b
res += (n - (x_max + a - 1) // a) * y_max
n, ... | def floor_sum(n, m, a, b):
res = 0
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
res += n * (b // m)
b %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_max = b - y_max * m
... | p02560 |
def floor_sum(n, m, a, b):
res = 0
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
res += n * (b // m)
b %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_max = b - y_max * m
... | def floor_sum(n, m, a, b):
res = 0
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
res += n * (b // m)
b %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_max = b - y_max * m
... | p02560 |
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def floor_sum(n,m,a,b): # sum((A*i+B)//M for i in range(N))
res = 0
res += (a//m)*n*(n-1)//2 + (b//m)*n
a %= m
b %= m
y_max = (a*n+b)//m
if y_max == 0... | import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def floor_sum(n,m,a,b): # sum((A*i+B)//M for i in range(N))
res = 0
if a >= m:
res += (a//m)*n*(n-1)//2
a %= m
if b >= m:
res += (b//m)*n
... | p02560 |
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
def floor_sum_1(n, m, a, b):
ret = 0
if a >= m:
ret += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
ret += n * (b // m)
b %= m
... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
def floor_sum_1(n, m, a, b):
ret = 0
if a >= m:
ret += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
ret += n * (b // m)
b %= m
... | p02560 |
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
def floor_sum_1(n, m, a, b):
ret = 0
if a >= m:
ret += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
ret += n * (b // m)
b %= m
... | #!/usr/bin/env python3
import sys
def floor_sum(n, m, a, b):
ret = 0
while True:
if a >= m:
ret += (a // m) * (n - 1) * n // 2
a %= m
if b >= m:
ret += n * (b // m)
b %= m
if a * n + b < m:
return ret
y_ma... | p02560 |
def floor_sum(n, m, a, b):
res = 0
if b >= m:
res += n * (b // m)
b %= m
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_max = b - y_max * m
res += (n ... | # 一番早いのを写経したものを弄ってアルゴリズム勉強のための試し打ち中
def floor_sum(n, m, a, b):
res = 0
if b >= m:
res += n * (b // m)
b %= m
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_... | p02560 |
def floor_sum(n, m, a, b):
res = 0
while True:
res += a//m * n * (n-1) // 2
a %= m
res += b//m * n
b %= m
Y = (a*n+b) // m
X = Y*m-b
if Y == 0:
return res
res += (n+(-X//a)) * Y
n, m, a, b = Y, a, m, -X%a
import s... | def floor_sum(n, m, a, b):
res = 0
while True:
if a >= m:
res += a//m * n * (n-1) // 2
a %= m
if b >= m:
res += b//m * n
b %= m
Y = (a*n+b) // m
X = Y*m-b
if Y == 0:
return res
res += (n+(-X/... | p02560 |
def floor_sum(n, m, a, b):
res = 0
while True:
if a >= m:
res += a//m * n * (n-1) // 2
a %= m
if b >= m:
res += b//m * n
b %= m
Y = (a*n+b) // m
X = Y*m-b
if Y == 0:
return res
res += (n+(-X/... | def floor_sum(n, m, a, b):
res = 0
while True:
if a >= m:
res += a//m * n * (n-1) // 2
a %= m
if b >= m:
res += b//m * n
b %= m
Y = (a*n+b) // m
X = Y*m-b
if Y == 0:
return res
res += (n-(X+a... | p02560 |
def floor_sum(n,m,a,b):
r=0
x,y,z=0,0,0
while 1:
if b>=m:
x=b//m
else:
x=0
if a>=m:
y=a//m
else:
y=0
r+=x*n
b-=x*m
r+=(y*n*(n-1))>>1
a-=y*m
x=(a*n+b)//m
if x==0:
break
y=b-x*m
z=y//a
r+=(n+z)*x
a,b,n,m=m,y-... | import sys
S=sys.stdin.readlines()
def floor_sum(n,m,a,b):
r=0
x,y,z=0,0,0
while 1:
if b>=m:
x=b//m
else:
x=0
if a>=m:
y=a//m
else:
y=0
r+=x*n
b-=x*m
r+=(y*n*(n-1))>>1
a-=y*m
x=(a*n+b)//m
if x==0:
break
y=b-x*m
z=y... | p02560 |
def floor_sum(n,m,a,b):
ans = n*(b//m)
b %= m
while True:
ans += (n-1)*n*(a//m)//2
a %= m
if a*n+b < m:
return ans
y_max = (a*n + b)//m
b -= y_max*m #now we have x_max = -(b//a)
ans += (n + b//a)*y_max
n = y_max
b %= a
... | # coding: utf-8
# Your code here!
def floor_sum(n,m,a,b):
res = 0
while True:
res += ((n-1)*n*(a//m)>>1) + (b//m)*n
a %= m
b %= m
if a*n+b <= m:
return res
Y = (a*n+b)//m
n,m,a,b = Y,a,m, a*n + b - m*Y
import sys
input = sys.stdin.buff... | p02560 |
def floor_sum(n, m, a, b):
""" sum( (a*i + b)//m ), i = 0..n-1 を返す"""
ans = 0
if a >= m:
ans += n * (n - 1) * (a // m) // 2
a %= m
if b >= m:
ans += n * (b // m)
b %= m
y_max = (a * n + b) // m
x_max = y_max * m - b
if y_max == 0:
return an... | def floor_sum(n, m, a, b):
""" sum( (a*i + b) // m ), i = 0..n-1 を返す"""
ans = 0
while True:
if a >= m:
ans += n * (n - 1) * (a // m) // 2
a %= m
if b >= m:
ans += n * (b // m)
b %= m
y_max = (a * n + b) // m
x_max = y... | p02560 |
a, b, c = list(map(int, input().split()))
# from math import sqrt
import decimal
a2 = decimal.Decimal(a)
b2 = decimal.Decimal(b)
c2 = decimal.Decimal(c)
a2 = a2.sqrt()
b2 = b2.sqrt()
c2 = c2.sqrt()
# if sqrt(a) + sqrt(b) < sqrt(c):
# print('Yes')
# else:
# print('No')
if a2 + b2 < c2:
... | a, b, c = list(map(int, input().split()))
if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2:
print('Yes')
else:
print('No') | p02743 |
import math
from decimal import Decimal
a, b, c = list(map(int, input().split()))
A = Decimal(str(a))**Decimal('0.5')
B = Decimal(str(b))**Decimal('0.5')
C = Decimal(str(c))**Decimal('0.5')
if A + B < C:
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
#import numpy as np
import math
#abc_sq = np.sqrt(abc)
d = c - a - b
if 4*a*b < d**2 and d > 0:
print('Yes')
else:
print('No')
| p02743 |
from decimal import *
getcontext().prec = 100000
a,b,c=list(map(int,input().split()))
if Decimal(a).sqrt()+Decimal(b).sqrt()<Decimal(c).sqrt():
print('Yes')
else:
print('No') | import math
a,b,c=list(map(int,input().split()))
if 4*a*b<(c-a-b)*(c-a-b) and c>a+b:
print('Yes')
else:
print('No') | p02743 |
a, b, c = list(map(int, input().split()))
if c-a-b>0 and 4*a*b<(c-a-b)**2:
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
if c-a-b>=0 and 4*a*b<(c-a-b)**2:
print('Yes')
else:
print('No') | p02743 |
a, b, c = list(map(int, input().split()))
l = a * b * 4
r = c - a - b
if r < 0 or l >= r ** 2:
print("No")
else:
print("Yes")
|
A, B, C = list(map(int, input().split()))
x = A * B * 4
y = (C - A - B) ** 2
if x < y and C - A - B > 0:
print("Yes")
else:
print("No")
| p02743 |
from decimal import Decimal, getcontext
getcontext().prec = 100000
a, b, c = list(map(Decimal, input().split()))
print(('Yes' if a.sqrt() + b.sqrt() < c.sqrt() else 'No')) | from decimal import Decimal, getcontext
getcontext().prec = 28
a, b, c = list(map(Decimal, input().split()))
print(('Yes' if a.sqrt() + b.sqrt() < c.sqrt() else 'No')) | p02743 |
from decimal import Decimal, getcontext
getcontext().prec = 50
a, b, c = list(map(Decimal, input().split()))
print(('Yes' if a.sqrt() + b.sqrt() < c.sqrt() else 'No'))
| a, b, c = list(map(int, input().split()))
if c - a - b <= 0:
print('No')
elif 4 * a * b < (c - a - b) ** 2:
print('Yes')
else:
print('No')
| p02743 |
from decimal import *
A, B, C = list(map(int,input().split()))
a = Decimal(A)
b = Decimal(B)
c = Decimal(C)
if a.sqrt() + b.sqrt() < c.sqrt():
print("Yes")
else:
print("No") | a, b, c = list(map(int, input().split()))
if 4*a*b < pow(c-a-b, 2) and c-a-b > 0:
print("Yes")
else:
print("No") | p02743 |
a, b, c = list(map(float, input().split()))
from decimal import *
getcontext().prec = 50
A = Decimal(a).sqrt()
B = Decimal(b).sqrt()
C = Decimal(c).sqrt()
print(('Yes' if A+B<C else 'No')) | a, b, c = list(map(int, input().split()))
if c - a - b <= 0:
print('No')
else:
if 4*a*b < (c - a - b)**2:
print('Yes')
else:
print('No') | p02743 |
from decimal import *
import math
a,b,c = list(map(int,input().split()))
asq = Decimal(a).sqrt()
bsq = Decimal(b).sqrt()
csq = Decimal(c).sqrt()
if asq + bsq < csq:
print('Yes')
else:
print('No') | from decimal import *
a, b, c = list(map(int, input().split()))
a = Decimal(a).sqrt()
b = Decimal(b).sqrt()
c = Decimal(c).sqrt()
import math
if a + b < c:
print('Yes')
else:
print('No') | p02743 |
from decimal import Decimal
import math
a,b,c = list(map(int,input().split()))
d = c - a - b
if d >0 and pow(d,2) > 4 * a * b:
print('Yes')
else:print('No') | a,b,c = list(map(int,input().split()))
d = c - a - b
if d >0 and pow(d,2) > 4 * a * b:
print('Yes')
else:print('No') | p02743 |
import math
a,b,c = list(map(int, input().split()))
x=a**2+b**2+c**2+2*a*b-2*b*c-2*a*c
y=4*a*b
if c-b-a>0 and x-y>0 :
print("Yes")
else:
print("No") | def Judgement(x,y,z):
if z-x-y>0 and (z-x-y)**2-4*x*y>0:
return 0
else:
return 1
a,b,c=list(map(int,input().split()))
ans=Judgement(a,b,c)
if ans==0:
print("Yes")
else:
print("No") | p02743 |
from decimal import Decimal
a, b, c = list(map(int, input().split()))
def f(x):
return Decimal(Decimal(x)**2 + s) / (2 * Decimal(x))
s = a * b # √s
x = 2 # 初期値(0以外の値)
for i in range(10**4):
x = f(x)
l = 2 * x + a + b
if l < c:
print("Yes")
else:
print("No")
| from decimal import Decimal
a, b, c = list(map(int, input().split()))
def f(x):
return Decimal(Decimal(x)**2 + s) / (2 * Decimal(x))
s = a * b # √s
x = 2 # 初期値(0以外の値)
while True:
newX = f(x)
if abs(newX - x) < 1e-7:
x = newX
break
x = newX
l = 2 * x + a + b
i... | p02743 |
a, b, c = list(map(int, input().split()))
s = c - a - b
if s < 0:
ans = 'No'
else:
if 4*a*b < s**2:
ans = 'Yes'
else:
ans = 'No'
print(ans)
|
def main():
a, b, c = list(map(int, input().split()))
if 4*a*b < pow(c - (a + b), 2):
ans = 'Yes'
else:
ans = 'No'
if c - (a + b) <= 0:
ans = 'No'
print(ans)
if __name__ == "__main__":
main()
| p02743 |
def mi():return list(map(str,input().split()))
from decimal import *
a,b,c=mi()
getcontext().prec=1500
a=Decimal(a)**Decimal("0.50")
b=Decimal(b)**Decimal("0.50")
c=Decimal(c)**Decimal("0.50")
if c>a+b:
print("Yes")
else:
print("No")
| a,b,c=list(map(int,input().split()))
d=c-a-b
if d<0:print("No");exit()
if 4*a*b<d**2:
print("Yes")
else:
print("No") | p02743 |
from math import sqrt
from decimal import *
getcontext().prec = 40000
a, b, c = list(map(int, input().split()))
tmp = 2 * sqrt(Decimal(a)) * sqrt(Decimal(b))
print(("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No"))
| from math import sqrt
from decimal import *
a, b, c = list(map(int, input().split()))
tmp = 2 * sqrt(Decimal(a)) * sqrt(Decimal(b))
print(("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No"))
| p02743 |
from decimal import Decimal
A,B,C=list(map(int,input().split()))
if (C-A-B)<0:
print("No")
else:
if Decimal(4*A*B)<Decimal((C-A-B)**2):
print("Yes")
else:
print("No") | A,B,C=list(map(int,input().split()))
if (C-A-B)<0:
print("No")
else:
if 4*A*B<(C-A-B)**2:
print("Yes")
else:
print("No") | p02743 |
import decimal
a,b,c=(decimal.Decimal(x) for x in input().split())
if a.sqrt() + b.sqrt() < c.sqrt():
print("Yes")
else:
print("No")
| import decimal
decimal.getcontext().prec = 28
a,b,c=(decimal.Decimal(x) for x in input().split())
if a.sqrt() + b.sqrt() < c.sqrt():
print("Yes")
else:
print("No")
| p02743 |
from decimal import *
a,b,c=list(map(int,input().split()))
a,b,c=Decimal(a),Decimal(b),Decimal(c)
if c**Decimal(0.5)>a**Decimal(0.5)+b**Decimal(0.5):
print('Yes')
else:
print('No') | a,b,c=list(map(int,input().split()))
if 4*a*b<(c-a-b)**2 and a+b<c:
print('Yes')
else:
print('No') | p02743 |
from decimal import *
def main():
a, b, c = list(map(int, input().split()))
ad = Decimal(a).sqrt()
bd = Decimal(b).sqrt()
cd = Decimal(c).sqrt()
if ad + bd < cd:
is_big = True
else:
is_big = False
print(('Yes' if is_big else 'No'))
if __name__ == '__main_... | def main():
a, b, c = list(map(int, input().split()))
if c - a - b <= 0:
print('No')
exit()
if 4 * a * b < pow(c - a - b, 2):
is_big = True
else:
is_big = False
print(('Yes' if is_big else 'No'))
if __name__ == '__main__':
main()
| p02743 |
from decimal import *
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a, b, c = list(map(int,input().split()))
f = c - a - b
if f > 0 and f ** 2 > 4 * a * b:
print('Yes')
else:
print('No') | p02743 |
from decimal import Decimal
from decimal import *
a, b, c = list(map(str, input().split()))
getcontext().prec = 500
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if a**Decimal("0.5") + b**Decimal("0.5") < c**Decimal("0.5"):
print("Yes")
else:
print("No")
|
from decimal import Decimal
from decimal import *
a, b, c = list(map(str, input().split()))
#getcontext().prec = 1000
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if a**Decimal("0.5") + b**Decimal("0.5") < c**Decimal("0.5"):
print("Yes")
else:
print("No")
| p02743 |
import math
from decimal import Decimal
a,b,c = [int(x) for x in input().split()]
if (Decimal(a).sqrt() + Decimal(b).sqrt()) < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a,b,c = [int(x) for x in input().split()]
if c - a - b < 0:
print("No")
elif 4 * a * b < (c - a - b) ** 2:
print("Yes")
else:
print("No")
| p02743 |
from decimal import *
import math
getcontext().prec = 28
a, b, c = list(map(int, input().split()))
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
a = Decimal.sqrt(a)
b = Decimal.sqrt(b)
c = Decimal.sqrt(c)
if a + b < c:
print("Yes")
else:
print("No")
| from decimal import *
import math
getcontext().prec = 50
a, b, c = list(map(int, input().split()))
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
a = Decimal.sqrt(a)
b = Decimal.sqrt(b)
c = Decimal.sqrt(c)
if a + b < c:
print("Yes")
else:
print("No")
| p02743 |
from decimal import *
getcontext().prec=1000
a,b,c=list(map(int,input().split()))
A=Decimal(a)**Decimal("0.5")
B=Decimal(b)**Decimal("0.5")
C=Decimal(c)**Decimal("0.5")
D= Decimal(10) ** (-100)
if A+B+D<C:
print("Yes")
else:
print("No") | a,b,c=list(map(int,input().split()))
x=a**2 + b**2 + c**2 - 2*a*b - 2*a*c - 2*b*c
if x>0 and a+b-c<0:
print("Yes")
else:
print("No") | p02743 |
from decimal import Decimal
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:
print('Yes')
else:
print('No') | p02743 |
from math import sqrt
from decimal import *
a, b, c = list(map(int, input().split()))
getcontext().prec = 100000
if (Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt()): print('Yes')
else: print('No')
| from math import sqrt
a, b, c = list(map(int, input().split()))
l = (a ** 2) + (b ** 2) + (c ** 2)
r = 2 * (a * b + b * c + c * a)
if (c-a-b > 0 and l > r): print('Yes')
elif(sqrt(c) == sqrt(a) + sqrt(b)): print('No')
else: print('No')
| p02743 |
from math import sqrt
from decimal import *
a, b, c = list(map(int, input().split()))
getcontext().prec = 50000
if (Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt()): print('Yes')
else: print('No')
| from math import sqrt
from decimal import *
a, b, c = list(map(int, input().split()))
if (Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt()): print('Yes')
else: print('No')
| p02743 |
from decimal import Decimal
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if c - a - b <= 0:
print("No")
else:
if (c - a - b) ** 2 - 4 * a * b > 0:
print("Yes")
else:
print("No")
| p02743 |
# Problem C - Sqrt Inequality
# 注意:ルートの計算は近似計算によりWAとなってしまう。
# :整数に落とし込んで計算しよう
# input process
a, b, c = list(map(int, input().split()))
# initialization
tochu_1 = c - a - b
tochu_2 = 4 * a * b
# output process
if tochu_1>0 and (tochu_1)**2>tochu_2:
print("Yes")
else:
print("No")
| # Problem C - Sqrt Inequality
# input
a, b, c = list(map(int, input().split()))
# check
is_ok = (a * b)*4 < (c - a - b)**2 and (c-a-b)>0
# output
if is_ok:
print("Yes")
else:
print("No")
| p02743 |
from decimal import *
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No") | a, b, c = list(map(int, input().split()))
if a + b >= c:
print("No")
else:
if (a + b - c) ** 2 > 4 * a * b:
print("Yes")
else:
print("No") | p02743 |
A, B, C = list(map(int, input().split()))
def intSqrt(n):
M = int(n**0.5)
while (M + 1)**2 <= n:
M += 1
for _ in range(4000):
n *= 100
M *= 10
for add in range(0, 10)[:: -1]:
if (M + add)**2 <= n:
M += add
break
... | A, B, C = list(map(int, input().split()))
def intSqrt(n):
M = int(n**0.5)
while (M + 1)**2 <= n:
M += 1
for _ in range(300):
n *= 100
M *= 10
for add in range(0, 10)[:: -1]:
if (M + add)**2 <= n:
M += add
break
... | p02743 |
A, B, C = list(map(int, input().split()))
def intSqrt(n):
M = int(n**0.5)
while (M + 1)**2 <= n:
M += 1
for _ in range(300):
n *= 100
M *= 10
for add in range(0, 10)[:: -1]:
if (M + add)**2 <= n:
M += add
break
... | a, b, c = list(map(int, input().split()))
print(('Yes' if c - a - b >= 0 and (c - a - b)**2 > 4 * a * b else 'No'))
| p02743 |
from sys import stdin
from decimal import Decimal,getcontext
getcontext().prec = 50
a,b,c = [Decimal(x) for x in stdin.readline().rstrip().split()]
if a.sqrt() + b.sqrt() < c.sqrt():
print("Yes")
else:
print("No") | from sys import stdin
a,b,c = [int(x) for x in stdin.readline().rstrip().split()]
if 4*a*b < (c-a-b)**2 and (c-a-b) > 0:
print("Yes")
else:
print("No") | p02743 |
from decimal import Decimal
import math
a,b,c = list(map(int,input().split()))
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if (a.sqrt() + b.sqrt()) < c.sqrt():
print("Yes")
else:
print("No")
| a,b,c = list(map(int,input().split()))
if c - a - b > 0 and 4*a*b < (c-a-b)**2:
print("Yes")
else:
print("No")
| p02743 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.