Submission #40261549


Source Code Expand

import math

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

if N * N < M:
  print(-1)
  exit()
if M <= N:
  print(M)
  exit()
  
X = float("inf")
rootM = int(M ** (1 / 2))
for a in range(math.ceil(M / N), rootM + 1):
  b, m = divmod(M, a)
  if m == 0:
    print(M)
    exit()
  X = min(X, a * (b + 1))
  
print(X)  

Submission Info

Submission Time
Task D - M<=ab
User arakaki_tokyo
Language PyPy3 (7.3.0)
Score 0
Code Size 322 Byte
Status WA
Exec Time 87 ms
Memory 64336 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 50
WA × 6
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All crandom_00.txt, crandom_01.txt, crandom_02.txt, crandom_03.txt, crandom_04.txt, crandom_05.txt, crandom_06.txt, crandom_07.txt, crandom_08.txt, crandom_09.txt, example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, impossible_00.txt, impossible_01.txt, impossible_02.txt, impossible_03.txt, impossible_04.txt, just_00.txt, just_01.txt, just_02.txt, just_03.txt, just_04.txt, just_05.txt, just_06.txt, nlarge_00.txt, nlarge_01.txt, nlarge_02.txt, nlarge_03.txt, nlarge_04.txt, nlarge_05.txt, nlarge_06.txt, nlarge_07.txt, nlarge_08.txt, over_00.txt, over_01.txt, over_02.txt, over_03.txt, over_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt
Case Name Status Exec Time Memory
crandom_00.txt AC 87 ms 61776 KiB
crandom_01.txt AC 54 ms 62288 KiB
crandom_02.txt AC 51 ms 61960 KiB
crandom_03.txt AC 52 ms 62652 KiB
crandom_04.txt AC 56 ms 62532 KiB
crandom_05.txt AC 56 ms 61932 KiB
crandom_06.txt AC 53 ms 64096 KiB
crandom_07.txt AC 52 ms 62032 KiB
crandom_08.txt AC 55 ms 61788 KiB
crandom_09.txt AC 53 ms 61896 KiB
example_00.txt AC 52 ms 62460 KiB
example_01.txt AC 50 ms 62020 KiB
example_02.txt AC 54 ms 62288 KiB
hand_00.txt AC 55 ms 62472 KiB
hand_01.txt AC 51 ms 62064 KiB
hand_02.txt WA 54 ms 62304 KiB
hand_03.txt AC 57 ms 62060 KiB
hand_04.txt AC 53 ms 61936 KiB
hand_05.txt AC 53 ms 61968 KiB
hand_06.txt AC 50 ms 62020 KiB
impossible_00.txt AC 48 ms 61760 KiB
impossible_01.txt AC 53 ms 62072 KiB
impossible_02.txt AC 52 ms 61968 KiB
impossible_03.txt AC 50 ms 61820 KiB
impossible_04.txt AC 51 ms 61776 KiB
just_00.txt AC 54 ms 62328 KiB
just_01.txt AC 45 ms 62516 KiB
just_02.txt AC 51 ms 62288 KiB
just_03.txt AC 55 ms 63948 KiB
just_04.txt AC 56 ms 64180 KiB
just_05.txt AC 54 ms 62164 KiB
just_06.txt AC 50 ms 62472 KiB
nlarge_00.txt AC 51 ms 62284 KiB
nlarge_01.txt AC 54 ms 62152 KiB
nlarge_02.txt AC 53 ms 62312 KiB
nlarge_03.txt AC 52 ms 62300 KiB
nlarge_04.txt AC 75 ms 64128 KiB
nlarge_05.txt AC 53 ms 62384 KiB
nlarge_06.txt AC 54 ms 62852 KiB
nlarge_07.txt AC 74 ms 64104 KiB
nlarge_08.txt AC 73 ms 64084 KiB
over_00.txt WA 54 ms 62476 KiB
over_01.txt WA 51 ms 62288 KiB
over_02.txt WA 47 ms 62272 KiB
over_03.txt WA 50 ms 62484 KiB
over_04.txt WA 54 ms 62424 KiB
random_00.txt AC 53 ms 62408 KiB
random_01.txt AC 50 ms 62280 KiB
random_02.txt AC 51 ms 62272 KiB
random_03.txt AC 56 ms 62372 KiB
random_04.txt AC 56 ms 62344 KiB
random_05.txt AC 52 ms 62420 KiB
random_06.txt AC 53 ms 62356 KiB
random_07.txt AC 50 ms 62452 KiB
random_08.txt AC 62 ms 64336 KiB
random_09.txt AC 57 ms 64108 KiB