結果

問題 No.2324 Two Countries within UEC
ユーザー RYOH2718RYOH2718
提出日時 2023-05-28 15:32:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 79,132 KB
最終ジャッジ日時 2023-08-27 12:22:26
合計ジャッジ時間 13,090 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 376 ms
78,656 KB
testcase_01 AC 403 ms
79,068 KB
testcase_02 AC 166 ms
78,736 KB
testcase_03 AC 325 ms
78,844 KB
testcase_04 AC 347 ms
78,524 KB
testcase_05 AC 165 ms
78,744 KB
testcase_06 AC 208 ms
78,848 KB
testcase_07 AC 157 ms
78,808 KB
testcase_08 AC 313 ms
78,656 KB
testcase_09 AC 315 ms
78,768 KB
testcase_10 AC 395 ms
78,856 KB
testcase_11 AC 381 ms
78,700 KB
testcase_12 AC 195 ms
78,804 KB
testcase_13 AC 194 ms
78,920 KB
testcase_14 AC 162 ms
78,568 KB
testcase_15 AC 154 ms
78,580 KB
testcase_16 AC 302 ms
78,972 KB
testcase_17 AC 238 ms
79,016 KB
testcase_18 AC 163 ms
78,496 KB
testcase_19 AC 394 ms
79,028 KB
testcase_20 AC 146 ms
78,552 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 417 ms
79,080 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 69 ms
71,456 KB
testcase_32 AC 70 ms
71,576 KB
testcase_33 AC 69 ms
71,584 KB
testcase_34 AC 69 ms
71,548 KB
testcase_35 AC 71 ms
71,640 KB
testcase_36 AC 70 ms
71,580 KB
testcase_37 AC 68 ms
71,244 KB
testcase_38 AC 70 ms
71,324 KB
testcase_39 AC 70 ms
71,252 KB
testcase_40 AC 73 ms
71,352 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()))


import math

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

    if y_min == 0:
        y_min += P

    if M < y_min:
        print(0)
    else:
        print(math.ceil((M - y_min + 1) / P))
0