結果

問題 No.1571 All Your Cycles Are Same Lengths
ユーザー KudeKude
提出日時 2021-06-27 14:00:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 76,824 KB
最終ジャッジ日時 2023-09-07 17:43:13
合計ジャッジ時間 2,326 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,404 KB
testcase_01 AC 79 ms
71,004 KB
testcase_02 AC 87 ms
75,524 KB
testcase_03 AC 82 ms
75,296 KB
testcase_04 AC 92 ms
76,176 KB
testcase_05 AC 89 ms
76,600 KB
testcase_06 AC 105 ms
76,600 KB
testcase_07 AC 99 ms
76,824 KB
testcase_08 AC 104 ms
76,416 KB
testcase_09 AC 102 ms
76,400 KB
testcase_10 AC 98 ms
76,524 KB
権限があれば一括ダウンロードができます

ソースコード

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 - 2:
        print('Yes')
        r = (t - (n - 2)) // 2
        for j in range(2, n + 1):
            print(1, j, r)
        for i in range(2, n + 1):
            for j in range(i + 1, n + 1):
                print(i, j, 1)
    else:
        print('No')
0