結果

問題 No.5016 Worst Mayor
ユーザー titia
提出日時 2023-04-29 14:21:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 1,113 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 25,120 KB
スコア 0
平均クエリ数 101.00
最終ジャッジ日時 2023-04-29 14:21:39
合計ジャッジ時間 7,294 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from operator import itemgetter
from math import sqrt

N,T=map(int,input().split())
P=[list(map(int,input().split())) for i in range(N)]

YOKO=[0]*16
TATE=[0]*16

for a,b,c,d in P:
    TATE[min(a,c)]+=1
    TATE[max(a,c)]-=1

    YOKO[min(b,d)]+=1
    YOKO[max(b,d)]-=1

for i in range(16):
    YOKO[i]+=YOKO[i-1]
    TATE[i]+=TATE[i-1]

YOKOI=[(YOKO[i],i) for i in range(16)]
TATEI=[(TATE[i],i) for i in range(16)]

YOKOI.sort(key=itemgetter(0))
TATEI.sort(key=itemgetter(0))

ymax=YOKOI[-1][1]
tmax=TATEI[-1][1]
bridge=0

for days in range(T):
    u,v=map(int,input().split())

    if days<100:
        print(2,flush=True)
        continue

    if int(10**7/sqrt(v))<u and days<300 and bridge<5:
        if YOKOI and TATEI:
            if YOKOI[-1][0]>TATEI[-1][0]:
                print(1,tmax,YOKOI[-1][0],tmax+1,YOKOI[-1][0]+1,flush=True)
                YOKOI.pop()
            else:
                print(1,TATEI[-1][0],ymax,TATEI[-1][0]+1,ymax+1,flush=True)
                TATEI.pop()
        bridge+=1
    else:
        print(3,flush=True)
        
        

    
0