結果

問題 No.1523 +/- Tree
ユーザー nrktnrkt
提出日時 2021-05-31 21:29:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,405 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 73,664 KB
最終ジャッジ日時 2024-04-26 09:37:35
合計ジャッジ時間 6,359 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,152 KB
testcase_01 AC 42 ms
55,308 KB
testcase_02 WA -
testcase_03 AC 41 ms
54,528 KB
testcase_04 AC 41 ms
55,684 KB
testcase_05 AC 42 ms
55,600 KB
testcase_06 AC 42 ms
55,180 KB
testcase_07 AC 46 ms
56,032 KB
testcase_08 AC 40 ms
54,596 KB
testcase_09 AC 42 ms
54,724 KB
testcase_10 AC 41 ms
55,328 KB
testcase_11 AC 42 ms
55,896 KB
testcase_12 AC 70 ms
73,176 KB
testcase_13 AC 74 ms
73,664 KB
testcase_14 AC 65 ms
70,908 KB
testcase_15 AC 47 ms
62,928 KB
testcase_16 AC 65 ms
70,280 KB
testcase_17 AC 41 ms
55,696 KB
testcase_18 AC 76 ms
73,556 KB
testcase_19 AC 41 ms
56,520 KB
testcase_20 AC 41 ms
55,608 KB
testcase_21 AC 42 ms
55,268 KB
testcase_22 AC 41 ms
55,624 KB
testcase_23 AC 42 ms
55,196 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 41 ms
55,588 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 43 ms
55,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
 
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, k = LI()
if k == 1 or k == n - 1:
    print("No")
else:
    if k == 2:
        if (n - 1) % k == 0:
            print("No")
        else:
            a = (n - 1) // k
            b = a + 1
            for x in range(2*n+1):
                for y in range(x+1, 2*n+1):
                    if -a*y + b*x > 0:
                        break
                else:
                    continue
                break
            print("Yes")
            for i in range(1, n):
                if i % k == 0:
                    print(i, i+1, -y)
                elif i % k == 1:
                    print(i, i+1, x)
                else:
                    print(i, i+1, 0)
    else:
        print("Yes")
        for i in range(k-1):
            print(i+1, i+2, 1)
        print(k, k+1, -k)
        for i in range(k+1, n):
            print(k+1, i+1, k-2)
        


0