結果

問題 No.733 分身並列コーディング
ユーザー tentententen
提出日時 2020-10-16 11:46:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,056 bytes
コンパイル時間 3,197 ms
コンパイル使用メモリ 75,268 KB
実行使用メモリ 57,800 KB
最終ジャッジ日時 2023-09-28 01:51:24
合計ジャッジ時間 11,892 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,080 KB
testcase_01 AC 117 ms
55,780 KB
testcase_02 AC 116 ms
56,172 KB
testcase_03 AC 118 ms
55,924 KB
testcase_04 AC 117 ms
55,856 KB
testcase_05 AC 114 ms
56,000 KB
testcase_06 AC 114 ms
55,944 KB
testcase_07 AC 112 ms
56,032 KB
testcase_08 AC 113 ms
55,600 KB
testcase_09 AC 114 ms
56,188 KB
testcase_10 AC 112 ms
55,724 KB
testcase_11 AC 117 ms
56,420 KB
testcase_12 AC 114 ms
55,780 KB
testcase_13 AC 113 ms
56,176 KB
testcase_14 AC 114 ms
56,184 KB
testcase_15 AC 115 ms
55,708 KB
testcase_16 AC 116 ms
55,856 KB
testcase_17 AC 115 ms
56,068 KB
testcase_18 AC 119 ms
55,756 KB
testcase_19 AC 121 ms
55,572 KB
testcase_20 AC 114 ms
53,936 KB
testcase_21 AC 113 ms
55,952 KB
testcase_22 AC 114 ms
55,916 KB
testcase_23 AC 115 ms
55,952 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 113 ms
56,052 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        int left = 0;
        int right = n;
        while (right - left > 1) {
            int m = (left + right) / 2;
            PriorityQueue<Integer> queue = new PriorityQueue<>();
            for (int i = 0; i < m; i++) {
                queue.add(-t);
            }
            boolean flag = true;
            for (int i = n - 1; i >= 0; i--) {
                int x = queue.poll();
                if (x + arr[i] > 0) {
                    flag = false;
                    break;
                }
                queue.add(x + arr[i]);
            }
            if (flag) {
                right = m;
            } else {
                left = m;
            }
        }
        System.out.print(right);
    }
} 
0