結果
| 問題 |
No.5011 Better Mo's Algorithm is Needed!! (Weighted)
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-12-17 02:52:41 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,013 ms / 5,000 ms |
| コード長 | 595 bytes |
| コンパイル時間 | 64 ms |
| 実行使用メモリ | 66,160 KB |
| スコア | 34,902,652,850 |
| 最終ジャッジ日時 | 2022-12-17 02:55:26 |
| 合計ジャッジ時間 | 158,366 ms |
|
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 120 |
ソースコード
import sys
input = sys.stdin.readline
from operator import itemgetter
N,Q,WT,ST=map(int,input().split())
W=list(map(int,input().split()))
LR=[list(map(int,input().split()))+[i+1] for i in range(Q)]
LR.sort(key=itemgetter(0))
LIST=[[] for i in range(1000)]
for x,y,ind in LR:
LIST[x//447].append((y,ind))
ANS=[]
count=0
for i in range(1000):
if LIST[i]==[]:
continue
if count%2==0:
LIST[i].sort(key=itemgetter(0))
else:
LIST[i].sort(key=itemgetter(0),reverse=True)
for _,ind in LIST[i]:
ANS.append(ind)
count+=1
print(*ANS)
titia