結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,620 KB
testcase_01 WA -
testcase_02 AC 81 ms
75,404 KB
testcase_03 AC 77 ms
75,836 KB
testcase_04 WA -
testcase_05 AC 84 ms
76,668 KB
testcase_06 WA -
testcase_07 AC 89 ms
76,780 KB
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