結果

問題 No.2324 Two Countries within UEC
ユーザー katonyonkokatonyonko
提出日時 2023-05-28 13:48:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 1,115 bytes
コンパイル時間 1,385 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 78,740 KB
最終ジャッジ日時 2023-09-09 06:06:57
合計ジャッジ時間 12,927 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 381 ms
78,540 KB
testcase_01 AC 396 ms
78,492 KB
testcase_02 AC 159 ms
78,520 KB
testcase_03 AC 324 ms
78,472 KB
testcase_04 AC 347 ms
78,508 KB
testcase_05 AC 164 ms
78,556 KB
testcase_06 AC 205 ms
78,452 KB
testcase_07 AC 158 ms
78,740 KB
testcase_08 AC 320 ms
78,588 KB
testcase_09 AC 320 ms
78,544 KB
testcase_10 AC 405 ms
78,540 KB
testcase_11 AC 390 ms
78,624 KB
testcase_12 AC 199 ms
78,416 KB
testcase_13 AC 195 ms
78,404 KB
testcase_14 AC 161 ms
78,564 KB
testcase_15 AC 155 ms
78,368 KB
testcase_16 AC 302 ms
78,416 KB
testcase_17 AC 240 ms
78,312 KB
testcase_18 AC 172 ms
78,412 KB
testcase_19 AC 400 ms
78,520 KB
testcase_20 AC 148 ms
78,316 KB
testcase_21 AC 304 ms
78,556 KB
testcase_22 AC 353 ms
78,628 KB
testcase_23 AC 188 ms
78,472 KB
testcase_24 AC 321 ms
78,600 KB
testcase_25 AC 394 ms
78,568 KB
testcase_26 AC 319 ms
77,204 KB
testcase_27 AC 320 ms
77,224 KB
testcase_28 AC 328 ms
77,372 KB
testcase_29 AC 318 ms
77,200 KB
testcase_30 AC 326 ms
77,292 KB
testcase_31 AC 72 ms
71,200 KB
testcase_32 AC 72 ms
70,968 KB
testcase_33 AC 73 ms
70,964 KB
testcase_34 AC 72 ms
71,040 KB
testcase_35 AC 73 ms
71,292 KB
testcase_36 AC 72 ms
71,060 KB
testcase_37 AC 73 ms
71,168 KB
testcase_38 AC 70 ms
71,072 KB
testcase_39 AC 70 ms
71,172 KB
testcase_40 AC 72 ms
71,268 KB
testcase_41 AC 71 ms
71,028 KB
testcase_42 AC 71 ms
71,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import io
import sys

_INPUT = """\
6
5 5 11 3
2 8
4 7
5 3
85 82 17 8
55 1
23 2
31 7
83 0
8 0
76 16
32 1
14 1
"""

def solve(test):
  N,M,P,Q=map(int,input().split())
  for _ in range(Q):
    x,f=map(int,input().split())
    if x%P==0:
      if f==0: print(M)
      else: print(0)
    else:
      t=f*pow(x,P-2,P)%P
      if t==0 or t>M%P: print(M//P)
      else: print(M//P+1)

def random_input():
  from random import randint,shuffle
  N=randint(1,10)
  M=randint(1,N)
  A=list(range(1,M+1))+[randint(1,M) for _ in range(N-M)]
  shuffle(A)
  return (" ".join(map(str, [N,M]))+"\n"+" ".join(map(str, A))+"\n")*3

def simple_solve():
  return []

def main(test):
  if test==0:
    solve(0)
  elif test==1:
    sys.stdin = io.StringIO(_INPUT)
    case_no=int(input())
    for _ in range(case_no):
      solve(0)
  else:
    for i in range(1000):
      sys.stdin = io.StringIO(random_input())
      x=solve(1)
      y=simple_solve()
      if x!=y:
        print(i,x,y)
        print(*[line for line in sys.stdin],sep='')
        break

#0:提出用、1:与えられたテスト用、2:ストレステスト用
main(0)
0