結果

問題 No.689 E869120 and Constructing Array 3
ユーザー i_takui_taku
提出日時 2023-09-29 12:02:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 1,000 ms
コード長 370 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 76,236 KB
最終ジャッジ日時 2023-09-29 12:02:37
合計ジャッジ時間 3,466 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,148 KB
testcase_01 AC 69 ms
71,112 KB
testcase_02 AC 75 ms
75,568 KB
testcase_03 AC 73 ms
75,932 KB
testcase_04 AC 74 ms
75,948 KB
testcase_05 AC 76 ms
75,744 KB
testcase_06 AC 77 ms
76,040 KB
testcase_07 AC 79 ms
76,148 KB
testcase_08 AC 78 ms
76,148 KB
testcase_09 AC 76 ms
76,208 KB
testcase_10 AC 77 ms
76,236 KB
testcase_11 AC 79 ms
76,220 KB
testcase_12 AC 76 ms
75,960 KB
testcase_13 AC 69 ms
71,400 KB
testcase_14 AC 69 ms
71,056 KB
testcase_15 AC 69 ms
71,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())
for N in range(1, 251):
    for cnt_1 in range(N + 1):
        for cnt_2 in range(N + 1 - cnt_1):
            cnt_3 = N - (cnt_1 + cnt_2)
            if cnt_1 * (cnt_1 - 1) // 2 + cnt_1 * cnt_2 + cnt_2 * cnt_3 == K:
                ans = [1] * cnt_1 + [2] * cnt_2 + [3] * cnt_3
                print(N)
                print(*ans)
                exit()
0