結果
問題 |
No.2198 Concon Substrings (COuNt-CONstruct Version)
|
ユーザー |
![]() |
提出日時 | 2025-04-16 00:31:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,118 bytes |
コンパイル時間 | 147 ms |
コンパイル使用メモリ | 81,556 KB |
実行使用メモリ | 59,536 KB |
最終ジャッジ日時 | 2025-04-16 00:33:01 |
合計ジャッジ時間 | 13,407 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 52 WA * 52 |
ソースコード
def find_concon(M): if M == 0: return "kudamakitsukasa" # Check if M is a tetrahedral number target = 6 * M low = 1 high = 2 * 10**6 # Sufficiently large upper bound k = -1 while low <= high: mid = (low + high) // 2 product = mid * (mid + 1) * (mid + 2) if product == target: k = mid break elif product < target: low = mid + 1 else: high = mid - 1 if k != -1: return "con" * k # If not, use the product approach max_a = min(10**4, M) for a in range(max_a, 0, -1): if M % a != 0: continue remaining = M // a max_b = min(10**4, remaining) for b in range(max_b, 0, -1): if remaining % b != 0: continue c = remaining // b if a + b + c <= 60000: return "c" * a + "o" * b + "n" * c # If all else fails (as per problem statement, this won't happen) return "c" # This line is theoretically unreachable M = int(input()) print(find_concon(M))