結果

問題 No.5010 Better Mo's Algorithm is Needed!! (Unweighted)
ユーザー ansainansain
提出日時 2022-12-17 15:00:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 640 ms / 5,000 ms
コード長 1,622 bytes
コンパイル時間 252 ms
実行使用メモリ 154,708 KB
スコア 10,118,330,726
最終ジャッジ日時 2022-12-17 15:02:55
合計ジャッジ時間 121,277 ms
ジャッジサーバーID
(参考情報)
judge15 / judge16
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 603 ms
153,376 KB
testcase_01 AC 568 ms
153,524 KB
testcase_02 AC 574 ms
153,504 KB
testcase_03 AC 551 ms
153,304 KB
testcase_04 AC 557 ms
153,260 KB
testcase_05 AC 590 ms
153,512 KB
testcase_06 AC 557 ms
153,316 KB
testcase_07 AC 590 ms
153,352 KB
testcase_08 AC 567 ms
153,628 KB
testcase_09 AC 581 ms
153,472 KB
testcase_10 AC 570 ms
153,644 KB
testcase_11 AC 577 ms
153,332 KB
testcase_12 AC 590 ms
153,440 KB
testcase_13 AC 587 ms
153,364 KB
testcase_14 AC 562 ms
153,300 KB
testcase_15 AC 608 ms
154,668 KB
testcase_16 AC 588 ms
153,492 KB
testcase_17 AC 595 ms
153,428 KB
testcase_18 AC 589 ms
153,324 KB
testcase_19 AC 559 ms
153,264 KB
testcase_20 AC 595 ms
153,524 KB
testcase_21 AC 567 ms
153,044 KB
testcase_22 AC 567 ms
153,292 KB
testcase_23 AC 590 ms
153,312 KB
testcase_24 AC 562 ms
153,328 KB
testcase_25 AC 611 ms
153,368 KB
testcase_26 AC 585 ms
153,340 KB
testcase_27 AC 550 ms
153,220 KB
testcase_28 AC 573 ms
153,552 KB
testcase_29 AC 567 ms
153,404 KB
testcase_30 AC 591 ms
153,580 KB
testcase_31 AC 583 ms
153,464 KB
testcase_32 AC 599 ms
153,408 KB
testcase_33 AC 554 ms
153,308 KB
testcase_34 AC 559 ms
153,456 KB
testcase_35 AC 576 ms
152,988 KB
testcase_36 AC 578 ms
154,540 KB
testcase_37 AC 606 ms
154,572 KB
testcase_38 AC 560 ms
153,340 KB
testcase_39 AC 587 ms
153,256 KB
testcase_40 AC 571 ms
153,324 KB
testcase_41 AC 583 ms
153,252 KB
testcase_42 AC 595 ms
153,280 KB
testcase_43 AC 585 ms
153,416 KB
testcase_44 AC 580 ms
153,432 KB
testcase_45 AC 579 ms
153,244 KB
testcase_46 AC 623 ms
153,324 KB
testcase_47 AC 565 ms
153,532 KB
testcase_48 AC 582 ms
153,488 KB
testcase_49 AC 561 ms
153,536 KB
testcase_50 AC 557 ms
153,528 KB
testcase_51 AC 576 ms
153,336 KB
testcase_52 AC 563 ms
153,588 KB
testcase_53 AC 638 ms
153,288 KB
testcase_54 AC 549 ms
153,364 KB
testcase_55 AC 590 ms
153,304 KB
testcase_56 AC 566 ms
153,464 KB
testcase_57 AC 561 ms
153,368 KB
testcase_58 AC 562 ms
153,428 KB
testcase_59 AC 565 ms
153,316 KB
testcase_60 AC 577 ms
153,520 KB
testcase_61 AC 605 ms
153,308 KB
testcase_62 AC 565 ms
153,304 KB
testcase_63 AC 597 ms
153,348 KB
testcase_64 AC 578 ms
153,296 KB
testcase_65 AC 596 ms
153,516 KB
testcase_66 AC 606 ms
153,504 KB
testcase_67 AC 570 ms
153,288 KB
testcase_68 AC 591 ms
153,444 KB
testcase_69 AC 553 ms
153,408 KB
testcase_70 AC 603 ms
153,300 KB
testcase_71 AC 553 ms
153,396 KB
testcase_72 AC 583 ms
153,384 KB
testcase_73 AC 568 ms
153,508 KB
testcase_74 AC 615 ms
153,284 KB
testcase_75 AC 578 ms
153,252 KB
testcase_76 AC 567 ms
153,448 KB
testcase_77 AC 577 ms
153,428 KB
testcase_78 AC 588 ms
153,492 KB
testcase_79 AC 579 ms
153,384 KB
testcase_80 AC 585 ms
153,376 KB
testcase_81 AC 577 ms
153,076 KB
testcase_82 AC 553 ms
153,516 KB
testcase_83 AC 580 ms
153,380 KB
testcase_84 AC 557 ms
153,204 KB
testcase_85 AC 588 ms
153,316 KB
testcase_86 AC 575 ms
153,604 KB
testcase_87 AC 596 ms
153,300 KB
testcase_88 AC 554 ms
153,396 KB
testcase_89 AC 563 ms
153,332 KB
testcase_90 AC 571 ms
153,500 KB
testcase_91 AC 562 ms
153,320 KB
testcase_92 AC 593 ms
153,208 KB
testcase_93 AC 543 ms
153,404 KB
testcase_94 AC 640 ms
154,396 KB
testcase_95 AC 601 ms
153,432 KB
testcase_96 AC 566 ms
153,368 KB
testcase_97 AC 587 ms
153,528 KB
testcase_98 AC 593 ms
153,612 KB
testcase_99 AC 566 ms
153,500 KB
testcase_100 AC 578 ms
153,372 KB
testcase_101 AC 603 ms
153,636 KB
testcase_102 AC 566 ms
153,492 KB
testcase_103 AC 605 ms
153,284 KB
testcase_104 AC 598 ms
153,452 KB
testcase_105 AC 549 ms
153,300 KB
testcase_106 AC 606 ms
154,664 KB
testcase_107 AC 583 ms
153,228 KB
testcase_108 AC 548 ms
153,472 KB
testcase_109 AC 615 ms
153,388 KB
testcase_110 AC 552 ms
153,480 KB
testcase_111 AC 613 ms
153,284 KB
testcase_112 AC 586 ms
153,152 KB
testcase_113 AC 578 ms
154,632 KB
testcase_114 AC 602 ms
153,444 KB
testcase_115 AC 588 ms
153,460 KB
testcase_116 AC 562 ms
153,336 KB
testcase_117 AC 619 ms
153,512 KB
testcase_118 AC 564 ms
153,316 KB
testcase_119 AC 609 ms
154,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict, Counter, deque
from itertools import permutations, combinations, product, combinations_with_replacement, groupby, accumulate
import operator
from math import sqrt, gcd, factorial, ceil
#from math import isqrt, prod, comb  #python3.8用(notpypy)
#from bisect import bisect_left, bisect_right
#from functools import lru_cache, reduce
#from heapq import heappush, heappop, heapify, heappushpop, heapreplace
#import numpy as np
#import networkx as nx
#from networkx.utils import UnionFind
#from numba import njit, b1, i1, i4, i8, f8
#numba例 @njit(i1(i4[:], i8[:, :]),cache=True) 引数i4配列、i8 2次元配列,戻り値i1
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, NegativeCycleError, maximum_bipartite_matching, maximum_flow, minimum_spanning_tree
def input(): return sys.stdin.readline().rstrip()
def divceil(n, k): return 1+(n-1)//k  # n/kの切り上げを返す
def yn(hantei, yes='Yes', no='No'): print(yes if hantei else no)


def main():
    mod = 10**9+7
    mod2 = 998244353
    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)]
    b = ceil(sqrt(q))
    bucket = [list() for _ in range(b + 1)]
    for l,r,i in lr:
        bucket[l // b].append((l, r, i))
    for i in range(len(bucket)):
        bucket[i].sort(key=operator.itemgetter(1))
    ans=[]
    for b in bucket:
        for l,r,i in b:
            ans.append(i)
    print(*ans)




if __name__ == '__main__':
    main()
0