結果
問題 | No.5018 Let's Make a Best-seller Book |
ユーザー | EvbCFfp1XB |
提出日時 | 2023-10-01 14:37:40 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 267 ms / 400 ms |
コード長 | 2,974 bytes |
コンパイル時間 | 5,309 ms |
コンパイル使用メモリ | 83,784 KB |
実行使用メモリ | 75,560 KB |
スコア | 100 |
平均クエリ数 | 52.00 |
最終ジャッジ日時 | 2023-10-01 14:38:18 |
合計ジャッジ時間 | 35,628 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 244 ms
72,108 KB |
testcase_01 | AC | 238 ms
75,196 KB |
testcase_02 | AC | 235 ms
74,444 KB |
testcase_03 | AC | 235 ms
75,172 KB |
testcase_04 | AC | 244 ms
74,440 KB |
testcase_05 | AC | 233 ms
75,448 KB |
testcase_06 | AC | 234 ms
74,720 KB |
testcase_07 | AC | 237 ms
73,988 KB |
testcase_08 | AC | 260 ms
74,624 KB |
testcase_09 | AC | 235 ms
75,120 KB |
testcase_10 | AC | 235 ms
74,636 KB |
testcase_11 | AC | 238 ms
74,780 KB |
testcase_12 | AC | 260 ms
74,656 KB |
testcase_13 | AC | 239 ms
74,748 KB |
testcase_14 | AC | 228 ms
75,296 KB |
testcase_15 | AC | 238 ms
75,088 KB |
testcase_16 | AC | 233 ms
74,984 KB |
testcase_17 | AC | 249 ms
74,952 KB |
testcase_18 | AC | 233 ms
74,992 KB |
testcase_19 | AC | 236 ms
75,336 KB |
testcase_20 | AC | 237 ms
74,956 KB |
testcase_21 | AC | 262 ms
74,844 KB |
testcase_22 | AC | 237 ms
74,540 KB |
testcase_23 | AC | 235 ms
75,216 KB |
testcase_24 | AC | 240 ms
74,792 KB |
testcase_25 | AC | 242 ms
74,568 KB |
testcase_26 | AC | 234 ms
74,920 KB |
testcase_27 | AC | 241 ms
75,020 KB |
testcase_28 | AC | 237 ms
75,232 KB |
testcase_29 | AC | 238 ms
73,040 KB |
testcase_30 | AC | 260 ms
74,452 KB |
testcase_31 | AC | 240 ms
75,416 KB |
testcase_32 | AC | 238 ms
72,736 KB |
testcase_33 | AC | 239 ms
74,132 KB |
testcase_34 | AC | 264 ms
74,208 KB |
testcase_35 | AC | 234 ms
74,756 KB |
testcase_36 | AC | 233 ms
74,704 KB |
testcase_37 | AC | 237 ms
75,060 KB |
testcase_38 | AC | 260 ms
75,504 KB |
testcase_39 | AC | 237 ms
74,380 KB |
testcase_40 | AC | 234 ms
74,640 KB |
testcase_41 | AC | 237 ms
74,624 KB |
testcase_42 | AC | 239 ms
74,640 KB |
testcase_43 | AC | 265 ms
74,828 KB |
testcase_44 | AC | 238 ms
74,844 KB |
testcase_45 | AC | 239 ms
74,628 KB |
testcase_46 | AC | 245 ms
74,884 KB |
testcase_47 | AC | 260 ms
75,560 KB |
testcase_48 | AC | 242 ms
75,464 KB |
testcase_49 | AC | 240 ms
74,652 KB |
testcase_50 | AC | 243 ms
74,908 KB |
testcase_51 | AC | 258 ms
74,728 KB |
testcase_52 | AC | 238 ms
74,756 KB |
testcase_53 | AC | 227 ms
74,880 KB |
testcase_54 | AC | 248 ms
75,336 KB |
testcase_55 | AC | 238 ms
74,848 KB |
testcase_56 | AC | 244 ms
74,184 KB |
testcase_57 | AC | 245 ms
74,584 KB |
testcase_58 | AC | 238 ms
74,740 KB |
testcase_59 | AC | 241 ms
74,336 KB |
testcase_60 | AC | 253 ms
74,588 KB |
testcase_61 | AC | 262 ms
75,328 KB |
testcase_62 | AC | 240 ms
74,940 KB |
testcase_63 | AC | 246 ms
74,816 KB |
testcase_64 | AC | 260 ms
75,068 KB |
testcase_65 | AC | 240 ms
74,652 KB |
testcase_66 | AC | 237 ms
74,796 KB |
testcase_67 | AC | 233 ms
74,788 KB |
testcase_68 | AC | 244 ms
74,796 KB |
testcase_69 | AC | 240 ms
74,476 KB |
testcase_70 | AC | 237 ms
73,388 KB |
testcase_71 | AC | 236 ms
74,600 KB |
testcase_72 | AC | 245 ms
74,960 KB |
testcase_73 | AC | 255 ms
74,668 KB |
testcase_74 | AC | 234 ms
74,948 KB |
testcase_75 | AC | 238 ms
72,764 KB |
testcase_76 | AC | 242 ms
74,800 KB |
testcase_77 | AC | 248 ms
75,188 KB |
testcase_78 | AC | 239 ms
74,976 KB |
testcase_79 | AC | 240 ms
75,176 KB |
testcase_80 | AC | 235 ms
75,396 KB |
testcase_81 | AC | 250 ms
74,740 KB |
testcase_82 | AC | 236 ms
74,860 KB |
testcase_83 | AC | 239 ms
74,616 KB |
testcase_84 | AC | 235 ms
74,328 KB |
testcase_85 | AC | 235 ms
74,344 KB |
testcase_86 | AC | 267 ms
75,052 KB |
testcase_87 | AC | 235 ms
74,436 KB |
testcase_88 | AC | 234 ms
75,024 KB |
testcase_89 | AC | 234 ms
75,180 KB |
testcase_90 | AC | 267 ms
73,016 KB |
testcase_91 | AC | 235 ms
74,752 KB |
testcase_92 | AC | 232 ms
75,052 KB |
testcase_93 | AC | 238 ms
74,984 KB |
testcase_94 | AC | 241 ms
74,572 KB |
testcase_95 | AC | 236 ms
74,924 KB |
testcase_96 | AC | 241 ms
73,472 KB |
testcase_97 | AC | 239 ms
74,868 KB |
testcase_98 | AC | 240 ms
75,012 KB |
testcase_99 | AC | 255 ms
74,556 KB |
ソースコード
import java.util.Scanner; import java.util.SplittableRandom; import java.util.stream.IntStream; public class Main { public static void main(String[] args) throws Exception { new Main().run(); } private void run() { try (final Scanner in = new Scanner(System.in)) { int T = in.nextInt(); int N = in.nextInt(); int Money = in.nextInt(); SplittableRandom rng = new SplittableRandom(System.nanoTime()); double[][] rand = new double[T][N]; for (int t = 0; t < T; t++) { for (int n = 0; n < N; n++) { rand[t][n] = 1;// 0.75 + 0.5 * rng.nextDouble(); } } double[] D = IntStream.range(0, N).mapToDouble(i -> 1.0).toArray(); double[] minD = IntStream.range(0, N).mapToDouble(i -> 0.5).toArray(); double[] maxD = IntStream.range(0, N).mapToDouble(i -> 1.5).toArray(); int[] S = IntStream.range(0, N).map(i -> 0).toArray(); int[] P = IntStream.range(0, N).map(i -> 0).toArray(); int[] R = IntStream.range(0, N).map(i -> 0).toArray(); for (int t = 0; t < T; t++) { if (t == 0) { StringBuilder sb = new StringBuilder(); sb.append(1); for (int n = 0; n < N; n++) { sb.append(" "); sb.append(10); } System.out.println(sb.toString()); System.out.flush(); } else if (t % 2 == 1) { int y = 0; for (int x = 1; x <= 5; x++) { if (500000 << x <= Money) { y = x; } } if (y == 0) { book(N, rand, D, P, R, t); } else { cm(y); } } else { book(N, rand, D, P, R, t); } Money = in.nextInt(); if (Money < 0) { return; } S = IntStream.range(0, N).map(i -> in.nextInt()).toArray(); for (int n = 0; n < N; n++) { minD[n] = Math.max(minD[n], (S[n] + 0.000000) / (Math.pow(R[n], 0.5) * Math.pow(1.05, P[n]) * 1.25)); maxD[n] = Math.min(maxD[n], (S[n] + 0.999999) / (Math.pow(R[n], 0.5) * Math.pow(1.05, P[n]) * 0.75)); D[n] = (minD[n] + maxD[n]) * 0.5; } P = IntStream.range(0, N).map(i -> in.nextInt()).toArray(); R = IntStream.range(0, N).map(i -> in.nextInt()).toArray(); } } catch (Exception e) { e.printStackTrace(); } } private void cm(int y) { StringBuilder sb = new StringBuilder(); sb.append(2); sb.append(" "); sb.append(y); System.out.println(sb.toString()); System.out.flush(); } private void book(int N, double[][] rand, double[] D, int[] P, int[] R, int t) { int[] copies = new int[N]; for (int n = 0; n < N; n++) { copies[n] = numberCopiesSoldInWeek(D[n], P[n], R[n], rand[t][n]); } StringBuilder sb = new StringBuilder(); sb.append(1); for (int n = 0; n < N; n++) { sb.append(" "); if (copies[n] > R[n]) { sb.append(copies[n] - R[n]); } else { sb.append(0); } } System.out.println(sb.toString()); System.out.flush(); } private int numberCopiesSoldInWeek(double D, int P, int R, double rand) { return (int) Math.min(R, Math.pow(R, 0.5) * Math.pow(1.05, P) * D * rand); } }