結果

問題 No.2324 Two Countries within UEC
ユーザー Peach2587
提出日時 2023-05-28 15:44:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 549 bytes
コンパイル時間 2,053 ms
コンパイル使用メモリ 187,844 KB
実行使用メモリ 16,968 KB
最終ジャッジ日時 2024-12-27 08:28:21
合計ジャッジ時間 101,072 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 TLE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = 3.14159265359879323846264338327950288419;
const int INF = 2147483647;
using p = pair<int, int>;

int main() {
    ll n, m, p, q;
    cin >> n >> m >> p >> q;
    for (int i = 0; i < q; i++) {
        ll x, f;
        cin >> x >> f;
        x %= p;
        ll ans = 0;
        for (ll j = 1; j <= m; j++) {
            ll tmp = j % p;
            if (x * tmp % p == f) { ans++; }
        }
        cout << ans << endl;
    }
    return 0;
}
0