結果

問題 No.2597 Yet Another Topological Problem
ユーザー rin204
提出日時 2023-12-25 21:38:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 91,224 KB
最終ジャッジ日時 2024-09-27 14:41:43
合計ジャッジ時間 21,876 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

S = ""
if 3 * p <= q:
    print("Impossible")
    exit()
elif 2 * p <= q:
    x = 40000
    S += "U"
    S += "R" * x
    S += "D" * 3
    S += "R" * 2 * x
    if 2 * p == q:
        S += "R"
    S += "U" * 4
    S += "R" * 2 * x
    S += "D" * 3
    S += "R" * x
    S += "U"
else:
    x = 120000
    S += "U"
    S += "R" * x
    S += "D" * 2
    S += "R" * x
    S += "U"

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