結果
問題 |
No.5011 Better Mo's Algorithm is Needed!! (Weighted)
|
ユーザー |
![]() |
提出日時 | 2022-12-17 03:00:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,043 ms / 5,000 ms |
コード長 | 595 bytes |
コンパイル時間 | 436 ms |
実行使用メモリ | 66,140 KB |
スコア | 35,448,770,023 |
最終ジャッジ日時 | 2022-12-17 03:03:01 |
合計ジャッジ時間 | 164,893 ms |
ジャッジサーバーID (参考情報) |
judge16 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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//500].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)