結果
問題 | No.376 立方体のN等分 (2) |
ユーザー |
![]() |
提出日時 | 2025-03-31 17:41:34 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 823 bytes |
コンパイル時間 | 183 ms |
コンパイル使用メモリ | 82,676 KB |
実行使用メモリ | 76,704 KB |
最終ジャッジ日時 | 2025-03-31 17:43:21 |
合計ジャッジ時間 | 19,187 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 TLE * 4 -- * 13 |
ソースコード
import mathdef find_min_T(N):min_sum = float('inf')max_a = int(N ** (1/3)) + 2 # Add 2 to handle floating point inaccuraciesfor a in range(1, max_a + 1):if N % a != 0:continueM = N // amax_b = int(math.isqrt(M)) # Compute sqrt(M) once# b must be >= a and <= max_b, and also a factor of Mfor b in range(a, max_b + 1):if M % b != 0:continuec = M // bif c < b:continue # Ensure a <= b <= ccurrent_sum = a + b + c - 3if current_sum < min_sum:min_sum = current_sumreturn min_sumdef main():N = int(input().strip())Tmax = N - 1Tmin = find_min_T(N)print(f"{Tmin} {Tmax}")if __name__ == "__main__":main()