結果

問題 No.2324 Two Countries within UEC
ユーザー sepa38sepa38
提出日時 2023-05-06 11:02:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 406 ms / 2,000 ms
コード長 231 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 78,884 KB
最終ジャッジ日時 2023-09-09 06:00:25
合計ジャッジ時間 14,772 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 375 ms
78,540 KB
testcase_01 AC 406 ms
78,588 KB
testcase_02 AC 163 ms
78,176 KB
testcase_03 AC 326 ms
78,652 KB
testcase_04 AC 354 ms
78,444 KB
testcase_05 AC 166 ms
78,244 KB
testcase_06 AC 211 ms
78,624 KB
testcase_07 AC 155 ms
78,316 KB
testcase_08 AC 319 ms
78,532 KB
testcase_09 AC 322 ms
78,568 KB
testcase_10 AC 397 ms
78,668 KB
testcase_11 AC 392 ms
78,592 KB
testcase_12 AC 197 ms
78,576 KB
testcase_13 AC 198 ms
78,564 KB
testcase_14 AC 162 ms
78,228 KB
testcase_15 AC 155 ms
78,240 KB
testcase_16 AC 305 ms
78,636 KB
testcase_17 AC 243 ms
78,700 KB
testcase_18 AC 164 ms
78,268 KB
testcase_19 AC 398 ms
78,564 KB
testcase_20 AC 145 ms
78,368 KB
testcase_21 AC 310 ms
78,428 KB
testcase_22 AC 344 ms
78,384 KB
testcase_23 AC 190 ms
78,484 KB
testcase_24 AC 316 ms
78,884 KB
testcase_25 AC 398 ms
78,644 KB
testcase_26 AC 315 ms
77,176 KB
testcase_27 AC 323 ms
77,180 KB
testcase_28 AC 320 ms
77,092 KB
testcase_29 AC 312 ms
77,268 KB
testcase_30 AC 309 ms
77,380 KB
testcase_31 AC 68 ms
71,248 KB
testcase_32 AC 70 ms
71,292 KB
testcase_33 AC 70 ms
71,064 KB
testcase_34 AC 68 ms
71,244 KB
testcase_35 AC 70 ms
71,372 KB
testcase_36 AC 69 ms
71,184 KB
testcase_37 AC 70 ms
71,068 KB
testcase_38 AC 70 ms
71,328 KB
testcase_39 AC 72 ms
71,240 KB
testcase_40 AC 71 ms
71,364 KB
testcase_41 AC 70 ms
71,328 KB
testcase_42 AC 71 ms
71,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p, q = map(int, input().split())
for _ in range(q):
  x, f = map(int, input().split())
  if x % p == 0:
    print(0 if f else m)
    continue
  y = f * pow(x, p-2, p) % p
  print(m // p if y == 0 or y > m % p else m // p + 1)
0