結果

問題 No.1471 Sort Queries
ユーザー saxofone111saxofone111
提出日時 2021-04-11 11:33:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 1,105 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 203,168 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 14:20:24
合計ジャッジ時間 5,046 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 9 ms
4,376 KB
testcase_14 AC 9 ms
4,380 KB
testcase_15 AC 15 ms
4,376 KB
testcase_16 AC 9 ms
4,376 KB
testcase_17 AC 8 ms
4,380 KB
testcase_18 AC 6 ms
4,376 KB
testcase_19 AC 9 ms
4,376 KB
testcase_20 AC 16 ms
4,376 KB
testcase_21 AC 9 ms
4,376 KB
testcase_22 AC 8 ms
4,376 KB
testcase_23 AC 20 ms
4,380 KB
testcase_24 AC 20 ms
4,376 KB
testcase_25 AC 31 ms
4,380 KB
testcase_26 AC 23 ms
4,376 KB
testcase_27 AC 24 ms
4,376 KB
testcase_28 AC 24 ms
4,380 KB
testcase_29 AC 22 ms
4,380 KB
testcase_30 AC 20 ms
4,376 KB
testcase_31 AC 32 ms
4,376 KB
testcase_32 AC 34 ms
4,376 KB
testcase_33 AC 33 ms
4,376 KB
testcase_34 AC 38 ms
4,380 KB
testcase_35 AC 38 ms
4,376 KB
testcase_36 AC 24 ms
4,376 KB
testcase_37 AC 25 ms
4,376 KB
testcase_38 AC 24 ms
4,380 KB
testcase_39 AC 27 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, Q;
  string S;
  cin >> N >> Q;
  cin >> S;
  vector<llvec> loc(26);
  rep(i, N){
    loc[S[i]-'a'].push_back(i+1);
  }

  while(Q--){
    ll l, r, x;
    cin >> l >> r >> x;
    ll cnt = 0;
    rep(k, 26){
      cnt += upper_bound(ALL(loc[k]), r) - lower_bound(ALL(loc[k]), l);
      if(cnt>=x){
        cout << (char)('a'+k)<<endl;
        break;
      }
    }
  }
  
  return 0;
}
0