結果
| 問題 |
No.2324 Two Countries within UEC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 14:37:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 493 bytes |
| コンパイル時間 | 1,782 ms |
| コンパイル使用メモリ | 195,840 KB |
| 最終ジャッジ日時 | 2025-02-13 11:48:07 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 RE * 11 |
ソースコード
#include <bits/stdc++.h>
#include "atcoder/modint"
using i64 = long long;
using Mint = atcoder::dynamic_modint<1>;
int main() {
i64 N, M, P;
int Q;
std::cin >> N >> M >> P >> Q;
Mint::set_mod(P);
while (Q--) {
i64 x, f;
std::cin >> x >> f;
Mint inv = Mint(f) / Mint(x);
i64 v = inv.val();
if (v > M) std::cout << 0 << std::endl;
else {
std::cout << (M - v) / P + (f == 0 ? 0 : 1) << std::endl;
}
}
}