結果
問題 | No.1571 All Your Cycles Are Same Lengths |
ユーザー | 👑 SPD_9X2 |
提出日時 | 2021-06-27 16:12:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,159 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 87,156 KB |
実行使用メモリ | 76,788 KB |
最終ジャッジ日時 | 2023-09-07 18:02:23 |
合計ジャッジ時間 | 3,422 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
71,204 KB |
testcase_01 | WA | - |
testcase_02 | AC | 83 ms
75,452 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
ソースコード
""" https://yukicoder.me/problems/no/1571 """ from sys import stdin import sys Q = 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 == 3: ans = [(1,2,T),(2,3,0),(1,3,0)] print ("Yes") for i in ans: print (*i) elif T >= N: ans = [] rem = T - N if rem % 2 == 1: print ("No") sys.exit() for 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")