結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-09 17:29:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 480 bytes |
| コンパイル時間 | 362 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 831,668 KB |
| 最終ジャッジ日時 | 2024-12-17 20:19:47 |
| 合計ジャッジ時間 | 72,412 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 |
| other | AC * 1 WA * 1 TLE * 1 MLE * 32 |
ソースコード
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)