結果
問題 |
No.2198 Concon Substrings (COuNt-CONstruct Version)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 14:10:34 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,342 bytes |
コンパイル時間 | 459 ms |
コンパイル使用メモリ | 82,364 KB |
実行使用メモリ | 848,720 KB |
最終ジャッジ日時 | 2025-06-12 14:10:59 |
合計ジャッジ時間 | 4,433 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 MLE * 1 -- * 83 |
ソースコード
import math M = int(input()) if M == 0: print("kudamakitsukasa") else: # Check if M is a tetrahedral number low = 1 high = 2000000 # A sufficiently large upper bound found_k = -1 while low <= high: mid = (low + high) // 2 t = mid * (mid + 1) * (mid + 2) // 6 if t == M: found_k = mid break elif t < M: low = mid + 1 else: high = mid - 1 if found_k != -1: print("con" * found_k) else: # Find a, b, c such that a*b*c = M and a + b + c <= 60000 max_a = int(M ** (1/3)) + 2 found = False for a in range(max_a, 0, -1): if M % a != 0: continue quotient = M // a max_b = int(math.isqrt(quotient)) b = None for candidate_b in range(max_b, 0, -1): if quotient % candidate_b == 0: b = candidate_b break if b is None: continue c = quotient // b if a + b + c <= 60000: print('c' * a + 'o' * b + 'n' * c) found = True break if not found: # Fallback (should not happen as per problem statement) print('c' * 1 + 'o' * 1 + 'n' * M)