結果
問題 | No.2324 Two Countries within UEC |
ユーザー | えいる |
提出日時 | 2023-05-28 13:55:14 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 248 ms / 2,000 ms |
コード長 | 1,221 bytes |
コンパイル時間 | 3,677 ms |
コンパイル使用メモリ | 226,060 KB |
実行使用メモリ | 4,500 KB |
最終ジャッジ日時 | 2023-09-09 06:09:26 |
合計ジャッジ時間 | 10,709 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 229 ms
4,380 KB |
testcase_01 | AC | 240 ms
4,376 KB |
testcase_02 | AC | 44 ms
4,376 KB |
testcase_03 | AC | 183 ms
4,376 KB |
testcase_04 | AC | 212 ms
4,380 KB |
testcase_05 | AC | 47 ms
4,376 KB |
testcase_06 | AC | 84 ms
4,376 KB |
testcase_07 | AC | 38 ms
4,380 KB |
testcase_08 | AC | 180 ms
4,376 KB |
testcase_09 | AC | 187 ms
4,376 KB |
testcase_10 | AC | 248 ms
4,376 KB |
testcase_11 | AC | 238 ms
4,376 KB |
testcase_12 | AC | 75 ms
4,500 KB |
testcase_13 | AC | 74 ms
4,380 KB |
testcase_14 | AC | 45 ms
4,380 KB |
testcase_15 | AC | 38 ms
4,380 KB |
testcase_16 | AC | 163 ms
4,376 KB |
testcase_17 | AC | 103 ms
4,380 KB |
testcase_18 | AC | 48 ms
4,380 KB |
testcase_19 | AC | 244 ms
4,376 KB |
testcase_20 | AC | 32 ms
4,376 KB |
testcase_21 | AC | 162 ms
4,380 KB |
testcase_22 | AC | 206 ms
4,380 KB |
testcase_23 | AC | 65 ms
4,376 KB |
testcase_24 | AC | 172 ms
4,376 KB |
testcase_25 | AC | 247 ms
4,376 KB |
testcase_26 | AC | 193 ms
4,376 KB |
testcase_27 | AC | 195 ms
4,376 KB |
testcase_28 | AC | 186 ms
4,384 KB |
testcase_29 | AC | 187 ms
4,380 KB |
testcase_30 | AC | 192 ms
4,376 KB |
testcase_31 | AC | 2 ms
4,376 KB |
testcase_32 | AC | 1 ms
4,380 KB |
testcase_33 | AC | 2 ms
4,376 KB |
testcase_34 | AC | 2 ms
4,380 KB |
testcase_35 | AC | 1 ms
4,376 KB |
testcase_36 | AC | 2 ms
4,380 KB |
testcase_37 | AC | 2 ms
4,376 KB |
testcase_38 | AC | 2 ms
4,380 KB |
testcase_39 | AC | 1 ms
4,376 KB |
testcase_40 | AC | 2 ms
4,376 KB |
testcase_41 | AC | 1 ms
4,380 KB |
testcase_42 | AC | 2 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; using vl=vector<long long>; using vvl=vector<vector<long long>>; using vvvl=vector<vector<vector<long long>>>; using pl=pair<long long,long long>; using vpl=vector<pair<long long,long long>>; #define fi first #define se second #define all(x) (x).begin(),(x).end() #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(long long i=(long long)(a);i<(long long)(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define pb push_back #define lb lower_bound #define ub upper_bound #include <atcoder/all> using namespace atcoder; long long modpow(long long a, long long n, long long mo){long long res=1;while(n>0){if(n&1){res=res*a%mo;}a=a*a%mo;n>>=1;}return res;} long long Pow(long long a, long long n){long long res=1;while(n>0){if(n&1){res=res*a;}a=a*a;n>>=1;}return res;} const ll MOD=998244353; const ll INF=(1ll<<60); int main(){ ll N,M,P,Q; cin>>N>>M>>P>>Q; rep(i,Q){ ll x,f; cin>>x>>f; if(x%P==0){ if(f%P==0) cout<<M<<endl; else cout<<0<<endl; continue; } ll y=(inv_mod(x%P,P)*f)%P; if(f%P==0) y=P; cout<<(M-y+P)/P<<endl; } }