結果

問題 No.2324 Two Countries within UEC
ユーザー karinohitokarinohito
提出日時 2023-09-22 17:29:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 1,957 ms
コンパイル使用メモリ 197,836 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-22 17:29:19
合計ジャッジ時間 14,306 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 371 ms
4,376 KB
testcase_02 AC 65 ms
4,376 KB
testcase_03 AC 263 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 71 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 57 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 374 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 107 ms
4,380 KB
testcase_14 AC 65 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 248 ms
4,380 KB
testcase_17 AC 161 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 365 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 358 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,384 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 WA -
testcase_36 AC 1 ms
4,380 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 1 ms
4,380 KB
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll N,M,P,Q,X,F;
ll mp(ll a,ll n){
    a%=P;
    if(n==0)return 1;
    else if(n%2==1)return (a*mp(a,n-1))%P;
    else {
        ll r=mp(a,n/2);
        return (r*r)%P;
    }
}
int main() {
    cin>>N>>M>>P>>Q;
    while(cin>>X>>F){
        ll y=(F*mp(X,P-2))%P;
        cout<<M/P+(M>=y&&y!=0)<<endl;
    }
}
0