結果
問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
ユーザー | tenten |
提出日時 | 2020-08-26 18:58:36 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,389 bytes |
コンパイル時間 | 1,866 ms |
コンパイル使用メモリ | 78,064 KB |
実行使用メモリ | 46,552 KB |
最終ジャッジ日時 | 2024-04-25 03:38:37 |
合計ジャッジ時間 | 14,533 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | 111 ms
41,036 KB |
testcase_13 | AC | 109 ms
41,104 KB |
testcase_14 | AC | 112 ms
41,188 KB |
testcase_15 | AC | 114 ms
40,852 KB |
testcase_16 | AC | 102 ms
39,956 KB |
testcase_17 | AC | 233 ms
46,552 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 124 ms
41,280 KB |
testcase_24 | AC | 130 ms
41,652 KB |
testcase_25 | AC | 145 ms
41,152 KB |
testcase_26 | AC | 132 ms
41,460 KB |
testcase_27 | AC | 125 ms
41,356 KB |
testcase_28 | AC | 125 ms
41,684 KB |
testcase_29 | AC | 142 ms
41,320 KB |
testcase_30 | AC | 125 ms
41,236 KB |
testcase_31 | AC | 124 ms
41,572 KB |
testcase_32 | AC | 145 ms
41,640 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 | 115 ms
41,072 KB |
testcase_59 | AC | 100 ms
40,308 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[] sums = new int[n + 1]; int[] counts = new int[n + 1]; int count = 0; for (int i = 1; i <= n; i++) { sums[i] = sums[i - 1] + sc.nextInt(); if (arr[i - 1] == 'E') { count++; } counts[i] = count; } int[] mins = new int[count + 1]; Arrays.fill(mins, Integer.MAX_VALUE); mins[0] = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j <= n; j++) { int enemy = counts[j] - counts[i]; mins[enemy] = Math.min(mins[enemy], sums[j] - sums[i]); } } int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int x = sc.nextInt(); int left = 0; int right = count + 1; while (right - left > 1) { int m = (left + right) / 2; if (mins[m] <= x) { left = m; } else { right = m; } } sb.append(left).append("\n"); } System.out.print(sb); } }