結果
| 問題 | No.420 mod2漸化式 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-09 17:29:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 480 bytes |
| 記録 | |
| コンパイル時間 | 207 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 702,920 KB |
| 最終ジャッジ日時 | 2026-05-26 23:33:18 |
| 合計ジャッジ時間 | 5,154 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 |
| other | -- * 35 |
ソースコード
from collections import deque
x = int(input())
if x == 0:
print(1, 0)
exit()
limit = 2**31 - 1
Que = deque([2 * (x - 1) + 1, 2 * x])
seen = set([2 * (x - 1) + 1, 2 * x])
ANS = [0, 0]
while Que:
cp = Que.popleft()
ANS[0] += 1
ANS[1] += cp
np = 2 * (cp - 1) + 1
if np not in seen and np <= limit:
seen.add(np)
Que.append(np)
np = 2 * cp
if np not in seen and np <= limit:
seen.add(np)
Que.append(np)
print(*ANS)