結果

問題 No.1315 渦巻洞穴
ユーザー KudeKude
提出日時 2020-12-12 21:55:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,641 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 81,812 KB
実行使用メモリ 98,480 KB
最終ジャッジ日時 2023-10-20 02:40:31
合計ジャッジ時間 8,423 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,660 KB
testcase_01 WA -
testcase_02 AC 39 ms
53,660 KB
testcase_03 AC 38 ms
53,660 KB
testcase_04 AC 37 ms
53,660 KB
testcase_05 AC 37 ms
53,660 KB
testcase_06 WA -
testcase_07 AC 38 ms
53,660 KB
testcase_08 AC 38 ms
53,660 KB
testcase_09 AC 38 ms
53,660 KB
testcase_10 WA -
testcase_11 AC 38 ms
53,660 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 64 ms
80,888 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 60 ms
78,088 KB
testcase_19 AC 64 ms
83,572 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 53 ms
73,704 KB
testcase_23 AC 63 ms
84,876 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 64 ms
85,496 KB
testcase_27 AC 62 ms
85,832 KB
testcase_28 AC 60 ms
81,104 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 65 ms
84,800 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 65 ms
84,568 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 63 ms
84,772 KB
testcase_41 AC 61 ms
80,420 KB
testcase_42 WA -
testcase_43 AC 60 ms
80,420 KB
testcase_44 AC 63 ms
80,416 KB
testcase_45 WA -
testcase_46 AC 61 ms
80,416 KB
testcase_47 AC 59 ms
79,428 KB
testcase_48 WA -
testcase_49 AC 61 ms
80,420 KB
testcase_50 AC 67 ms
87,892 KB
testcase_51 WA -
testcase_52 AC 67 ms
87,888 KB
testcase_53 AC 61 ms
79,476 KB
testcase_54 WA -
testcase_55 AC 62 ms
79,476 KB
testcase_56 AC 69 ms
87,888 KB
testcase_57 WA -
testcase_58 AC 68 ms
88,880 KB
testcase_59 AC 45 ms
63,612 KB
testcase_60 AC 60 ms
79,796 KB
testcase_61 AC 55 ms
75,468 KB
testcase_62 WA -
testcase_63 AC 47 ms
66,052 KB
testcase_64 AC 63 ms
80,792 KB
testcase_65 AC 56 ms
75,468 KB
testcase_66 WA -
testcase_67 AC 44 ms
63,592 KB
testcase_68 AC 52 ms
70,872 KB
testcase_69 AC 55 ms
75,468 KB
testcase_70 WA -
testcase_71 AC 47 ms
66,052 KB
testcase_72 AC 51 ms
70,872 KB
testcase_73 AC 57 ms
76,232 KB
testcase_74 AC 52 ms
70,936 KB
testcase_75 WA -
testcase_76 WA -
testcase_77 AC 56 ms
75,060 KB
testcase_78 AC 48 ms
66,884 KB
testcase_79 AC 53 ms
74,180 KB
testcase_80 AC 56 ms
75,000 KB
testcase_81 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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
        ans.append(1)
        ans.append(2)
        now += 2
        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
        ans.append(2)
        ans.append(3)
        now += 2
        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
        ans.append(3)
        ans.append(0)
        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))
print(''.join('RULD'[a] for a in ans))
0