結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 365 ms
78,552 KB
testcase_01 AC 387 ms
78,780 KB
testcase_02 AC 156 ms
78,504 KB
testcase_03 AC 313 ms
78,812 KB
testcase_04 AC 334 ms
78,824 KB
testcase_05 AC 162 ms
78,632 KB
testcase_06 AC 196 ms
78,848 KB
testcase_07 AC 148 ms
78,536 KB
testcase_08 AC 296 ms
78,624 KB
testcase_09 AC 309 ms
78,408 KB
testcase_10 AC 382 ms
78,792 KB
testcase_11 AC 376 ms
78,720 KB
testcase_12 AC 188 ms
78,940 KB
testcase_13 AC 197 ms
78,816 KB
testcase_14 AC 168 ms
78,468 KB
testcase_15 AC 161 ms
78,476 KB
testcase_16 AC 311 ms
79,008 KB
testcase_17 AC 243 ms
78,908 KB
testcase_18 AC 160 ms
78,428 KB
testcase_19 AC 393 ms
78,848 KB
testcase_20 AC 148 ms
78,476 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 386 ms
79,032 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 66 ms
71,300 KB
testcase_32 AC 65 ms
71,476 KB
testcase_33 AC 66 ms
71,608 KB
testcase_34 AC 65 ms
71,364 KB
testcase_35 AC 65 ms
71,100 KB
testcase_36 AC 63 ms
71,544 KB
testcase_37 AC 65 ms
71,436 KB
testcase_38 AC 67 ms
71,412 KB
testcase_39 AC 66 ms
71,256 KB
testcase_40 AC 66 ms
71,392 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 + 1
    ans += int(y_min == M)
    print(ans)
0