結果
問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
ユーザー | htensai |
提出日時 | 2020-02-06 10:29:34 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,268 bytes |
コンパイル時間 | 1,967 ms |
コンパイル使用メモリ | 77,796 KB |
実行使用メモリ | 62,128 KB |
最終ジャッジ日時 | 2023-10-25 09:36:42 |
合計ジャッジ時間 | 16,670 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 124 ms
57,448 KB |
testcase_13 | AC | 125 ms
57,496 KB |
testcase_14 | AC | 126 ms
57,640 KB |
testcase_15 | AC | 128 ms
57,428 KB |
testcase_16 | AC | 122 ms
57,512 KB |
testcase_17 | AC | 281 ms
62,128 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 141 ms
57,720 KB |
testcase_24 | AC | 145 ms
57,712 KB |
testcase_25 | AC | 143 ms
57,672 KB |
testcase_26 | AC | 144 ms
57,672 KB |
testcase_27 | AC | 135 ms
57,680 KB |
testcase_28 | AC | 150 ms
57,660 KB |
testcase_29 | AC | 156 ms
57,648 KB |
testcase_30 | AC | 147 ms
57,676 KB |
testcase_31 | AC | 136 ms
57,768 KB |
testcase_32 | AC | 152 ms
57,588 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | AC | 123 ms
57,376 KB |
testcase_59 | AC | 123 ms
57,440 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] arr = sc.next().toCharArray(); int[] eSums = new int[n + 1]; int[] sSums = new int[n + 1]; for (int i = 1; i <= n; i++) { eSums[i] = eSums[i - 1]; if (arr[i - 1] == 'E') { eSums[i]++; } sSums[i] = sSums[i - 1]; sSums[i] += sc.nextInt(); } int max = eSums[n]; int[] scores = new int[max + 1]; Arrays.fill(scores, Integer.MAX_VALUE); scores[0] = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j <= n; j++) { int count = eSums[j] - eSums[i]; scores[count] = Math.min(scores[count], sSums[j] - sSums[i]); } } int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int x = sc.nextInt(); int idx = 0; while (idx < max && scores[idx + 1] <= x) { idx++; } sb.append(idx).append("\n"); } System.out.print(sb); } }