結果

問題 No.2324 Two Countries within UEC
ユーザー ooaiu
提出日時 2025-09-10 15:41:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 526 bytes
コンパイル時間 3,378 ms
コンパイル使用メモリ 276,300 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-10 15:41:12
合計ジャッジ時間 8,137 ms
ジャッジサーバーID
(参考情報)
judge1 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30 RE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
        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";
        }
    }
}
0