結果

問題 No.1471 Sort Queries
ユーザー abc3abc3
提出日時 2021-04-09 23:23:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 1,061 bytes
コンパイル時間 2,604 ms
コンパイル使用メモリ 203,428 KB
実行使用メモリ 15,296 KB
最終ジャッジ日時 2023-09-07 13:12:59
合計ジャッジ時間 4,663 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 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,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 11 ms
8,992 KB
testcase_14 AC 11 ms
8,264 KB
testcase_15 AC 16 ms
8,440 KB
testcase_16 AC 8 ms
4,676 KB
testcase_17 AC 9 ms
8,564 KB
testcase_18 AC 8 ms
8,048 KB
testcase_19 AC 9 ms
5,200 KB
testcase_20 AC 15 ms
8,784 KB
testcase_21 AC 10 ms
8,132 KB
testcase_22 AC 9 ms
8,040 KB
testcase_23 AC 22 ms
12,696 KB
testcase_24 AC 21 ms
12,668 KB
testcase_25 AC 28 ms
13,364 KB
testcase_26 AC 21 ms
10,072 KB
testcase_27 AC 26 ms
15,188 KB
testcase_28 AC 26 ms
14,876 KB
testcase_29 AC 21 ms
10,388 KB
testcase_30 AC 21 ms
12,452 KB
testcase_31 AC 27 ms
11,852 KB
testcase_32 AC 28 ms
9,944 KB
testcase_33 AC 33 ms
15,256 KB
testcase_34 AC 35 ms
15,288 KB
testcase_35 AC 34 ms
15,296 KB
testcase_36 AC 32 ms
15,256 KB
testcase_37 AC 33 ms
15,292 KB
testcase_38 AC 33 ms
15,292 KB
testcase_39 AC 33 ms
15,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<int,int>;
    const int INF=1001001001;
    const int mod=1e9+7;
    
    int main(){
      int n,q;
      string s;
      cin>>n>>q>>s;
      vector<vector<int>>sum(n+1,vector<int>(300));
      rep(i,n){
        for(char c='a';c<='z';c++){
          sum[i+1][c]+=sum[i][c]+(c==s[i]);
        }
      }
      rep(i,q){
        int l,r,x;
        cin>>l>>r>>x;
        l--;
        int now=x;
        for(char c='a';c<='z';c++){
          int res=sum[r][c]-sum[l][c];
          now-=res;
          if(now<=0){
            cout<<c<<endl;
            break;
          }
        }
      }
      return 0;
    }
0