結果

問題 No.2687 所により大雨
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2024-03-01 11:21:32
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,246 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 87,464 KB
最終ジャッジ日時 2024-03-20 06:07:59
合計ジャッジ時間 6,585 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 322 ms
81,076 KB
testcase_01 AC 326 ms
81,076 KB
testcase_02 AC 325 ms
81,076 KB
testcase_03 AC 323 ms
81,076 KB
testcase_04 AC 324 ms
81,076 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 38 ms
53,456 KB
testcase_08 AC 41 ms
53,460 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# TLE O(NKlogM)

import sys
from sys import stdin

N,M = map(int,stdin.readline().split())

lrA = []
lrB = []

for i in range(N):
    L,R = map(int,stdin.readline().split())
    lrA.append( (L,R) )

for i in range(M):
    L,R = map(int,stdin.readline().split())
    lrB.append( (L,R) )

K = int(stdin.readline())
P = list(map(int,stdin.readline().split()))

lrA.sort()
lrB.sort()

lrA,lrB = lrB,lrA
N,M = M,N

flag = False

for i in range(N-1):
    l,r = lrA[i]
    L,R = lrA[i+1]
    if L <= r:
        flag = True

for i in range(M-1):
    l,r = lrB[i]
    L,R = lrB[i+1]
    if L <= r:
        flag = True

if flag:
    print (*[1]*K)
    sys.exit()

ans = []

for p in P:

    flag = False
    for L,R in lrB:

        # L-t = p  ->  t = L-p
        tl = L-p
        tr = R-p

        # l+tl = p ->  l = p-tl

        sl = p - tr
        sr = p - tl

        ok = 0
        ng = len(lrA)
        while abs(ok-ng) != 1:
            mid = (ok+ng)//2
            if lrA[mid][0] <= sr:
                ok = mid
            else:
                ng = mid

        l,r = lrA[ok]
        if not( r < sl or sr < l ):
            flag = True
            break
    
    
    if flag:
        ans.append(1)
    else:
        ans.append(0)

print (*ans)
0