結果

問題 No.2597 Yet Another Topological Problem
ユーザー 👑 rin204rin204
提出日時 2023-12-25 22:09:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 98,192 KB
最終ジャッジ日時 2023-12-25 22:09:38
合計ジャッジ時間 25,657 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 171 ms
90,100 KB
testcase_02 AC 173 ms
90,124 KB
testcase_03 AC 39 ms
53,460 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 AC 170 ms
90,124 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 173 ms
90,124 KB
testcase_08 WA -
testcase_09 AC 176 ms
90,124 KB
testcase_10 AC 38 ms
53,460 KB
testcase_11 AC 171 ms
90,124 KB
testcase_12 AC 177 ms
90,124 KB
testcase_13 WA -
testcase_14 AC 173 ms
90,124 KB
testcase_15 AC 38 ms
53,460 KB
testcase_16 AC 169 ms
90,124 KB
testcase_17 AC 172 ms
90,128 KB
testcase_18 AC 37 ms
53,460 KB
testcase_19 AC 170 ms
90,128 KB
testcase_20 WA -
testcase_21 AC 174 ms
90,124 KB
testcase_22 AC 170 ms
90,124 KB
testcase_23 WA -
testcase_24 AC 37 ms
53,460 KB
testcase_25 AC 38 ms
53,460 KB
testcase_26 AC 38 ms
53,460 KB
testcase_27 AC 37 ms
53,460 KB
testcase_28 AC 38 ms
53,460 KB
testcase_29 AC 37 ms
53,460 KB
testcase_30 AC 37 ms
53,460 KB
testcase_31 AC 36 ms
53,460 KB
testcase_32 AC 37 ms
53,460 KB
testcase_33 AC 170 ms
90,124 KB
testcase_34 AC 170 ms
90,104 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 170 ms
90,124 KB
testcase_38 AC 172 ms
90,124 KB
testcase_39 AC 168 ms
90,100 KB
testcase_40 AC 173 ms
90,104 KB
testcase_41 WA -
testcase_42 AC 204 ms
90,124 KB
testcase_43 AC 170 ms
90,124 KB
testcase_44 AC 169 ms
90,104 KB
testcase_45 AC 170 ms
90,124 KB
testcase_46 AC 169 ms
90,124 KB
testcase_47 AC 172 ms
90,124 KB
testcase_48 AC 171 ms
90,124 KB
testcase_49 AC 173 ms
90,124 KB
testcase_50 AC 177 ms
90,124 KB
testcase_51 AC 170 ms
90,128 KB
testcase_52 AC 171 ms
90,124 KB
testcase_53 AC 173 ms
90,124 KB
testcase_54 AC 169 ms
90,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p, q = map(int, input().split())

if p == 1:
    print("Impossible")
    exit()

d = q // p
tot = d * (d + 1)
x = 240000 // tot
S = []
ud = "U"
rev = {"U": "D", "D": "U"}
for i in range(d, 0, -1):
    S.append(ud * i)
    S.append("R" * x * i)
    ud = rev[ud]
    S.append(ud * i)
for i in range(1, d + 1):
    S.append(ud * i)
    S.append("R" * x * i)
    ud = rev[ud]
    S.append(ud * i)

S = "".join(S)
x, y = 0, 0
XY = [(x, y)]
for s in S:
    if s == "U":
        y += 1
    elif s == "D":
        y -= 1
    elif s == "R":
        x += 1
    elif s == "L":
        x -= 1
    XY.append((x, y))


print("Possible")
print(len(XY) - 1)
for x, y in XY:
    print(x, y)
0