結果
問題 | No.1597 Matrix Sort |
ユーザー | ophhdn |
提出日時 | 2021-07-10 13:46:31 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,474 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 86,928 KB |
実行使用メモリ | 774,328 KB |
最終ジャッジ日時 | 2023-09-14 19:09:56 |
合計ジャッジ時間 | 5,046 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 169 ms
81,252 KB |
testcase_01 | AC | 166 ms
81,468 KB |
testcase_02 | AC | 167 ms
81,376 KB |
testcase_03 | MLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
ソースコード
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor,atan2,sin,cos from operator import mul from functools import reduce from pprint import pprint sys.setrecursionlimit(2147483647) INF = 10 ** 13 def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod = 10**9+7 n,k,p=LI() A=LI() B=LI() B=[b%p for b in B] A=[a%p for a in A] A.sort() B.sort() B+=[INF] ok=p ng=0 D={0:0} j=0 for i in range(n+1): while j<p+2 and j<B[i]: j+=1 D[j]=i while ok-ng>1: mid=(ok+ng)//2 r=n-1 m = 0 for i in range(n): if mid>A[i]: m+=n-(D[p-A[i]]-D[mid-A[i]+1]) else: m+=(D[p-A[i]+mid+1]-D[p-A[i]]) if m>=k: ok=mid else: ng=mid print(ok)