結果

問題 No.1471 Sort Queries
ユーザー harurunharurun
提出日時 2021-04-09 22:18:53
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,375 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 230,572 KB
最終ジャッジ日時 2023-09-07 11:44:23
合計ジャッジ時間 30,327 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
75,956 KB
testcase_01 AC 99 ms
71,584 KB
testcase_02 AC 101 ms
71,724 KB
testcase_03 AC 100 ms
71,284 KB
testcase_04 AC 99 ms
71,684 KB
testcase_05 AC 98 ms
71,496 KB
testcase_06 AC 98 ms
71,348 KB
testcase_07 AC 98 ms
71,352 KB
testcase_08 AC 98 ms
71,444 KB
testcase_09 AC 96 ms
71,284 KB
testcase_10 AC 97 ms
71,168 KB
testcase_11 AC 95 ms
71,576 KB
testcase_12 AC 95 ms
71,568 KB
testcase_13 AC 531 ms
95,936 KB
testcase_14 AC 458 ms
95,708 KB
testcase_15 AC 765 ms
110,552 KB
testcase_16 AC 227 ms
81,352 KB
testcase_17 AC 406 ms
89,032 KB
testcase_18 AC 305 ms
83,508 KB
testcase_19 AC 269 ms
81,716 KB
testcase_20 AC 787 ms
110,732 KB
testcase_21 AC 423 ms
88,668 KB
testcase_22 AC 363 ms
88,680 KB
testcase_23 AC 1,644 ms
159,604 KB
testcase_24 AC 1,638 ms
159,364 KB
testcase_25 TLE -
testcase_26 AC 1,420 ms
146,284 KB
testcase_27 TLE -
testcase_28 TLE -
testcase_29 AC 1,415 ms
145,988 KB
testcase_30 AC 1,546 ms
152,240 KB
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

class INPUT:
  def __init__(self):
    self.l=open(0).read().split()[::-1]
    self.length=len(self.l)
    return

  def stream(self,k=1,f=int,f2=False):
    assert(-1<k)
    m=self.length
    if m==0 or m<k:
      raise Exception("There is no input!")
    elif f!=str:
      if k==0:
        self.length=0
        return list(map(f,self.l[::-1]))
      if k==1 and not f2:
        self.length-=1
        return f(self.l.pop())
      if k==1 and f2:
        self.length-=1
        return [f(self.l.pop())]
      ret=[]
      for _ in [0]*k:
        ret.append(f(self.l.pop()))
      self.length-=k
      return ret
    else:
      if k==0:
        self.length=0
        return self.l[::-1]
      if k==1 and not f2:
        self.length-=1
        return self.l.pop()
      if k==1 and f2:
        self.length-=1
        return [self.l.pop()]
      ret=[]
      for _ in [0]*k:
        ret.append(self.l.pop())
      self.length-=k
      return ret
pin=INPUT().stream

"""
pin(number[default:1],f[default:int],f2[default:False])
if number==0 -> return left all
listを変数で受け取るとき、必ずlistをTrueにすること。
"""
from collections import Counter
def main():
  N,Q=pin(2)
  S=list(pin(1,str))
  d=Counter()
  for _ in [0]*Q:
    L,R,X=pin(3)
    #print(L,R,X)
    if d[(L,R)]==0:
      d[(L,R)]=sorted(S[L-1:R])
    print(d[(L,R)][X-1])
  return
main()
0