結果
問題 |
No.1471 Sort Queries
|
ユーザー |
👑 |
提出日時 | 2022-01-18 04:17:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 114 ms / 2,000 ms |
コード長 | 383 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 82,344 KB |
実行使用メモリ | 79,616 KB |
最終ジャッジ日時 | 2024-11-23 13:14:19 |
合計ジャッジ時間 | 4,926 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
n, Q = map(int, input().split()) S = input() cnt = [[0] * 26 for _ in range(n + 1)] for i, s in enumerate(S, 1): cnt[i] = cnt[i - 1].copy() cnt[i][ord(s) - 97] += 1 for _ in range(Q): l, r, x = map(int, input().split()) tot = 0 for i in range(26): tot += cnt[r][i] - cnt[l - 1][i] if tot >= x: print(chr(i + 97)) break