結果
問題 |
No.1651 Removing Cards
|
ユーザー |
![]() |
提出日時 | 2021-08-20 23:40:44 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 502 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 191,616 KB |
最終ジャッジ日時 | 2024-10-14 07:47:03 |
合計ジャッジ時間 | 5,612 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 TLE * 1 -- * 25 |
ソースコード
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))