結果

問題 No.2324 Two Countries within UEC
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-05-28 15:07:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 362 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 86,548 KB
最終ジャッジ日時 2023-08-27 11:29:05
合計ジャッジ時間 11,303 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 364 ms
85,988 KB
testcase_01 AC 381 ms
86,520 KB
testcase_02 AC 148 ms
78,604 KB
testcase_03 AC 304 ms
84,252 KB
testcase_04 AC 336 ms
84,640 KB
testcase_05 AC 152 ms
78,332 KB
testcase_06 AC 190 ms
79,968 KB
testcase_07 AC 140 ms
77,588 KB
testcase_08 AC 294 ms
84,232 KB
testcase_09 AC 299 ms
84,072 KB
testcase_10 AC 382 ms
86,228 KB
testcase_11 AC 364 ms
86,256 KB
testcase_12 AC 183 ms
79,440 KB
testcase_13 AC 174 ms
79,184 KB
testcase_14 AC 147 ms
78,532 KB
testcase_15 AC 138 ms
77,640 KB
testcase_16 AC 293 ms
83,076 KB
testcase_17 AC 221 ms
80,452 KB
testcase_18 AC 149 ms
78,364 KB
testcase_19 AC 378 ms
86,232 KB
testcase_20 AC 130 ms
77,460 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 368 ms
86,548 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 73 ms
71,308 KB
testcase_32 AC 74 ms
71,292 KB
testcase_33 AC 74 ms
71,364 KB
testcase_34 AC 74 ms
71,340 KB
testcase_35 AC 74 ms
71,452 KB
testcase_36 AC 72 ms
71,384 KB
testcase_37 AC 73 ms
71,136 KB
testcase_38 AC 73 ms
71,212 KB
testcase_39 AC 75 ms
71,248 KB
testcase_40 AC 74 ms
71,384 KB
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,P,Q = map(int,input().split())

ANS = []

for lp in range(Q):

    x,f = map(int,input().split())

    y = ( f * pow(x,P-2,P) ) % P
    if y == 0:
        y += P


    l = -1
    r = 10**18

    while r-l != 1:

        m = (l+r)//2

        if m * P + y <= M:
            l = m
        else:
            r = m

    ANS.append(r)
    
print (*ANS,sep="\n")
0