提出 #72369370
ソースコード 拡げる
from bisect import bisect_right, bisect_left
def check(ans) :
t=bisect_right(A,ans)
if Y>=(ans-X)-s+t+1 :
return True
else :
return False
N,Q=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A)
T=set()
for i in range(N) :
T.add(A[i])
for q in range(Q) :
X,Y=map(int,input().split())
s=bisect_right(A,X)
ans=2**29
for d in range(29) :
if check(ans) :
ans+=2**(28-d)
else :
ans-=2**(28-d)
if not check(ans) :
ans-=1
print(ans)
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Forbidden List 2 |
| ユーザ | Youteru |
| 言語 | Python (PyPy 3.11-v7.3.20) |
| 得点 | 0 |
| コード長 | 518 Byte |
| 結果 | WA |
| 実行時間 | > 2000 ms |
| メモリ | 205472 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 400 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | WA | 46 ms | 80544 KiB |
| 00-sample-02.txt | WA | 46 ms | 80748 KiB |
| 01-01.txt | WA | 131 ms | 110148 KiB |
| 01-02.txt | WA | 132 ms | 109712 KiB |
| 01-03.txt | WA | 134 ms | 109948 KiB |
| 01-04.txt | WA | 134 ms | 110176 KiB |
| 01-05.txt | WA | 111 ms | 110240 KiB |
| 01-06.txt | WA | 119 ms | 110456 KiB |
| 01-07.txt | WA | 111 ms | 109932 KiB |
| 01-08.txt | WA | 117 ms | 110600 KiB |
| 01-09.txt | WA | 117 ms | 110408 KiB |
| 01-10.txt | WA | 117 ms | 110412 KiB |
| 01-11.txt | WA | 117 ms | 110740 KiB |
| 01-12.txt | WA | 117 ms | 110668 KiB |
| 01-13.txt | WA | 1374 ms | 202720 KiB |
| 01-14.txt | TLE | > 2000 ms | 202636 KiB |
| 01-15.txt | TLE | > 2000 ms | 204564 KiB |
| 01-16.txt | WA | 1007 ms | 148396 KiB |
| 01-17.txt | WA | 1892 ms | 199568 KiB |
| 01-18.txt | WA | 1693 ms | 174504 KiB |
| 01-19.txt | WA | 1564 ms | 205472 KiB |
| 01-20.txt | WA | 1317 ms | 204816 KiB |