結果

問題 No.1880 Many Ways
ユーザー chineristACchineristAC
提出日時 2022-03-18 22:39:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 58,444 KB
最終ジャッジ日時 2024-04-14 10:37:40
合計ジャッジ時間 15,041 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,916 KB
testcase_01 AC 47 ms
57,452 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

A = int(input())

if A==0:
    print(2,0)
    exit()
if A==1:
    print(2,1)
    print(1,2)
    exit()

n = A.bit_length()-1

E = []
for i in range(1,n):
    E.append((2*i-1,2*i+1))
    E.append((2*i-1,2*i+2))
    E.append((2*i,2*i+1))
    E.append((2*i,2*i+2))

for i in range(2*n+1,3*n):
    E.append((i,i+1))

E.append((3*n+1,1))
E.append((3*n+1,2))
E.append((3*n+1,2*n+1))
E.append((2*n-1,3*n+2))
E.append((2*n,3*n+2))

for i in range(2*n+1,3*n+1):
    p = 3*n - i
    if A>>p & 1:
        if p==0:
            E.append((i,3*n+2))
        else:
            k = i-2*n
            E.append((i,2*k+1))
            E.append((i,2*k+2))

print(3*n+2,len(E))
for u,v in E:
    print(u,v)




0