結果
| 問題 |
No.2198 Concon Substrings (COuNt-CONstruct Version)
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:32:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,137 bytes |
| コンパイル時間 | 268 ms |
| コンパイル使用メモリ | 81,968 KB |
| 実行使用メモリ | 847,660 KB |
| 最終ジャッジ日時 | 2025-04-16 00:34:31 |
| 合計ジャッジ時間 | 8,283 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 47 WA * 6 MLE * 1 -- * 50 |
ソースコード
import math
def solve():
M = int(input().strip())
if M == 0:
print("kudamakitsukasa")
return
# Check if M is a tetrahedral number
target = 6 * M
low = 1
high = 2 * 10**6 # Sufficiently large upper bound
tetra_k = None
while low <= high:
mid = (low + high) // 2
product = mid * (mid + 1) * (mid + 2)
if product == target:
tetra_k = mid
break
elif product < target:
low = mid + 1
else:
high = mid - 1
if tetra_k is not None:
print("con" * tetra_k)
return
# Three factors approach
max_a = int(math.pow(M, 1/3)) + 1
a = 1
for candidate in range(max_a, 0, -1):
if M % candidate == 0:
a = candidate
break
d = M // a
sqrt_d = int(math.isqrt(d))
b = 1
for candidate_b in range(sqrt_d, 0, -1):
if d % candidate_b == 0:
b = candidate_b
break
c = d // b
# Ensure the total length does not exceed 60000 (problem guarantees existence)
print('c' * a + 'o' * b + 'n' * c)
solve()
lam6er