結果
| 問題 |
No.1315 渦巻洞穴
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-12-12 22:29:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,506 bytes |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 95,360 KB |
| 最終ジャッジ日時 | 2024-09-19 22:31:24 |
| 合計ジャッジ時間 | 7,505 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 73 RE * 6 |
ソースコード
s, t = map(int, input().split())
def f(n):
if n % 2 == 1:
ans = []
k = 0
while (2 * (k + 1) + 1) ** 2 <= n:
ans.append(3)
ans.append(0)
k += 1
now = (2 * k + 1) ** 2
if now == n:
return ans
ans.append(0)
ans.append(1)
now += 2
k += 1
while now < n and now < (2 * k - 1) ** 2 + 2 * k - 1:
ans.append(1)
ans.append(1)
now += 2
if now == n:
return ans
while now < n and now < (2 * k - 1) ** 2 + 4 * k - 1:
ans.append(2)
ans.append(2)
now += 2
if now == n:
return ans
while now < n and now < (2 * k - 1) ** 2 + 6 * k - 1:
ans.append(3)
ans.append(3)
now += 2
if now == n:
return ans
while now < n:
ans.append(0)
ans.append(0)
now += 2
return ans
else:
ans = [3]
k = 1
while (2 * k - 1) ** 2 + 1 < n:
ans.append(0)
ans.append(3)
k += 1
now = (2 * k - 1) ** 2 + 1
if now == n:
return ans
k -= 1
while now > n and now > (2 * k - 1) ** 2 + 6 * k + 1:
ans.append(2)
ans.append(2)
now -= 2
if now == n:
return ans
ans.append(2)
ans.append(1)
now -= 2
while now > n and now > (2 * k - 1) ** 2 + 4 * k + 1:
ans.append(1)
ans.append(1)
now -= 2
if now == n:
return ans
ans.append(1)
ans.append(0)
now -= 2
while now > n and now > (2 * k - 1) ** 2 + 2 * k + 1:
ans.append(0)
ans.append(0)
now -= 2
if now == n:
return ans
ans.append(0)
ans.append(3)
now -= 2
while now > n:
ans.append(3)
ans.append(3)
now -= 2
return ans
ps, pt = f(s), f(t)
ones = len(ps) // 2 + len(pt) // 2 + 2
ans = [(t + 2) % 4 for t in reversed(ps)]
if s % 2 == 0:
ans.append(3)
else:
ans.append(0)
ans.append(2)
ans.append(0)
ones += 1
if ones % 2 == 1:
ans.append(1)
ans.append(3)
if t % 2 == 0:
ans.append(1)
else:
ans.append(2)
ans += pt
print(0)
print(len(ans))
assert len(ans) <= 2 * 10 ** 5
print(''.join('RULD'[a] for a in ans))
Kude