結果
問題 | No.97 最大の値を求めるくえり |
ユーザー | Mao-beta |
提出日時 | 2024-03-07 15:35:06 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,556 bytes |
コンパイル時間 | 1,803 ms |
コンパイル使用メモリ | 81,444 KB |
実行使用メモリ | 92,212 KB |
最終ジャッジ日時 | 2024-03-07 15:35:15 |
合計ジャッジ時間 | 7,359 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
63,928 KB |
testcase_01 | AC | 64 ms
81,192 KB |
testcase_02 | RE | - |
testcase_03 | WA | - |
testcase_04 | AC | 101 ms
76,948 KB |
testcase_05 | AC | 132 ms
77,192 KB |
testcase_06 | AC | 130 ms
77,192 KB |
testcase_07 | AC | 215 ms
77,312 KB |
testcase_08 | AC | 285 ms
77,428 KB |
testcase_09 | AC | 450 ms
77,788 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
ソースコード
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 <= 300: 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, -1, M) for x in range(M-1, M-1-300, -1): a = x * inv % M if a in SA: print(x) break if __name__ == "__main__": main()