結果

問題 No.1471 Sort Queries
ユーザー chocoruskchocorusk
提出日時 2021-04-09 21:29:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 1,267 bytes
コンパイル時間 3,286 ms
コンパイル使用メモリ 187,120 KB
実行使用メモリ 5,720 KB
最終ジャッジ日時 2023-09-07 09:56:41
合計ジャッジ時間 5,216 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,532 KB
testcase_01 AC 3 ms
5,448 KB
testcase_02 AC 3 ms
5,400 KB
testcase_03 AC 3 ms
5,472 KB
testcase_04 AC 3 ms
5,556 KB
testcase_05 AC 3 ms
5,444 KB
testcase_06 AC 3 ms
5,416 KB
testcase_07 AC 4 ms
5,460 KB
testcase_08 AC 3 ms
5,480 KB
testcase_09 AC 3 ms
5,416 KB
testcase_10 AC 3 ms
5,472 KB
testcase_11 AC 3 ms
5,684 KB
testcase_12 AC 3 ms
5,428 KB
testcase_13 AC 8 ms
5,460 KB
testcase_14 AC 8 ms
5,484 KB
testcase_15 AC 12 ms
5,668 KB
testcase_16 AC 9 ms
5,404 KB
testcase_17 AC 7 ms
5,496 KB
testcase_18 AC 6 ms
5,676 KB
testcase_19 AC 9 ms
5,476 KB
testcase_20 AC 12 ms
5,544 KB
testcase_21 AC 8 ms
5,704 KB
testcase_22 AC 7 ms
5,676 KB
testcase_23 AC 15 ms
5,452 KB
testcase_24 AC 14 ms
5,488 KB
testcase_25 AC 20 ms
5,472 KB
testcase_26 AC 16 ms
5,480 KB
testcase_27 AC 16 ms
5,460 KB
testcase_28 AC 17 ms
5,472 KB
testcase_29 AC 15 ms
5,492 KB
testcase_30 AC 14 ms
5,484 KB
testcase_31 AC 22 ms
5,452 KB
testcase_32 AC 23 ms
5,476 KB
testcase_33 AC 23 ms
5,444 KB
testcase_34 AC 24 ms
5,720 KB
testcase_35 AC 24 ms
5,440 KB
testcase_36 AC 24 ms
5,556 KB
testcase_37 AC 24 ms
5,476 KB
testcase_38 AC 23 ms
5,428 KB
testcase_39 AC 23 ms
5,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n, q; cin>>n>>q;
    string s; cin>>s;
    int c[26][10010]={}, d[26][10010]={};
    for(int i=0; i<n; i++){
        c[s[i]-'a'][i]++;
    }
    for(int i=0; i<26; i++){
        for(int j=0; j<n; j++){
            d[i][j+1]=d[i][j]+c[i][j];
        }
    }
    for(int i=0; i<q; i++){
        int l, r, x;
        cin>>l>>r>>x;
        l--; x--;
        int e[26];
        for(int j=0; j<26; j++){
            e[j]=d[j][r]-d[j][l];
        }
        int f=0;
        for(int j=0; j<26; j++){
            f+=e[j];
            if(f>x){
                cout<<(char)('a'+j)<<endl;
                break;
            }
        }
    }
    return 0;
}
0