結果
問題 |
No.1651 Removing Cards
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:40:35 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 519,628 KB |
最終ジャッジ日時 | 2025-06-12 21:44:36 |
合計ジャッジ時間 | 9,173 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 MLE * 1 -- * 19 |
ソースコード
import sys sys.setrecursionlimit(1 << 25) def main(): import sys input = sys.stdin.read data = input().split() K = int(data[0]) Q = int(data[1]) queries = list(map(int, data[2:2+Q])) def compute_f(n): if n == 1: return 1 marked = (n - 1) // K + 1 m = n - marked j = compute_f(m) i = j + ((j - 1) // (K - 1)) + 1 return i for N in queries: print(compute_f(N)) if __name__ == "__main__": main()