結果

問題 No.2718 Best Consonance
ユーザー PNJPNJ
提出日時 2024-04-05 23:09:38
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 649 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,504 KB
実行使用メモリ 109,732 KB
最終ジャッジ日時 2024-04-10 10:54:38
合計ジャッジ時間 43,345 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
61,252 KB
testcase_01 AC 45 ms
61,828 KB
testcase_02 AC 43 ms
61,128 KB
testcase_03 AC 43 ms
60,916 KB
testcase_04 AC 43 ms
61,436 KB
testcase_05 AC 43 ms
61,296 KB
testcase_06 AC 43 ms
61,400 KB
testcase_07 AC 43 ms
61,064 KB
testcase_08 AC 44 ms
61,492 KB
testcase_09 AC 92 ms
80,084 KB
testcase_10 AC 95 ms
80,232 KB
testcase_11 AC 90 ms
80,144 KB
testcase_12 AC 90 ms
79,968 KB
testcase_13 AC 94 ms
80,224 KB
testcase_14 AC 1,891 ms
108,204 KB
testcase_15 AC 1,409 ms
100,200 KB
testcase_16 AC 1,832 ms
101,548 KB
testcase_17 AC 1,204 ms
97,320 KB
testcase_18 AC 1,680 ms
104,116 KB
testcase_19 AC 1,389 ms
99,820 KB
testcase_20 AC 1,837 ms
108,456 KB
testcase_21 AC 1,783 ms
105,264 KB
testcase_22 AC 1,812 ms
106,136 KB
testcase_23 AC 1,287 ms
94,888 KB
testcase_24 AC 1,972 ms
109,232 KB
testcase_25 AC 1,960 ms
109,028 KB
testcase_26 AC 1,979 ms
109,620 KB
testcase_27 AC 2,347 ms
109,096 KB
testcase_28 AC 2,009 ms
109,360 KB
testcase_29 AC 1,997 ms
109,616 KB
testcase_30 AC 1,978 ms
108,972 KB
testcase_31 AC 1,961 ms
109,108 KB
testcase_32 AC 1,960 ms
109,104 KB
testcase_33 AC 1,970 ms
109,732 KB
testcase_34 AC 43 ms
61,360 KB
testcase_35 AC 43 ms
61,140 KB
testcase_36 AC 1,799 ms
100,196 KB
testcase_37 AC 43 ms
60,284 KB
testcase_38 AC 2,243 ms
100,056 KB
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

AA = [1 for i in range(2*10**5 + 1)]
BB = [0 for i in range(2*10**5 + 1)]

N = int(input())
P = []
for _ in range(N):
  a,b = map(int,input().split())
  P.append((a*b,a,b))
P.sort()
ans = 0
for c,a,b in P:
  D = make_divisors(a)
  for d in D:
    res = d * BB[d] // a
    ans = max(ans,res)
    if BB[d] * a < AA[d] * b:
      AA[d],BB[d] = a,b
print(ans)
0