結果
| 問題 |
No.1315 渦巻洞穴
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-12-12 23:21:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,178 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 82,472 KB |
| 実行使用メモリ | 96,724 KB |
| 最終ジャッジ日時 | 2024-09-19 22:32:45 |
| 合計ジャッジ時間 | 7,947 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 62 RE * 17 |
ソースコード
s, t = map(int, input().split())
def f(n):
if n % 2 == 1:
if n == 1:
return []
ans = []
k = 0
while (2 * (k + 1) + 1) ** 2 < n:
k += 1
if (2 * k - 1) ** 2 + 1 <= n < 2 * (k - 1) ** 2 + 2 * k:
for _ in range(k - 1):
ans.append(3)
ans.append(0)
ans.append(0)
ans.append(1)
now = (2 * k - 1) ** 2 + 2
for _ in range(now, n, 2):
ans.append(1)
ans.append(1)
elif (2 * k - 1) ** 2 + 2 * k <= n < (2 * k - 1) ** 2 + 4 * k:
for _ in range(k):
ans.append(0)
ans.append(1)
now = (2 * k - 1) ** 2 + 2 * k
for _ in range(now, n, 2):
ans.append(2)
ans.append(2)
elif (2 * k - 1) ** 2 + 4 * k <= n < (2 * k - 1) ** 2 + 6 * k:
for _ in range(k):
ans.append(1)
ans.append(2)
now = (2 * k - 1) ** 2 + 4 * k
for _ in range(now, n, 2):
ans.append(3)
ans.append(3)
else:
for _ in range(k):
ans.append(2)
ans.append(3)
now = (2 * k - 1) ** 2 + 6 * k
for _ in range(now, n, 2):
ans.append(0)
ans.append(0)
return ans
else:
ans = []
k = 0
while (2 * (k + 1) + 1) ** 2 < n:
k += 1
k += 1
if (2 * k - 1) ** 2 + 6 * k >= n:
for _ in range(1, k + 1):
ans.append(3)
ans.append(0)
now = (2 * k + 1) ** 2 + 1
for _ in range(now, n, -1):
ans.append(2)
return ans
ans.append(3)
ans.append(3)
if (2 * k - 1) ** 2 + 4 * k >= n:
for _ in range(1, k):
ans.append(2)
ans.append(3)
ans.append(2)
now = (2 * k - 1) ** 2 + 6 * k
for _ in range(now, n, -1):
ans.append(1)
return ans
ans.append(2)
ans.append(2)
if (2 * k - 1) ** 2 + 2 * k >= n:
for _ in range(1, k):
ans.append(1)
ans.append(2)
ans.append(1)
now = (2 * k - 1) ** 2 + 4 * k
for _ in range(now, n, -1):
ans.append(0)
return ans
ans.append(1)
ans.append(1)
for _ in range(1, k):
ans.append(0)
ans.append(1)
ans.append(0)
now = (2 * k - 1) ** 2 + 2 * k
for _ in range(now, n, -1):
ans.append(3)
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