結果

問題 No.1471 Sort Queries
ユーザー Fu_LFu_L
提出日時 2021-04-15 22:07:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 789 bytes
コンパイル時間 4,203 ms
コンパイル使用メモリ 260,752 KB
実行使用メモリ 7,600 KB
最終ジャッジ日時 2023-09-15 00:10:26
合計ジャッジ時間 7,822 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 6 ms
4,516 KB
testcase_14 AC 6 ms
4,420 KB
testcase_15 AC 9 ms
4,628 KB
testcase_16 AC 6 ms
4,376 KB
testcase_17 AC 5 ms
4,552 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 6 ms
4,376 KB
testcase_20 AC 9 ms
4,456 KB
testcase_21 AC 6 ms
4,456 KB
testcase_22 AC 5 ms
4,388 KB
testcase_23 AC 12 ms
5,388 KB
testcase_24 AC 11 ms
5,268 KB
testcase_25 AC 16 ms
5,380 KB
testcase_26 AC 12 ms
4,756 KB
testcase_27 AC 13 ms
7,544 KB
testcase_28 AC 14 ms
7,548 KB
testcase_29 AC 12 ms
4,812 KB
testcase_30 AC 11 ms
5,216 KB
testcase_31 AC 16 ms
5,144 KB
testcase_32 AC 18 ms
4,684 KB
testcase_33 AC 19 ms
7,464 KB
testcase_34 AC 19 ms
7,484 KB
testcase_35 AC 19 ms
7,476 KB
testcase_36 AC 18 ms
7,600 KB
testcase_37 AC 19 ms
7,472 KB
testcase_38 AC 18 ms
7,596 KB
testcase_39 AC 19 ms
7,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<ll,ll> P;
typedef modint998244353 mint;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
const ll inf=1e18;
ll n,q;
string s;
ll l,r,x;
ll c[100005][30];
ll cnt[30];
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>n>>q>>s;
    rep(i,0,n){
        rep(j,0,30){
            c[i+1][j]=c[i][j];
        }
        c[i+1][s[i]-'a']++;
    }
    while(q--){
        cin>>l>>r>>x;
        l--;
        ll cur=0;
        rep(i,0,30){
            cnt[i]=c[r][i]-c[l][i];
            cur+=cnt[i];
            if(cur>=x){
                cout<<char('a'+i)<<endl;
                break;
            }
        }
    }

}
0