結果
| 問題 |
No.2324 Two Countries within UEC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-10 15:43:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 615 bytes |
| コンパイル時間 | 3,136 ms |
| コンパイル使用メモリ | 278,144 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-09-10 15:43:35 |
| 合計ジャッジ時間 | 6,454 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 WA * 11 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, m, p, q;
cin >> n >> m >> p >> q;
mint::set_mod(p);
while (q--) {
int x, f;
cin >> x >> f;
if (x % p == 0) {
cout << m << "\n";
continue;
}
long y = (mint(x).inv() * f).val();
if (m < y) cout << 0 << "\n";
else {
int t = (m - y) / p + 1;
if (y == 0) t--;
cout << t << "\n";
}
}
}