結果

問題 No.2324 Two Countries within UEC
ユーザー RYOH2718RYOH2718
提出日時 2023-05-28 14:47:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 79,324 KB
最終ジャッジ日時 2023-08-27 10:36:59
合計ジャッジ時間 11,842 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 361 ms
78,848 KB
testcase_01 AC 386 ms
78,796 KB
testcase_02 AC 156 ms
78,684 KB
testcase_03 AC 308 ms
78,948 KB
testcase_04 AC 332 ms
78,984 KB
testcase_05 AC 155 ms
78,600 KB
testcase_06 AC 199 ms
78,864 KB
testcase_07 AC 147 ms
78,328 KB
testcase_08 AC 299 ms
78,760 KB
testcase_09 AC 303 ms
78,844 KB
testcase_10 AC 386 ms
78,924 KB
testcase_11 AC 363 ms
78,552 KB
testcase_12 AC 185 ms
78,764 KB
testcase_13 AC 188 ms
78,992 KB
testcase_14 AC 154 ms
78,348 KB
testcase_15 AC 146 ms
78,608 KB
testcase_16 AC 311 ms
78,984 KB
testcase_17 AC 237 ms
78,812 KB
testcase_18 AC 151 ms
78,460 KB
testcase_19 AC 374 ms
78,604 KB
testcase_20 AC 137 ms
78,768 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 403 ms
78,976 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 65 ms
71,456 KB
testcase_32 AC 66 ms
71,360 KB
testcase_33 AC 66 ms
71,436 KB
testcase_34 AC 68 ms
71,620 KB
testcase_35 AC 66 ms
71,264 KB
testcase_36 AC 67 ms
71,296 KB
testcase_37 WA -
testcase_38 AC 66 ms
71,532 KB
testcase_39 AC 66 ms
71,424 KB
testcase_40 AC 67 ms
71,324 KB
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def INT():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(map(int, input().split()))


N, M, P, Q = MI()
for i in range(Q):
    x, f = MI()
    a = P + f
    x_inv = pow(x, P - 2, P)
    y_min = (a * x_inv) % P
    if y_min == 0:
        y_min += P

    ans = 0
    if M > y_min:
        ans = (M - y_min) // P + int((M - y_min) % P != 0)
    if M == y_min:
        ans += 1

    print(ans)
0