結果

問題 No.2324 Two Countries within UEC
ユーザー prd_xxxprd_xxx
提出日時 2023-05-28 15:12:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 86,268 KB
最終ジャッジ日時 2023-09-09 06:15:04
合計ジャッジ時間 9,700 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 234 ms
85,732 KB
testcase_01 AC 252 ms
86,128 KB
testcase_02 AC 123 ms
78,520 KB
testcase_03 AC 203 ms
84,000 KB
testcase_04 AC 216 ms
84,924 KB
testcase_05 AC 126 ms
78,324 KB
testcase_06 AC 147 ms
80,228 KB
testcase_07 AC 120 ms
78,444 KB
testcase_08 AC 200 ms
84,124 KB
testcase_09 AC 203 ms
83,892 KB
testcase_10 AC 253 ms
86,268 KB
testcase_11 AC 246 ms
86,176 KB
testcase_12 AC 145 ms
80,300 KB
testcase_13 AC 150 ms
80,332 KB
testcase_14 AC 126 ms
78,280 KB
testcase_15 AC 123 ms
78,192 KB
testcase_16 AC 203 ms
83,576 KB
testcase_17 AC 168 ms
81,040 KB
testcase_18 AC 127 ms
78,292 KB
testcase_19 AC 246 ms
86,084 KB
testcase_20 AC 120 ms
78,352 KB
testcase_21 AC 173 ms
84,024 KB
testcase_22 AC 190 ms
86,100 KB
testcase_23 AC 133 ms
80,568 KB
testcase_24 AC 192 ms
84,788 KB
testcase_25 AC 243 ms
86,216 KB
testcase_26 AC 169 ms
86,144 KB
testcase_27 AC 173 ms
85,984 KB
testcase_28 AC 165 ms
86,028 KB
testcase_29 AC 166 ms
86,052 KB
testcase_30 AC 170 ms
86,040 KB
testcase_31 AC 76 ms
71,348 KB
testcase_32 AC 77 ms
71,316 KB
testcase_33 AC 75 ms
71,156 KB
testcase_34 AC 76 ms
71,272 KB
testcase_35 AC 74 ms
71,256 KB
testcase_36 AC 74 ms
71,200 KB
testcase_37 AC 76 ms
71,276 KB
testcase_38 AC 73 ms
71,208 KB
testcase_39 AC 77 ms
71,280 KB
testcase_40 AC 75 ms
71,172 KB
testcase_41 AC 76 ms
71,248 KB
testcase_42 AC 74 ms
70,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N,M,P,Q = map(int,input().split())
XF = [tuple(map(int,input().split())) for i in range(Q)]
for x,f in XF:
    if x%P==0:
        print(0 if f else M)
        continue
    inv_x = pow(x,P-2,P)
    y = f*inv_x % P
    d,m = divmod(M,P)
    print(d + int(m >= y) - (f == 0))
0