結果
| 問題 | No.2324 Two Countries within UEC |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-14 09:06:55 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 236 ms / 2,000 ms |
| + 777µs | |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 2,673 ms |
| コンパイル使用メモリ | 95,828 KB |
| 実行使用メモリ | 84,992 KB |
| 最終ジャッジ日時 | 2026-09-05 06:48:54 |
| 合計ジャッジ時間 | 13,349 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 |
ソースコード
N,M,P,Q = map(int,input().split())
for _ in range(Q):
x,f = map(int,input().split())
x = x%P
y = (pow(x,P-2,P)*f)%P
if x==0 and f!=0:
print(0)
elif x==0 and f==0:
print(M)
else:
if y>M:
print(0)
else:
ans = (M-y)//P+1
if y==0:
print(ans-1)
else:
print(ans)