結果

問題 No.1571 All Your Cycles Are Same Lengths
ユーザー KudeKude
提出日時 2021-06-27 13:27:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 76,784 KB
最終ジャッジ日時 2023-09-07 17:37:01
合計ジャッジ時間 2,610 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,268 KB
testcase_01 AC 74 ms
71,428 KB
testcase_02 AC 80 ms
75,308 KB
testcase_03 AC 81 ms
75,676 KB
testcase_04 WA -
testcase_05 AC 88 ms
76,520 KB
testcase_06 WA -
testcase_07 AC 92 ms
76,628 KB
testcase_08 WA -
testcase_09 AC 95 ms
76,716 KB
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n, t = map(int, input().split())
    if t % 2 == 0:
        print('Yes')
        for j in range(2, n + 1):
            print(1, j, t // 2)
        for i in range(2, n + 1):
            for j in range(i + 1, n + 1):
                print(i, j, 0)
    elif n == 3:
        print('Yes')
        print(1, 2, 0)
        print(1, 3, 0)
        print(2, 3, t)
    elif n % 2 == 1 and t >= n:
        print('Yes')
        r = (t - n) // 2
        for j in range(2, n + 1):
            print(1, j, r + 1)
        for i in range(2, n + 1):
            for j in range(i + 1, n + 1):
                print(i, j, 1)
    else:
        print('No')
0