結果

問題 No.1880 Many Ways
ユーザー tamatotamato
提出日時 2022-03-18 22:42:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 930 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 54,676 KB
最終ジャッジ日時 2024-04-14 10:44:59
合計ジャッジ時間 22,924 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,676 KB
testcase_01 AC 38 ms
53,532 KB
testcase_02 WA -
testcase_03 AC 37 ms
52,828 KB
testcase_04 AC 37 ms
53,352 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 39 ms
53,120 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 38 ms
53,192 KB
testcase_13 AC 38 ms
53,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    A = int(input())
    if A == 0:
        print(2, 0)
        exit()

    L = 40
    N = 122
    K = 83
    adj = [[] for _ in range(N + 1)]
    adj[1].append(2)
    adj[1].append(3)
    adj[1].append(83)
    for l in range(L - 1):
        adj[l * 2 + 2].append(l * 2 + 4)
        adj[l * 2 + 2].append(l * 2 + 5)
        adj[l * 2 + 3].append(l * 2 + 4)
        adj[l * 2 + 3].append(l * 2 + 5)
        adj[K + l].append(K + l + 1)
    adj[N].append(K - 1)
    A -= 1
    for lv in range(1, L):
        if A >> lv & 1:
            v = lv * 2 + 2
            u = K + lv + 1
            if u > N:
                u = K - 1
            adj[v].append(u)
    M = 0
    for v in range(1, N + 1):
        M += len(adj[v])
    print(N, M)
    for v in range(1, N + 1):
        for u in adj[v]:
            print(v, u)


if __name__ == '__main__':
    main()
0