結果

問題 No.2324 Two Countries within UEC
ユーザー googol_S0googol_S0
提出日時 2023-05-28 13:37:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 79,312 KB
最終ジャッジ日時 2023-09-09 06:02:36
合計ジャッジ時間 12,747 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 382 ms
78,704 KB
testcase_01 AC 403 ms
78,636 KB
testcase_02 AC 159 ms
78,236 KB
testcase_03 AC 322 ms
78,896 KB
testcase_04 AC 346 ms
78,664 KB
testcase_05 AC 163 ms
78,356 KB
testcase_06 AC 209 ms
78,760 KB
testcase_07 AC 152 ms
78,340 KB
testcase_08 AC 319 ms
78,716 KB
testcase_09 AC 320 ms
78,904 KB
testcase_10 AC 400 ms
78,528 KB
testcase_11 AC 392 ms
78,572 KB
testcase_12 AC 195 ms
78,944 KB
testcase_13 AC 196 ms
78,836 KB
testcase_14 AC 160 ms
78,128 KB
testcase_15 AC 152 ms
78,448 KB
testcase_16 AC 302 ms
78,960 KB
testcase_17 AC 238 ms
78,648 KB
testcase_18 AC 162 ms
78,484 KB
testcase_19 AC 393 ms
78,932 KB
testcase_20 AC 144 ms
78,576 KB
testcase_21 AC 300 ms
78,772 KB
testcase_22 AC 350 ms
78,384 KB
testcase_23 AC 182 ms
78,744 KB
testcase_24 AC 309 ms
79,312 KB
testcase_25 AC 392 ms
78,744 KB
testcase_26 AC 314 ms
77,564 KB
testcase_27 AC 317 ms
77,404 KB
testcase_28 AC 312 ms
77,624 KB
testcase_29 AC 307 ms
77,344 KB
testcase_30 AC 315 ms
77,388 KB
testcase_31 AC 69 ms
71,364 KB
testcase_32 AC 69 ms
71,612 KB
testcase_33 AC 69 ms
71,412 KB
testcase_34 AC 70 ms
71,368 KB
testcase_35 AC 69 ms
71,628 KB
testcase_36 AC 70 ms
71,308 KB
testcase_37 AC 69 ms
71,512 KB
testcase_38 AC 69 ms
71,288 KB
testcase_39 AC 69 ms
71,364 KB
testcase_40 AC 69 ms
71,608 KB
testcase_41 AC 70 ms
71,616 KB
testcase_42 AC 70 ms
71,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,P,Q=map(int,input().split())
for i in range(Q):
    x,f=map(int,input().split())
    x%=P
    if f==0:
        if x==0:
            print(M)
        else:
            print(M//P)
    else:
        if x==0:
            print(0)
            continue
        v=pow(x,P-2,P)*f%P
        print((M+P-v)//P)
0