結果

問題 No.2597 Yet Another Topological Problem
ユーザー KudeKude
提出日時 2023-12-25 08:45:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 736 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,468 KB
最終ジャッジ日時 2023-12-25 08:45:39
合計ジャッジ時間 5,260 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 49 ms
64,032 KB
testcase_02 AC 35 ms
53,332 KB
testcase_03 AC 35 ms
53,332 KB
testcase_04 AC 36 ms
53,332 KB
testcase_05 AC 38 ms
53,332 KB
testcase_06 AC 35 ms
53,332 KB
testcase_07 AC 42 ms
58,940 KB
testcase_08 AC 38 ms
53,332 KB
testcase_09 AC 38 ms
53,332 KB
testcase_10 AC 46 ms
53,332 KB
testcase_11 AC 38 ms
53,332 KB
testcase_12 AC 37 ms
53,332 KB
testcase_13 AC 44 ms
61,700 KB
testcase_14 AC 42 ms
58,940 KB
testcase_15 AC 35 ms
53,332 KB
testcase_16 AC 40 ms
58,940 KB
testcase_17 AC 41 ms
58,940 KB
testcase_18 AC 36 ms
53,332 KB
testcase_19 AC 42 ms
58,940 KB
testcase_20 AC 41 ms
58,940 KB
testcase_21 AC 37 ms
53,332 KB
testcase_22 AC 38 ms
53,332 KB
testcase_23 AC 166 ms
77,468 KB
testcase_24 AC 38 ms
53,332 KB
testcase_25 AC 35 ms
53,332 KB
testcase_26 AC 35 ms
53,332 KB
testcase_27 AC 34 ms
53,332 KB
testcase_28 AC 34 ms
53,332 KB
testcase_29 AC 34 ms
53,332 KB
testcase_30 AC 35 ms
53,332 KB
testcase_31 AC 34 ms
53,332 KB
testcase_32 AC 35 ms
53,332 KB
testcase_33 AC 34 ms
53,332 KB
testcase_34 AC 35 ms
53,332 KB
testcase_35 AC 36 ms
53,332 KB
testcase_36 AC 36 ms
53,332 KB
testcase_37 AC 35 ms
53,332 KB
testcase_38 AC 34 ms
53,332 KB
testcase_39 AC 34 ms
53,332 KB
testcase_40 AC 34 ms
53,328 KB
testcase_41 AC 34 ms
53,332 KB
testcase_42 AC 34 ms
53,332 KB
testcase_43 AC 34 ms
53,332 KB
testcase_44 AC 34 ms
53,332 KB
testcase_45 AC 34 ms
53,332 KB
testcase_46 AC 35 ms
53,332 KB
testcase_47 AC 35 ms
53,332 KB
testcase_48 AC 34 ms
53,332 KB
testcase_49 AC 35 ms
53,332 KB
testcase_50 AC 35 ms
53,332 KB
testcase_51 AC 37 ms
53,332 KB
testcase_52 AC 37 ms
53,332 KB
testcase_53 AC 35 ms
53,332 KB
testcase_54 AC 36 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p, q = map(int, input().split())
if p == 1:
    print('Impossible')
    exit()
print('Possible')
K = q // p
r = q % p
L = max((K * p + r - 1) // r, ((K + 1) * p + p - r - 1) // (p - r))
L = (L + p - 1) // p * p
ln = 2 * K * (K + 1) + L * K + L // p * r
print(ln)
for i in range(K + 1):
    x = i * L
    for dx in range(i):
        print(x + dx, i)
    for y in range(i, -(K - i), -1):
        print(x + i, y)
    if i < K:
        for dx in range(i, L - (i + 1)):
            print(x + dx, -(K - i))
        for y in range(-(K - i), i + 1):
            print(x + L - (i + 1), y)
        for dx in range(L - (i + 1), L):
            print(x + dx, i + 1)
    else:
        for dx in range(i, L * r // p + 1):
            print(x + dx, 0)
0