結果

問題 No.1571 All Your Cycles Are Same Lengths
ユーザー tamatotamato
提出日時 2021-08-06 08:42:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,273 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2023-10-15 03:49:36
合計ジャッジ時間 4,136 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,712 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    for _ in range(int(input())):
        N, T = map(int, input().split())
        if T & 2 == 0:
            print("Yes")
            for i in range(1, N+1):
                for j in range(i+1, N+1):
                    if i == 1:
                        print(i, j, T // 2)
                    else:
                        print(i, j, 0)
        else:
            if N <= 3:
                print("Yes")
                for i in range(1, N+1):
                    for j in range(i+1, N+1):
                        if i == 1 and j == 2:
                            print(i, j, T)
                        else:
                            print(i, j, 0)
            elif N & 1:
                if T >= N:
                    T -= N
                    print("Yes")
                    for i in range(1, N + 1):
                        for j in range(i + 1, N + 1):
                            if i == 1:
                                print(i, j, T // 2 + 1)
                            else:
                                print(i, j, 1)
                else:
                    print("No")
            else:
                print("No")


if __name__ == '__main__':
    main()
0