結果
問題 | No.5016 Worst Mayor |
ユーザー |
![]() |
提出日時 | 2023-04-29 14:44:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 112 ms / 2,000 ms |
コード長 | 1,078 bytes |
コンパイル時間 | 444 ms |
コンパイル使用メモリ | 10,948 KB |
実行使用メモリ | 24,916 KB |
スコア | 11,462,958,180 |
平均クエリ数 | 400.00 |
最終ジャッジ日時 | 2023-04-29 14:44:41 |
合計ジャッジ時間 | 8,614 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
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<20 and YOKOI and TATEI: if YOKOI[-1][0]>TATEI[-1][0]: print(1,tmax,YOKOI[-1][1],tmax,YOKOI[-1][1]+1,flush=True) YOKOI.pop() else: print(1,TATEI[-1][1],ymax,TATEI[-1][1]+1,ymax,flush=True) TATEI.pop() bridge+=1 else: print(3,flush=True)