結果

問題 No.1523 +/- Tree
ユーザー KudeKude
提出日時 2021-05-28 21:47:26
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 76,828 KB
最終ジャッジ日時 2023-08-07 07:12:30
合計ジャッジ時間 6,683 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,276 KB
testcase_01 AC 71 ms
71,504 KB
testcase_02 AC 70 ms
71,176 KB
testcase_03 AC 74 ms
71,112 KB
testcase_04 AC 70 ms
71,536 KB
testcase_05 AC 69 ms
71,108 KB
testcase_06 AC 72 ms
71,152 KB
testcase_07 AC 71 ms
71,268 KB
testcase_08 AC 71 ms
71,052 KB
testcase_09 AC 70 ms
71,168 KB
testcase_10 AC 71 ms
71,460 KB
testcase_11 AC 71 ms
71,536 KB
testcase_12 AC 92 ms
76,784 KB
testcase_13 AC 93 ms
76,552 KB
testcase_14 AC 90 ms
76,728 KB
testcase_15 AC 76 ms
75,208 KB
testcase_16 AC 88 ms
76,820 KB
testcase_17 AC 70 ms
71,172 KB
testcase_18 AC 92 ms
76,736 KB
testcase_19 AC 70 ms
71,196 KB
testcase_20 AC 71 ms
71,532 KB
testcase_21 AC 71 ms
71,572 KB
testcase_22 AC 71 ms
71,232 KB
testcase_23 AC 70 ms
71,280 KB
testcase_24 AC 71 ms
71,156 KB
testcase_25 AC 88 ms
76,828 KB
testcase_26 AC 84 ms
76,580 KB
testcase_27 AC 88 ms
76,692 KB
testcase_28 AC 90 ms
76,364 KB
testcase_29 AC 80 ms
76,448 KB
testcase_30 AC 80 ms
76,416 KB
testcase_31 AC 87 ms
76,364 KB
testcase_32 AC 69 ms
71,228 KB
testcase_33 AC 88 ms
76,572 KB
testcase_34 AC 84 ms
76,336 KB
testcase_35 AC 89 ms
76,672 KB
testcase_36 AC 84 ms
76,660 KB
testcase_37 AC 84 ms
76,360 KB
testcase_38 AC 77 ms
75,204 KB
testcase_39 AC 87 ms
76,592 KB
testcase_40 AC 93 ms
76,708 KB
testcase_41 AC 88 ms
76,684 KB
testcase_42 AC 71 ms
71,168 KB
testcase_43 AC 88 ms
76,360 KB
testcase_44 AC 89 ms
76,824 KB
testcase_45 AC 72 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
if k == 1:
    print('No')
elif k == 2:
    if n % 2 == 1:
        print('No')
    else:
        print('Yes')
        for i in range(n - 1):
            j = i + 1
            w = 10 ** 8 if i % 2 == 0 else -10 ** 8 - 1
            print(i + 1, j + 1, w)
elif k == 3:
    if k == n - 1:
        print('No')
    else:
        print('Yes')
        print(1, 2, -2)
        print(2, 3, -2)
        for i in range(4, n + 1):
            print(3, i, 3)
else:
    if k == n - 1:
        print('No')
    else:
        print('Yes')
        for i in range(k):
            j = i + 1
            print(i + 1, j + 1, -1)
        mid = k // 2
        for i in range(k + 1, n):
            print(mid + 1, i + 1, 10 ** 8)
0