結果
問題 |
No.1471 Sort Queries
|
ユーザー |
![]() |
提出日時 | 2021-04-09 23:37:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 117 ms / 2,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 1,033 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 78,908 KB |
最終ジャッジ日時 | 2024-06-25 12:18:38 |
合計ジャッジ時間 | 4,441 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
N,Q = map(int,input().split()) S = str(input()) SA = [] for i in range(26): s_temp = [0] moji = chr(i+97) for j in range(N): if S[j] == moji: temp = s_temp[-1] + 1 else: temp = s_temp[-1] s_temp.append(temp) SA.append(s_temp) #print(SA) for i in range(Q): l,r,x = map(int,input().split()) l-=1;r-=1 cnt = 0 for j in range(26): temp = SA[j][r+1] - SA[j][l] cnt += temp if cnt >= x: ans = chr(j+97) break print(ans)