Problem:


Score : 400 points

Problem Statement

You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:

Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.

Throw one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.

The monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?

Constraints

1 ≤ N ≤ 10^5

1 ≤ H ≤ 10^9

1 ≤ a_i ≤ b_i ≤ 10^9

All input values are integers.

Input

Input is given from Standard Input in the following format:

N H
a_1 b_1
:
a_N b_N

Output

Print the minimum total number of attacks required to vanish the monster.

Sample Input 1

1 10
3 5

Sample Output 1

3

You have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.

Sample Input 2

2 10
3 5
2 6

Sample Output 2

2

In addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.

Sample Input 3

4 1000000000
1 1
1 10000000
1 30000000
1 99999999

Sample Output 3

860000004

Sample Input 4

5 500
35 44
28 83
46 62
31 79
40 43

Sample Output 4

9



Sample input:
1 10
3 5


Sample output:
3

Submission status: Wrong Answer

Solution code:
s=input()
s=s.split(' ')
honsu = int(s[0])
HP  = int(s[1])

kill=[]
throw=[]
tmp_throw=[]
for i in range(honsu):
	a,b = input().split(' ')
	kill.append(int(a))
	throw.append(int(b))
	tmp_throw.append(int(b))

#all throw?
tmp_throw.sort()
tmp_throw.reverse()
suma=0
for i,data in enumerate(tmp_throw):
	suma+=int(data)
	if suma >= HP:
		print(i+1)
		exit()

#
count=0
a_max=max(kill)
b_min=min(throw)

i = kill.index(a_max)
b_i = throw[i]
b_sum=0

for i in tmp_throw:
	if i >a_max :
		count+=1
		b_sum += i
	else:
		break

HP = HP - b_sum
temp = HP/a_max
if temp == int(temp):
	temp=int(temp)
else:
	temp=int(temp)+1
count += temp
print(count)

Submission status: Wrong Answer

Solution code:
s=input()
s=s.split(' ')
honsu = int(s[0])
HP  = int(s[1])

kill=[]
throw=[]
tmp_throw=[]
for i in range(honsu):
	a,b = input().split(' ')
	kill.append(int(a))
	throw.append(int(b))
	tmp_throw.append(int(b))

#all throw?
tmp_throw.sort()
tmp_throw.reverse()
suma=0
for i,data in enumerate(tmp_throw):
	suma+=int(data)
	if suma >= HP:
		print(i+1)
		exit()

#
count=0
a_max=max(kill)
b_min=min(throw)

i = kill.index(a_max)
b_i = throw[i]
b_sum=0

for i in tmp_throw:
	if i >a_max :
		count+=1
		b_sum += i
	else:
		break

HP = HP - b_sum
temp = HP/a_max
if temp > int(temp):
	temp=int(temp)+1
else:
	temp=int(temp)	
count += temp
print(count)

Submission status: Wrong Answer

Solution code:
s=input()
s=s.split(' ')
honsu = int(s[0])
HP  = int(s[1])

kill=[]
throw=[]
tmp_throw=[]
for i in range(honsu):
	a,b = input().split(' ')
	kill.append(int(a))
	throw.append(int(b))
	tmp_throw.append(int(b))

#all throw?
tmp_throw.sort()
tmp_throw.reverse()
suma=0
for i,data in enumerate(tmp_throw):
	suma+=int(data)
	if suma >= HP:
		print(i+1)
		exit()

#
count=0
a_max=max(kill)
b_min=min(throw)

i = kill.index(a_max)
b_i = throw[i]
b_sum=0

for i in tmp_throw:
	if i >=a_max :
		count+=1
		b_sum += i
	else:
		break

HP = HP - b_sum
temp = HP/a_max
if temp > int(temp):
	temp=int(temp)+1
else:
	temp=int(temp)	
count += temp
print(count)

Submission status: Wrong Answer

Solution code:
s=input()
s=s.split(' ')
honsu = int(s[0])
HP  = int(s[1])

kill=[]
throw=[]
tmp_throw=[]
for i in range(honsu):
	a,b = input().split(' ')
	kill.append(int(a))
	throw.append(int(b))
	tmp_throw.append(int(b))

#all throw?
tmp_throw.sort()
tmp_throw.reverse()
suma=0
for i,data in enumerate(tmp_throw):
	suma+=int(data)
	if suma >= HP:
		print(i+1)
		exit()

#
count=0
a_max=max(kill)
b_min=min(throw)

i = kill.index(a_max)
b_i = throw[i]
b_sum=0

for i in tmp_throw:
	if i >=b_i :
		count+=1
		b_sum += i
	else:
		break

HP = HP - b_sum
temp = HP/a_max
if temp > int(temp):
	temp=int(temp)+1
else:
	temp=int(temp)	
count += temp
print(count)

Submission status: Wrong Answer

Solution code:
s=input()
s=s.split(' ')
honsu = int(s[0])
HP  = int(s[1])

kill=[]
throw=[]
tmp_throw=[]
for i in range(honsu):
	a,b = input().split(' ')
	kill.append(int(a))
	throw.append(int(b))
	tmp_throw.append(int(b))

#all throw?
tmp_throw.sort()
tmp_throw.reverse()
suma=0
for i,data in enumerate(tmp_throw):
	suma+=int(data)
	if suma >= HP:
		print(i+1)
		exit()

#
count=0
a_max=max(kill)
b_min=min(throw)

i = kill.index(a_max)
b_i = throw[i]
b_sum=0

for i in throw:
	if i >=b_i :
		count+=1
		b_sum += i

HP = HP - b_sum
temp = HP/a_max
if temp > int(temp):
	temp=int(temp)+1
else:
	temp=int(temp)	
count += temp
print(count)

Submission status: Wrong Answer

Solution code:
s=input()
s=s.split(' ')
honsu = int(s[0])
HP  = int(s[1])

kill=[]
throw=[]
tmp_throw=[]
for i in range(honsu):
	a,b = input().split(' ')
	kill.append(int(a))
	throw.append(int(b))
	tmp_throw.append(int(b))

#all throw?
tmp_throw.sort()
tmp_throw.reverse()
suma=0
for i,data in enumerate(tmp_throw):
	suma+=int(data)
	if suma >= HP:
		print(i+1)
		exit()

#
count=0
a_max=max(kill)
b_min=min(throw)

i = kill.index(a_max)
b_i = throw[i]
b_sum=0

if a<b:
	b_sum=sum(throw) - b_i
else:
	for i in throw:
		if i >=b_i :
			b_sum += i
	b_sum -= b_i

HP = HP - b_sum
count = honsu
temp = (HP-b_i)/a_max
if temp > int(temp):
	temp=int(temp)+1
else:
	temp=int(temp)	
count += temp
print(count)

Submission status: Wrong Answer

Solution code:
import sys
import math
N, H = map(int, input().split())

a = []
b = []
num_attack = 0

for _ in range(N):
	a_i, b_i = map(int, input().split())
	a.append(a_i)
	b.append(b_i)
max_a = max(a)
Strong_b = [b_i for b_i in b if b_i > max_a]

if sum(Strong_b) >= H:
	Strong_b = sorted(Strong_b)
	for i in range(N):
		H -= Strong_b[i]
		if H <= 0:
			print(i+1)
			sys.exit()

H -= sum(Strong_b)
num_attack = len(Strong_b) + math.ceil(H/max_a)
print(num_attack)

Submission status: Wrong Answer

Solution code:
import sys
import math
N, H = map(int, input().split())

a = []
b = []
num_attack = 0

for _ in range(N):
	a_i, b_i = map(int, input().split())
	a.append(a_i)
	b.append(b_i)
max_a = max(a)
Strong_b = [b_i for b_i in b if b_i > max_a]

if sum(Strong_b) >= H:
	b = sorted(b)
	for i in range(N):
		H -= b[i]
		if H <= 0:
			print(i+1)
			sys.exit()

H -= sum(Strong_b)
num_attack = len(Strong_b) + math.ceil(H/max_a)
print(num_attack)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

n, h = map(int, input().strip().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().strip().split())

arr_a = np.array(a)
idx_a_max = arr_a.argmax()
a_max = a[idx_a_max]
b_tmp = b[idx_a_max]
b[idx_a_max] = 0
b.sort()

sum_b = 0
ans = 0

for i in range(n - 1):
    if b[-1 - i] < a_max:
        break
    sum_b += b[-1 - i]
    ans += 1
    if sum_b >= h:
        print(ans)
        sys.exit()

h_tmp = h - sum_b - b_tmp
ans += 1
if h_tmp > 0:
    ans += (h_tmp + a_max - 1) // a_max

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

n, h = map(int, input().strip().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().strip().split())

arr_a = np.array(a)
idx_a_max = arr_a.argmax()
a_max = a[idx_a_max]
b_tmp = b[idx_a_max]
b[idx_a_max] = 0
b.sort()

sum_b = 0
ans = 0

flag = False
for i in range(n - 1):
    if b[-1 - i] < a_max:
        break
    sum_b += b[-1 - i]
    ans += 1
    if sum_b > h:
        print(ans)
        flag = True
        break

if not flag:
    h_tmp = h - sum_b - b_tmp
    ans += 1
    if h_tmp > 0:
        ans += (h_tmp + a_max - 1) // a_max

    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

n, h = map(int, input().strip().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().strip().split())

arr_a = np.array(a)
idx_a_max = arr_a.argmax()
a_max = a[idx_a_max]
b_tmp = b[idx_a_max]
b[idx_a_max] = 0
b.sort()

sum_b = 0
ans = 0

flag = False
for i in range(n - 1):
    if b[-1 - i] < a_max:
        break
    sum_b += b[-1 - i]
    ans += 1
    if sum_b > h:
        ans = i + 1
        print(ans)
        flag = True
        break

if not flag:
    h_tmp = h - sum_b - b_tmp
    ans += 1
    if h_tmp > 0:
        ans += (h_tmp + a_max - 1) // a_max

    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

n, h = map(int, input().strip().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().strip().split())

arr_a = np.array(a)
idx_a_max = arr_a.argmax()
a_max = a[idx_a_max]
b_tmp = b[idx_a_max]
b[idx_a_max] = 0
b.sort()

sum_b = 0
ans = 0

flag = False
for i in range(n - 1):
    if b[-1 - i] < a_max:
        break
    sum_b += b[-1 - i]
    ans += 1
    if sum_b > h:
        ans = i + 1
        print(ans)
        flag = True

if not flag:
    h_tmp = h - sum_b - b_tmp
    ans += 1
    if h_tmp > 0:
        ans += (h_tmp + a_max - 1) // a_max

    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

n, h = map(int, input().strip().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().strip().split())

arr_a = np.array(a)
idx_a_max = arr_a.argmax()
a_max = a[idx_a_max]
b_tmp = b[idx_a_max]
b[idx_a_max] = 0
b.sort()

sum_b = 0
ans = 0

for i in range(n - 1):
    if b[-1 - i] < a_max:
        break
    sum_b += b[-1 - i]
    ans += 1
    if sum_b > h:
        ans = i + 1
        print(ans)
        sys.exit()

h_tmp = h - sum_b - b_tmp
ans += 1
if h_tmp > 0:
    ans += (h_tmp + a_max - 1) // a_max

print(ans)

Submission status: Wrong Answer

Solution code:
import math
num, HP = [int(i) for i in input().split()]
main_atack = 0
main_throw = 0
count = 0

for i in range(num):
    tmp_atack, tmp_throw = [int(i) for i in input().split()]
    if main_atack < tmp_atack:
        main_atack = tmp_atack
        main_throw = tmp_throw
    else:
        if main_atack < tmp_throw:
            HP -= tmp_throw
            count += 1

if main_atack < main_throw:
    HP -= main_throw
    count += 1
    
count += math.ceil(HP / main_atack)
print(count)

Submission status: Wrong Answer

Solution code:
def main():
    N, Y = [int(i) for i in input().split()]

    A = []
    B = []

    for i in range(N):
        a, b = [int(i) for i in input().split()]
        A.append(a)
        B.append(b)

    B.sort()
    B.reverse()
    A.sort()
    A.reverse()

    cnt = 0
    for i in range(1000000):
        if Y <= 0:
            print(int(cnt))
            return

        b_m = max(B, default=0)
        a_m = max(A)
        if b_m > a_m:
            b_cnt = B.count(b_m)
            for z in range(b_cnt):
                B.remove(b_m)
            Y = Y - b_m * b_cnt
            cnt += b_cnt
        else:
            if Y % a_m == 0:
                c = int(Y / a_m)
                print(cnt + c)
                return
            else:
                c = int(Y / a_m)
                print(cnt + c + 1)
                return
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, Y = [int(i) for i in input().split()]

    A = []
    B = []

    for i in range(N):
        a, b = [int(i) for i in input().split()]
        A.append(a)
        B.append(b)

    B.sort()
    B.reverse()
    A.sort()
    A.reverse()

    cnt = 0
    for i in range(1000000):
        if Y <= 0:
            print(int(cnt))
            return

        b_m = max(B, default=0)
        a_m = max(A)
        if b_m > a_m:
            b_cnt = B.count(b_m)
            B.remove(b_m)
            Y = Y - b_m * b_cnt
            cnt += b_cnt
        else:
            if Y % a_m == 0:
                c = int(Y / a_m)
                print(cnt + c)
                return
            else:
                c = int(Y / a_m)
                print(cnt + 1)
                return
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, Y = [int(i) for i in input().split()]

    A = []
    B = []

    for i in range(N):
        a, b = [int(i) for i in input().split()]
        A.append(a)
        B.append(b)

    B.sort()
    B.reverse()
    A.sort()
    A.reverse()

    cnt = 0
    for i in range(1000000):
        if Y <= 0:
            print(int(cnt))
            return

        b_m = max(B, default=0)
        a_m = max(A)
        if b_m > a_m:
            Y = Y - b_m
            B.remove(b_m)
            cnt += 1
        else:
            if Y % a_m == 0:
                c = Y / a_m
                print(int(cnt + c))
                return
            else:
                c = Y / a_m
                print(int(cnt + 1))
                return


main()

Submission status: Wrong Answer

Solution code:
def main():
    N, Y = [int(i) for i in input().split()]

    A = []
    B = []

    for i in range(N):
        a, b = [int(i) for i in input().split()]
        A.append(a)
        B.append(b)

    B.sort()
    B.reverse()
    A.sort()
    A.reverse()

    cnt = 0
    for i in range(1000000):
        if Y <= 0:
            print(cnt)
            return

        b_m = max(B, default=0)
        a_m = max(A)
        if b_m > a_m:
            Y = Y - b_m
            B.remove(b_m)
            cnt += 1
        else:
            if Y % a_m == 0:
                c = Y / a_m
                print(cnt + c)
                return
            else:
                c = Y / a_m
                print(cnt + 1)
                return


main()

Submission status: Wrong Answer

Solution code:
import math

N, H = map(int, input().split())
kiri = []
nage = []
for n in range(N):
    tmps = list(map(int, input().split()))
    kiri.append(tmps[0])
    nage.append(tmps[1])

kiri_max = max(kiri)
nage.sort(reverse=True)

count = 0
while (H > 0):
    if (len(nage) != 0):
        H -= nage[0]
        nage.pop(0)
        count += 1
    else:
        if ( H % kiri_max):
            count += H // kiri_max
        else:
            count += H // kiri_max + 1
        break

print(count)

Submission status: Wrong Answer

Solution code:
#coding:UTF=-8
import math
N, H = map(int, input().split())

a = []
b = []
for i in range(N):
    t1, t2= map(int, input().split())
    a.append(t1)
    b.append(t2)

mx = max(a)
b = sorted(b, reverse=True)
count = 0
attack = 0
for i in range(N):
    if mx > b[i] or attack >= H:
        break
    count += 1
    attack += b[i]

count += math.ceil((H - attack) / mx)

print(count)

Submission status: Wrong Answer

Solution code:
# coding: utf_8
""" abc085d """

import math

n, h = map(int, input().split())
katanaA = []
katanaB = []
for i in range(n):
    a, b = map(int, input().split())
    katanaA.append(a)
    katanaB.append(b)

maxA = max(katanaA)
throwKatanaB = [k for k in katanaB if k > maxA]
throwKatanaB.sort()
count = 0
for t in throwKatanaB:
    h -= t
    count += 1
    if h <= 0:
        break
if h <= 0:
    print(count)
else:
    count += int(math.ceil(h / maxA))
    print(count)

Submission status: Wrong Answer

Solution code:
# coding: utf_8
""" abc085d """

import math

n, h = map(int, input().split())
katanaA = []
katanaB = []
for i in range(n):
    a, b = map(int, input().split())
    katanaA.append(a)
    katanaB.append(b)

maxA = max(katanaA)
throwKatanaB = [k for k in katanaB if k > maxA]
count = 0
for t in throwKatanaB:
    h -= t
    count += 1
    if h <= 0:
        break
if h <= 0:
    print(count)
else:
    count += int(math.ceil(h / maxA))
    print(count)

Submission status: Wrong Answer

Solution code:
N, H = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())

a_max = max(a)
c = 0
for i in range(N):
    if b[i] > a_max and H > 0:
        H -= b[i]
        c += 1

if H > 0:
    c += (H + a_max - 1) // a_max

print(c)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N, H = map(int, input().split())

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

a_max = 0 # 最大のa

for i in range(N):
    if D[i][0] >= a_max:
        a_max = D[i][0]

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > a_max:
        B_larger.append(B[i])

B_larger.sort(reverse=True)

n = 0

for i in range(len(B_larger)):
    H = H - B_larger[i]
    n += 1    
    if H <= 0: print(n)

if H > 0:
    n += math.ceil(H/a_max)
    print(n)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N, H = map(int, input().split())

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

a_max = 0 # 最大のa

for i in range(N):
    if D[i][0] >= a_max:
        a_max = D[i][0]

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > a_max:
        B_larger.append(B[i])

n = len(B_larger) + math.ceil((H - sum(B_larger))/a_max)

print(n)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N, H = map(int, input().split())

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

a_max = 0 # 最大のa

for i in range(N):
    if D[i][0] >= a_max:
        a_max = D[i][0]

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > a_max:
        B_larger.append(B[i])

n = len(B_larger) - math.ceil((H - sum(B_larger))/a_max)

print(n)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N, H = map(int, input().split())

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

a_max = 0 # 最大のa

for i in range(N):
    if D[i][0] >= a_max:
        a_max = D[i][0]

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > a_max:
        B_larger.append(B[i])

n = len(B_larger)
H = H - sum(B_larger)

while H > 0:
    H = H - a_max
    n += 1

print(n)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N, H = map(int, input().split())

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

a_max = 0 # 最大のa

for i in range(N):
    if D[i][0] >= a_max:
        a_max = D[i][0]

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > a_max:
        B_larger.append(B[i])

n = len(B_larger) + math.ceil((H - sum(B_larger))/a_max)
print(math.ceil((H - sum(B_larger))/a_max))
print(n)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N, H = map(int, input().split())

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

D.sort(reverse=True) # aを大きい順にソート

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > D[0][0]:
        B_larger.append(B[i])

n = len(B_larger) + math.ceil((H - sum(B_larger))/D[0][0])

print(n)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N, H = map(int, input().split())

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

D.reverse() # aを大きい順にソート

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > D[0][0]:
        B_larger.append(B[i])

n = len(B_larger) + math.ceil((H - sum(B_larger))/D[0][0])

print(n)

Submission status: Wrong Answer

Solution code:
from math import ceil
n,h = map(int,input().split())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i] , b[i] = map(int,input().split())
bs = list(sorted(b,reverse=True))
ma = max(a)
ret = 0
while ret < n:
    if bs[0] > ma:
        h -= bs[0]
        bs.pop(0)
        ret += 1
        if h < 0 : break
    else:
        break

if h > 0: ret += ceil(h/ma)
print(ret)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    if H > 0:
        H -= L2[i]
        count += 1
        if H <= 0:
            print(count)

if H > 0:
    if H % M == 0:
        count += H//M
        print(count)
    else:
        count = count + H//M + 1
        print(count)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    if H > 0:
        H -= L2[i]
        count += 1
        if H <= 0:
            print(count)

if H > 0:
    if H % M == 0:
        count += H//M
        print(count)
    else:
        count += H//M +1
        print(count)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    if H > 0:
        H -= L2[i]
        count += 1
        if H <= 0:
            print(count)

for i in range(0,N):
    if H > 0:
        H -= M
        count += 1
        if H <= 0:
            print(count)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] >= M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    if H > 0:
        H -= L2[i]
        count += 1
        if H <= 0:
            print(count)

if H > 0:
    if H % M == 0:
        count += H//M
        print(count)
    else:
        count += H//M + 1
        print(count)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    if H > 0:
        H -= L2[i]
        count += 1
        if H <= 0:
            print(count)

if H > 0:
    if H % M == 0:
        count += H//M
        print(count)
    else:
        count += H//M + 1
        print(count)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    H -= L2[i]
    count += 1
    if H <= 0:
        print(count)
        break

if H > 0:
    count = count + H/M
    print(int(count)+1)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    if H > 0:
        H -= L2[i]
        count += 1
        if H <= 0:
            print(count)

if H > 0:
    count += H//M
    print(count)

Submission status: Wrong Answer

Solution code:
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

for i in range(0,len(L2)):
    for j in range(i, len(L2)-1):
        if L2[j] < L2[j+1]:
            Y = L2[j+1]
            L2[j+1] = L2[j]
            L2[j] = Y

count = 0

for i in range(0,len(L2)):
    if H > 0:
        H -= L2[i]
        count += 1
        if H <= 0:
            print(count)

if H > 0:
    count += H//M
    print(count)

Submission status: Wrong Answer

Solution code:
#通ってない！
l0 = input().split(' ')
N = int(l0[0])
H = int(l0[1])
L = []
i=0
while i < N:
    l1 = input().split(' ')
    l2 = [int(l1[0]), int(l1[1])]
    L.append(l2)
    i += 1
L.sort(key = lambda x:x[1])
#b_iの順に並び変え
L2 = L.copy()
L2.sort()
Amax = L2[N-1][0]
p=N-1
while p >= 0:
    if L[p][1] > Amax:
        p -= 1
    else:
        break
p += 1
Btot = 0
counter = 0
while p < N:
    Btot += L[p][1]
    p += 1
    counter += 1

rem = H - Btot
st =  rem // Amax
counter += st
if st * Amax != rem:
    counter += 1
print(counter)

Submission status: Wrong Answer

Solution code:
l0 = input().split(' ')
N = int(l0[0])
H = int(l0[1])
L = []
i=0
while i < N:
    l1 = input().split(' ')
    l2 = [int(l1[0]), int(l1[1])]
    L.append(l2)
    i += 1
L.sort(key = lambda x:x[1])
#b_iの順に並び変え
L2 = L.copy()
L2.sort()
Amax = L2[N-1][0]
p=N-1
while p >= 0:
    if L[p][1] > Amax:
        p -= 1
    else:
        break
p += 1
Btot = 0
counter = 0
while p < N:
    Btot += L[p][1]
    p += 1
    counter += 1

rem = H - Btot
counter += rem // Amax
if rem % Amax != 0:
    counter += 1
c = int(counter)
print(str(c))

Submission status: Wrong Answer

Solution code:
l0 = input().split(' ')
N = int(l0[0])
H = int(l0[1])
L = []
i=0
while i < N:
    l1 = input().split(' ')
    l2 = [int(l1[0]), int(l1[1])]
    L.append(l2)
    i += 1
L.sort(key = lambda x:x[1])
#b_iの順に並び変え
L2 = L.copy()
L2.sort()
Amax = L2[N-1][0]
p=N-1
while p >= 0:
    if L[p][1] > Amax:
        p -= 1
    else:
        break
p += 1
Btot = 0
counter = 0
while p < N:
    Btot += L[p][1]
    p += 1
    counter += 1

rem = H - Btot
counter += rem // Amax
if rem % Amax != 0:
    counter += 1
print(counter)

Submission status: Wrong Answer

Solution code:

import numpy as np

import itertools

import math 
from collections import defaultdict as dd
def main():
    N, Y = map(int, input().split())

    A = []
    for n in range(N):
        a,b = map(int, input().split())
        A.append([a,b])

    A = np.array(A)
    max = np.max(A[:,0])

    A = A[A[:, 1] > max]
    A.sort(axis=1)


    count = 0
    s = Y
    for k in range(A.shape[0]):
        a = A[-(k+1)][1]
        s -= a
        count += 1
        if s <= 0:
            print (count)
            return

    a = (s//max) 

    if s == a*max:
        print ((s//max)+count)

    else:
        print ((s//max)+count+1)





if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()

Submission status: Wrong Answer

Solution code:
N,H = input().split()
n = int(N)
h = int(H)
da = 0
db = []
for i in range(n):
    a,b = tuple(map(int,input().split()))
    da = max(a,da)
    db.append(b)
db.sort()      
#　その都度最大値を持ってくる
#　持ってきたのが2番目の要素なら消す、1番目の要素なら維持する
total = 0 
i = 0
while total < h:
    if len(db) == 0:
        i += (h - total)//da
        break
    elif db[-1] >= da:
        total += db.pop()
    else:
        total += da
    i += 1
print(str(i))