結果
問題 | No.2324 Two Countries within UEC |
ユーザー | vwxyz |
提出日時 | 2023-06-14 15:32:03 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 603 ms / 2,000 ms |
コード長 | 990 bytes |
コンパイル時間 | 379 ms |
コンパイル使用メモリ | 10,672 KB |
実行使用メモリ | 10,896 KB |
最終ジャッジ日時 | 2023-09-09 06:27:02 |
合計ジャッジ時間 | 13,245 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 549 ms
10,812 KB |
testcase_01 | AC | 598 ms
10,884 KB |
testcase_02 | AC | 130 ms
10,656 KB |
testcase_03 | AC | 433 ms
10,756 KB |
testcase_04 | AC | 477 ms
10,600 KB |
testcase_05 | AC | 140 ms
10,716 KB |
testcase_06 | AC | 216 ms
10,772 KB |
testcase_07 | AC | 117 ms
10,580 KB |
testcase_08 | AC | 415 ms
10,600 KB |
testcase_09 | AC | 422 ms
10,784 KB |
testcase_10 | AC | 603 ms
10,592 KB |
testcase_11 | AC | 556 ms
10,896 KB |
testcase_12 | AC | 194 ms
10,888 KB |
testcase_13 | AC | 192 ms
10,676 KB |
testcase_14 | AC | 129 ms
10,724 KB |
testcase_15 | AC | 117 ms
10,736 KB |
testcase_16 | AC | 409 ms
10,744 KB |
testcase_17 | AC | 277 ms
10,740 KB |
testcase_18 | AC | 130 ms
10,768 KB |
testcase_19 | AC | 582 ms
10,772 KB |
testcase_20 | AC | 100 ms
10,632 KB |
testcase_21 | AC | 257 ms
10,484 KB |
testcase_22 | AC | 339 ms
10,548 KB |
testcase_23 | AC | 131 ms
10,368 KB |
testcase_24 | AC | 252 ms
10,432 KB |
testcase_25 | AC | 569 ms
10,728 KB |
testcase_26 | AC | 204 ms
10,572 KB |
testcase_27 | AC | 205 ms
10,524 KB |
testcase_28 | AC | 204 ms
10,592 KB |
testcase_29 | AC | 210 ms
10,612 KB |
testcase_30 | AC | 201 ms
10,624 KB |
testcase_31 | AC | 34 ms
10,320 KB |
testcase_32 | AC | 34 ms
10,316 KB |
testcase_33 | AC | 34 ms
10,372 KB |
testcase_34 | AC | 34 ms
10,380 KB |
testcase_35 | AC | 35 ms
10,300 KB |
testcase_36 | AC | 34 ms
10,400 KB |
testcase_37 | AC | 33 ms
10,356 KB |
testcase_38 | AC | 33 ms
10,228 KB |
testcase_39 | AC | 33 ms
10,296 KB |
testcase_40 | AC | 34 ms
10,352 KB |
testcase_41 | AC | 33 ms
10,364 KB |
testcase_42 | AC | 33 ms
10,528 KB |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines write=sys.stdout.write N,M,P,Q=map(int,readline().split()) for q in range(Q): x,f=map(int,readline().split()) if x%P==0: if f==0: ans=M else: ans=0 else: y=pow(x,P-2,P)*f%P if y: ans=(M-y)//P+1 else: ans=M//P print(ans)