Logo
(追記) (追記ここまで)

34523번 - Asteroid Mining 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB222100.000%

문제

It is the year 2217 and Ryan is an asteroid miner. He makes a living by mining asteroids and selling them at the CCO (Celestial Cargo Outpost).

On his latest mining expedition, he has mined $N$ mineral chunks where the $i$-th chunk has a value $v_i$ and a mass $m_i$. Ryan plans to transport a set of chunks to the CCO with his rocket, but he only has enough fuel to last one more trip. He calculated that the maximum total mass he can safely carry on his rocket is $M$. Due to Ryan’s mining technique, the chunks exhibit a special property: for any two mineral chunks, one’s mass is divisible by the other chunk’s mass.

Help Ryan find the maximum total value he can ship to CCO while adhering to his rocket’s constraints.

입력

The first line will contain two space-separated integers $N$ (1ドル ≤ N ≤ 500,円 000$) and $M$ (1ドル ≤ M ≤ 10^{12}$).

The next $N$ lines will each contain two space-separated integers $v_i$ (1ドル ≤ v_i ≤ 10^{12}$) and $m_i$ (1ドル ≤ m_i ≤ 10^{12}$), representing the value and mass of the $i$-th mineral chunk respectively. Additionally, for any two mineral chunks $i,ドル $j$ (1ドル ≤ i, j ≤ N$), either $m_i | m_j$ or $m_j | m_i,ドル where $a | b$ means that $a$ is a divisor of $b$ (i.e., $b/a$ is an integer).

출력

On one line, output one integer, the maximum total value Ryan can ship to CCO.

제한

서브태스크

번호배점제한
12

$N = 2,ドル 1ドル ≤ M ≤ 10^4$

22

1ドル ≤ N ≤ 20,ドル 1ドル ≤ M ≤ 10^4$

34

1ドル ≤ N ≤ 1,円 000,ドル 1ドル ≤ M ≤ 10^4$

46

1ドル ≤ N ≤ 1,円 000,ドル 1ドル ≤ M ≤ 10^8$

52

1ドル ≤ N ≤ 500,円 000,ドル 1ドル ≤ M ≤ 10^8,ドル All $m_i$ are equal.

63

1ドル ≤ N ≤ 500,円 000,ドル 1ドル ≤ M ≤ 10^8,ドル At most 2ドル$ distinct $m_i$.

76

1ドル ≤ N ≤ 500,円 000,ドル 1ドル ≤ M ≤ 10^{12}$

예제 입력 1

6 10
1 1
5 2
200 6
9 2
6 2
100 1

예제 출력 1

310

Ryan can take all the chucks except the second and fifth chucks to achieve a total value of 1ドル + 200 +たす 9 +たす 100 = 310$. Note that the total mass of the chunks is 1ドル + 6 + 2 + 1 = 10$. We can show that this is optimal.

노트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2025 > CCO 2025 1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /