結果

問題 No.1651 Removing Cards
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-08-20 23:40:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 502 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 192,256 KB
最終ジャッジ日時 2024-04-22 08:33:40
合計ジャッジ時間 6,045 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
57,600 KB
testcase_01 AC 46 ms
58,112 KB
testcase_02 AC 762 ms
192,256 KB
testcase_03 AC 49 ms
59,136 KB
testcase_04 AC 50 ms
60,416 KB
testcase_05 AC 60 ms
59,520 KB
testcase_06 AC 52 ms
60,416 KB
testcase_07 AC 50 ms
60,416 KB
testcase_08 AC 60 ms
61,824 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline  # 文字列入力はするな!!
from _collections import defaultdict
import sys
sys.setrecursionlimit(10**9)
k,q=map(int,input().split())
def f(k,n):
    def g(x):
        return x-(x-1)//k-1

    if n<=k:return n
    ind=f(k,n-((n-1)//k)-1)

    mi=0
    ma=5*10**18
    while ma-mi>1:
        mid=(ma+mi)//2
        if g(mid)>=ind:
            ma=mid
        else:
            mi=mid
    return ma

for _ in range(q):
    n=int(input())
    print(f(k,n))

0