結果
問題 | No.2324 Two Countries within UEC |
ユーザー |
|
提出日時 | 2023-05-28 14:25:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 435 ms / 2,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 308 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-06-26 23:21:48 |
合計ジャッジ時間 | 10,482 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
import sys def input(): return sys.stdin.readline().rstrip() from collections import deque, Counter def main(): N, M, P, Q = map(int, input().split()) for _ in range(Q): x, f = map(int, input().split()) if x%P: p = f*pow(x, -1, P)%P print(M//P+(M%P>=p)-(p==0)) else: if f%P: print(0) else: print(M) if __name__ == "__main__": main()