結果

問題 No.2324 Two Countries within UEC
ユーザー とりゐとりゐ
提出日時 2023-05-28 13:39:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 79,132 KB
最終ジャッジ日時 2023-09-09 06:03:45
合計ジャッジ時間 12,491 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 382 ms
78,768 KB
testcase_01 AC 405 ms
78,344 KB
testcase_02 AC 163 ms
78,236 KB
testcase_03 AC 324 ms
78,580 KB
testcase_04 AC 352 ms
78,848 KB
testcase_05 AC 166 ms
78,088 KB
testcase_06 AC 210 ms
78,668 KB
testcase_07 AC 155 ms
78,176 KB
testcase_08 AC 321 ms
78,588 KB
testcase_09 AC 329 ms
78,508 KB
testcase_10 AC 401 ms
78,512 KB
testcase_11 AC 392 ms
78,576 KB
testcase_12 AC 199 ms
78,532 KB
testcase_13 AC 198 ms
78,764 KB
testcase_14 AC 164 ms
78,316 KB
testcase_15 AC 156 ms
78,304 KB
testcase_16 AC 308 ms
78,756 KB
testcase_17 AC 235 ms
78,512 KB
testcase_18 AC 166 ms
78,328 KB
testcase_19 AC 402 ms
78,760 KB
testcase_20 AC 149 ms
78,104 KB
testcase_21 AC 300 ms
78,712 KB
testcase_22 AC 346 ms
78,580 KB
testcase_23 AC 187 ms
78,704 KB
testcase_24 AC 316 ms
79,132 KB
testcase_25 AC 397 ms
78,564 KB
testcase_26 AC 321 ms
77,340 KB
testcase_27 AC 321 ms
77,388 KB
testcase_28 AC 316 ms
77,564 KB
testcase_29 AC 316 ms
77,356 KB
testcase_30 AC 313 ms
77,316 KB
testcase_31 AC 72 ms
71,284 KB
testcase_32 AC 71 ms
71,212 KB
testcase_33 AC 72 ms
71,244 KB
testcase_34 AC 73 ms
71,084 KB
testcase_35 AC 73 ms
71,084 KB
testcase_36 AC 73 ms
71,188 KB
testcase_37 AC 73 ms
71,204 KB
testcase_38 AC 73 ms
71,216 KB
testcase_39 AC 72 ms
71,224 KB
testcase_40 AC 73 ms
71,204 KB
testcase_41 AC 73 ms
71,192 KB
testcase_42 AC 73 ms
71,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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