結果
問題 | No.1471 Sort Queries |
ユーザー | momoyuu |
提出日時 | 2022-08-03 17:18:33 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 172 ms / 2,000 ms |
コード長 | 797 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 82,460 KB |
実行使用メモリ | 86,656 KB |
最終ジャッジ日時 | 2024-09-13 10:33:37 |
合計ジャッジ時間 | 6,636 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
52,096 KB |
testcase_01 | AC | 39 ms
52,224 KB |
testcase_02 | AC | 41 ms
52,096 KB |
testcase_03 | AC | 52 ms
61,696 KB |
testcase_04 | AC | 49 ms
60,800 KB |
testcase_05 | AC | 46 ms
59,008 KB |
testcase_06 | AC | 40 ms
52,224 KB |
testcase_07 | AC | 50 ms
61,952 KB |
testcase_08 | AC | 53 ms
62,080 KB |
testcase_09 | AC | 48 ms
60,160 KB |
testcase_10 | AC | 40 ms
52,096 KB |
testcase_11 | AC | 46 ms
59,392 KB |
testcase_12 | AC | 54 ms
62,336 KB |
testcase_13 | AC | 113 ms
77,736 KB |
testcase_14 | AC | 109 ms
77,568 KB |
testcase_15 | AC | 120 ms
77,312 KB |
testcase_16 | AC | 105 ms
77,696 KB |
testcase_17 | AC | 108 ms
77,952 KB |
testcase_18 | AC | 106 ms
78,524 KB |
testcase_19 | AC | 106 ms
77,312 KB |
testcase_20 | AC | 119 ms
77,184 KB |
testcase_21 | AC | 108 ms
77,772 KB |
testcase_22 | AC | 117 ms
77,952 KB |
testcase_23 | AC | 145 ms
83,968 KB |
testcase_24 | AC | 140 ms
84,368 KB |
testcase_25 | AC | 156 ms
84,812 KB |
testcase_26 | AC | 140 ms
82,048 KB |
testcase_27 | AC | 154 ms
85,888 KB |
testcase_28 | AC | 155 ms
86,016 KB |
testcase_29 | AC | 140 ms
82,304 KB |
testcase_30 | AC | 140 ms
84,208 KB |
testcase_31 | AC | 153 ms
83,968 KB |
testcase_32 | AC | 146 ms
82,176 KB |
testcase_33 | AC | 161 ms
86,144 KB |
testcase_34 | AC | 172 ms
86,400 KB |
testcase_35 | AC | 171 ms
86,272 KB |
testcase_36 | AC | 159 ms
86,656 KB |
testcase_37 | AC | 158 ms
86,656 KB |
testcase_38 | AC | 151 ms
84,608 KB |
testcase_39 | AC | 157 ms
86,144 KB |
ソースコード
N, Q = map(int,input().split()) S = input() lrx = [list(map(int,input().split( ))) for _ in range(Q)] cs = { "a":1,"b":2,"c":3,"d":4,"e":5, "f":6,"g":7,"h":8,"i":9,"j":10, "k":11,"l":12,"m":13,"n":14,"o":15, "p":16,"q":17,"r":18,"s":19,"t":20, "u":21,"v":22,"w":23,"x":24,"y":25, "z":26} for i in cs: cs[i] = 0 al = "abcdefghijklmnopqrstuvwxyz" sum = [{} for _ in range(N+1)] for i in range(N+1): for j in cs: sum[i][j] = 0 if i == 0: continue for j in cs: sum[i][j] = sum[i-1][j] sum[i][S[i-1]] += 1 for i in range(Q): l,r,x = lrx[i] for j in cs: cs[j] = sum[r][j] - sum[l-1][j] now = 0 for j in range(len(al)): now += cs[al[j]] if now >= x: print(al[j]) break