結果

問題 No.1523 +/- Tree
ユーザー KudeKude
提出日時 2021-05-28 21:47:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 68,608 KB
最終ジャッジ日時 2024-04-25 01:18:20
合計ジャッジ時間 4,864 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 42 ms
51,840 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 41 ms
51,968 KB
testcase_04 AC 41 ms
51,840 KB
testcase_05 AC 42 ms
51,840 KB
testcase_06 AC 41 ms
51,840 KB
testcase_07 AC 41 ms
51,840 KB
testcase_08 AC 40 ms
52,096 KB
testcase_09 AC 41 ms
52,096 KB
testcase_10 AC 40 ms
51,968 KB
testcase_11 AC 40 ms
51,712 KB
testcase_12 AC 70 ms
67,840 KB
testcase_13 AC 71 ms
68,480 KB
testcase_14 AC 66 ms
66,688 KB
testcase_15 AC 48 ms
58,368 KB
testcase_16 AC 65 ms
65,920 KB
testcase_17 AC 41 ms
52,096 KB
testcase_18 AC 71 ms
68,480 KB
testcase_19 AC 41 ms
51,968 KB
testcase_20 AC 41 ms
51,840 KB
testcase_21 AC 40 ms
51,840 KB
testcase_22 AC 41 ms
51,840 KB
testcase_23 AC 42 ms
52,096 KB
testcase_24 AC 42 ms
52,096 KB
testcase_25 AC 65 ms
66,688 KB
testcase_26 AC 59 ms
62,976 KB
testcase_27 AC 66 ms
66,176 KB
testcase_28 AC 65 ms
66,560 KB
testcase_29 AC 52 ms
60,800 KB
testcase_30 AC 57 ms
61,440 KB
testcase_31 AC 66 ms
66,048 KB
testcase_32 AC 41 ms
52,096 KB
testcase_33 AC 66 ms
66,944 KB
testcase_34 AC 60 ms
63,232 KB
testcase_35 AC 65 ms
65,920 KB
testcase_36 AC 57 ms
62,976 KB
testcase_37 AC 59 ms
63,488 KB
testcase_38 AC 49 ms
58,496 KB
testcase_39 AC 60 ms
64,000 KB
testcase_40 AC 72 ms
68,608 KB
testcase_41 AC 65 ms
65,664 KB
testcase_42 AC 41 ms
51,584 KB
testcase_43 AC 66 ms
66,944 KB
testcase_44 AC 65 ms
66,816 KB
testcase_45 AC 40 ms
51,968 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