結果
問題 | No.1471 Sort Queries |
ユーザー |
![]() |
提出日時 | 2020-11-23 22:50:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 167,100 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-15 22:04:17 |
合計ジャッジ時間 | 3,295 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define fi first #define se second int main(){ int n,q; string s; cin>>n>>q>>s; int count[n+1][26]={}; for(int i=0;i<n;i++){ for(int j=0;j<26;j++){ count[i+1][j]=count[i][j]; } count[i+1][s[i]-'a']++; } while(q--){ int l,r,x; cin>>l>>r>>x; int p=0; for(int i=0;i<26;i++){ if(p+count[r][i]-count[l-1][i]>=x){ cout<<(char)('a'+i)<<endl; break; } p+=count[r][i]-count[l-1][i]; } } }