結果
| 問題 |
No.1471 Sort Queries
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2021-04-09 22:52:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 537 bytes |
| コンパイル時間 | 2,092 ms |
| コンパイル使用メモリ | 197,380 KB |
| 最終ジャッジ日時 | 2025-01-20 15:02:32 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,q;
string s;
cin>>n>>q>>s;
vector<vector<int>> A(n+1,vector<int> (26));
rep(i,n){
rep(j,26) A[i+1][j]=A[i][j];
A[i+1][s[i]-'a']++;
}
while(q--){
int l,r,x;
cin>>l>>r>>x;
l--;
int cnt=0;
rep(i,26){
cnt+=A[r][i]-A[l][i];
if(cnt>=x){
cout<<char(i+'a')<<endl;
break;
}
}
}
return 0;
}
umezo