結果
| 問題 |
No.1471 Sort Queries
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-18 19:28:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 158 ms / 2,000 ms |
| コード長 | 470 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 82,444 KB |
| 実行使用メモリ | 86,740 KB |
| 最終ジャッジ日時 | 2024-07-04 04:48:33 |
| 合計ジャッジ時間 | 5,578 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
from collections import Counter, deque
from copy import copy
N,Q = map(int,input().split())
S = list(str(input()))
alp = list('abcdefghijklmnopqrstuvwxyz')
s = Counter(sorted(S))
C = deque([copy(s)])
for i in range(N-1,-1,-1):
s[S[i]] -= 1
C.appendleft(copy(s))
for _ in range(Q):
l,r,x = map(int,input().split())
a,b = C[l-1],C[r]
count = 0
for p in alp:
count += b[p]-a[p]
if count >= x:
print(p)
break