結果
| 問題 |
No.2324 Two Countries within UEC
|
| コンテスト | |
| ユーザー |
prd_xxx
|
| 提出日時 | 2023-05-28 15:12:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 212 ms / 2,000 ms |
| コード長 | 310 bytes |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 82,832 KB |
| 実行使用メモリ | 85,552 KB |
| 最終ジャッジ日時 | 2024-06-26 23:24:43 |
| 合計ジャッジ時間 | 7,097 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 |
ソースコード
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))
prd_xxx