結果

問題 No.2324 Two Countries within UEC
ユーザー 👑 colognecologne
提出日時 2023-08-05 12:42:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 427 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 77,184 KB
最終ジャッジ日時 2024-04-23 09:53:37
合計ジャッジ時間 13,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 401 ms
75,904 KB
testcase_01 AC 414 ms
76,416 KB
testcase_02 AC 156 ms
76,544 KB
testcase_03 AC 338 ms
76,032 KB
testcase_04 AC 377 ms
76,160 KB
testcase_05 AC 157 ms
76,748 KB
testcase_06 AC 204 ms
76,304 KB
testcase_07 AC 144 ms
75,904 KB
testcase_08 AC 338 ms
76,312 KB
testcase_09 AC 344 ms
76,456 KB
testcase_10 AC 420 ms
76,544 KB
testcase_11 AC 415 ms
76,160 KB
testcase_12 AC 201 ms
77,184 KB
testcase_13 AC 194 ms
75,904 KB
testcase_14 AC 155 ms
76,332 KB
testcase_15 AC 150 ms
76,144 KB
testcase_16 AC 315 ms
75,904 KB
testcase_17 AC 233 ms
76,544 KB
testcase_18 AC 158 ms
76,288 KB
testcase_19 AC 426 ms
76,160 KB
testcase_20 AC 139 ms
77,056 KB
testcase_21 AC 323 ms
76,160 KB
testcase_22 AC 387 ms
76,240 KB
testcase_23 AC 187 ms
76,160 KB
testcase_24 AC 347 ms
76,544 KB
testcase_25 AC 427 ms
76,032 KB
testcase_26 AC 311 ms
76,288 KB
testcase_27 AC 300 ms
76,160 KB
testcase_28 AC 319 ms
76,288 KB
testcase_29 AC 303 ms
76,160 KB
testcase_30 AC 308 ms
76,288 KB
testcase_31 AC 40 ms
51,840 KB
testcase_32 AC 42 ms
52,096 KB
testcase_33 AC 41 ms
52,096 KB
testcase_34 AC 43 ms
51,712 KB
testcase_35 AC 39 ms
51,968 KB
testcase_36 AC 41 ms
51,328 KB
testcase_37 AC 40 ms
51,328 KB
testcase_38 AC 40 ms
51,968 KB
testcase_39 AC 41 ms
51,840 KB
testcase_40 AC 41 ms
51,584 KB
testcase_41 AC 41 ms
52,096 KB
testcase_42 AC 40 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


if __name__ == '__main__':
    main()
0