結果
問題 | No.97 最大の値を求めるくえり |
ユーザー | Mao-beta |
提出日時 | 2024-03-07 15:37:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,559 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 91,596 KB |
最終ジャッジ日時 | 2024-03-07 15:38:10 |
合計ジャッジ時間 | 11,775 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 51 ms
63,928 KB |
testcase_01 | AC | 68 ms
80,936 KB |
testcase_02 | AC | 998 ms
79,440 KB |
testcase_03 | AC | 1,002 ms
79,440 KB |
testcase_04 | AC | 116 ms
76,948 KB |
testcase_05 | AC | 125 ms
77,192 KB |
testcase_06 | AC | 140 ms
77,192 KB |
testcase_07 | AC | 238 ms
77,312 KB |
testcase_08 | AC | 297 ms
77,432 KB |
testcase_09 | AC | 473 ms
77,788 KB |
testcase_10 | AC | 833 ms
79,056 KB |
testcase_11 | AC | 1,175 ms
79,568 KB |
testcase_12 | AC | 1,503 ms
80,208 KB |
testcase_13 | AC | 1,855 ms
81,100 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
ソースコード
import sys import math import bisect from heapq import heapify, heappop, heappush from collections import deque, defaultdict, Counter from functools import lru_cache from itertools import accumulate, combinations, permutations, product sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 MOD99 = 998244353 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() SMI = lambda: input().split() SLI = lambda: list(SMI()) EI = lambda m: [NLI() for _ in range(m)] xor128_x = 123456789 xor128_y = 362436069 xor128_z = 521288629 xor128_w = 88675123 mask = (1 << 32) - 1 def xor128(): global xor128_x, xor128_y, xor128_z, xor128_w t = xor128_x ^ (xor128_x << 11) t &= mask xor128_x, xor128_y, xor128_z = xor128_y, xor128_z, xor128_w xor128_w = xor128_w ^ (xor128_w >> 19) ^ (t ^ (t >> 8)) xor128_w &= mask return xor128_w def generateA(N): A = [] for i in range(N): A.append(xor128() % 100003) return A def main(): N, Q = NMI() M = 100003 A = generateA(N) if N <= 1000: for _ in range(Q): q = NI() B = [a*q % M for a in A] print(max(B)) else: SA = set(A) for _ in range(Q): q = NI() inv = pow(q, M-2, M) for x in range(M-1, M-1-1000, -1): a = x * inv % M if a in SA: print(x) break if __name__ == "__main__": main()