結果

問題 No.1471 Sort Queries
ユーザー harurunharurun
提出日時 2021-04-09 22:13:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,285 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 80,540 KB
最終ジャッジ日時 2023-09-07 11:37:17
合計ジャッジ時間 12,152 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,424 KB
testcase_01 AC 74 ms
71,156 KB
testcase_02 AC 74 ms
71,116 KB
testcase_03 AC 75 ms
71,344 KB
testcase_04 AC 76 ms
71,504 KB
testcase_05 AC 74 ms
71,156 KB
testcase_06 AC 73 ms
71,372 KB
testcase_07 AC 75 ms
71,196 KB
testcase_08 AC 75 ms
71,404 KB
testcase_09 AC 72 ms
71,376 KB
testcase_10 AC 74 ms
71,376 KB
testcase_11 AC 74 ms
71,340 KB
testcase_12 AC 76 ms
71,412 KB
testcase_13 AC 482 ms
77,708 KB
testcase_14 AC 414 ms
78,520 KB
testcase_15 AC 706 ms
78,724 KB
testcase_16 AC 192 ms
77,804 KB
testcase_17 AC 362 ms
78,232 KB
testcase_18 AC 269 ms
78,364 KB
testcase_19 AC 233 ms
77,868 KB
testcase_20 AC 717 ms
78,504 KB
testcase_21 AC 386 ms
77,932 KB
testcase_22 AC 320 ms
77,768 KB
testcase_23 AC 1,529 ms
79,484 KB
testcase_24 AC 1,514 ms
79,376 KB
testcase_25 TLE -
testcase_26 AC 1,324 ms
79,216 KB
testcase_27 TLE -
testcase_28 TLE -
testcase_29 AC 1,312 ms
79,380 KB
testcase_30 AC 1,458 ms
79,120 KB
testcase_31 TLE -
testcase_32 AC 1,875 ms
80,540 KB
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にすること。
"""
def main():
  N,Q=pin(2)
  S=list(pin(1,str))
  for _ in [0]*Q:
    L,R,X=pin(3)
    #print(L,R,X)
    print(sorted(S[L-1:R])[X-1])
  return
main()
0