結果

問題 No.1571 All Your Cycles Are Same Lengths
ユーザー googol_S0googol_S0
提出日時 2021-06-27 13:08:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 76,888 KB
最終ジャッジ日時 2023-09-07 17:31:21
合計ジャッジ時間 2,580 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,484 KB
testcase_01 AC 74 ms
71,128 KB
testcase_02 AC 81 ms
75,604 KB
testcase_03 AC 83 ms
75,632 KB
testcase_04 WA -
testcase_05 AC 88 ms
76,724 KB
testcase_06 WA -
testcase_07 AC 91 ms
76,824 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
for i in range(Q):
  N,T=map(int,input().split())
  if (T&1)==0:
    print('Yes')
    for j in range(N):
      for k in range(j+1,N):
        print(j+1,k+1,(T>>1)*(1 if j==0 else 0))
    continue
  if N==3:
    print('Yes')
    print(1,2,T)
    print(2,3,0)
    print(1,3,0)
    continue
  if T%N==0:
    print('Yes')
    for j in range(N):
      for k in range(j+1,N):
        print(j+1,k+1,1)
    continue
  print('No')
0