結果
問題 | No.1571 All Your Cycles Are Same Lengths |
ユーザー |
👑 ![]() |
提出日時 | 2021-06-27 16:06:07 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,115 bytes |
コンパイル時間 | 265 ms |
コンパイル使用メモリ | 82,228 KB |
実行使用メモリ | 76,896 KB |
最終ジャッジ日時 | 2024-06-25 11:48:54 |
合計ジャッジ時間 | 2,060 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 4 RE * 1 |
ソースコード
"""https://yukicoder.me/problems/no/1571"""from sys import stdinimport sysQ = int(stdin.readline())for loop in range(Q):N,T = map(int,stdin.readline().split())if T % 2 == 0:ans = []for b in range(1,N+1):for a in range(1,b):if a == 1 or b == 1:ans.append((a,b,T//2))else:ans.append((a,b,0))print ("Yes")for i in ans:print (*i)else:if N % 2 == 0 or N == 2:print ("No")elif N == 3:ans = [(1,2,T),(2,3,0),(1,3,0)]print ("Yes")for i in ans:print (*i)elif T >= N:rem = N - Tfor b in range(1,N+1):for a in range(1,b):if a == 1 or b == 1:ans.append((a,b,rem//2 + 1))else:ans.append((a,b,1))print ("Yes")for i in ans:print (*i)else:print ("No")