結果
問題 | No.854 公平なりんご分配 |
ユーザー | tenten |
提出日時 | 2020-12-16 09:34:48 |
言語 | Java21 (openjdk 21) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,532 bytes |
コンパイル時間 | 3,935 ms |
コンパイル使用メモリ | 86,948 KB |
実行使用メモリ | 568,780 KB |
最終ジャッジ日時 | 2023-10-20 09:02:39 |
合計ジャッジ時間 | 107,302 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 127 ms
57,580 KB |
testcase_01 | AC | 118 ms
56,236 KB |
testcase_02 | AC | 131 ms
57,636 KB |
testcase_03 | AC | 138 ms
57,516 KB |
testcase_04 | AC | 127 ms
57,272 KB |
testcase_05 | AC | 130 ms
57,704 KB |
testcase_06 | AC | 127 ms
57,492 KB |
testcase_07 | AC | 128 ms
57,460 KB |
testcase_08 | AC | 129 ms
57,308 KB |
testcase_09 | AC | 129 ms
57,552 KB |
testcase_10 | AC | 126 ms
57,260 KB |
testcase_11 | AC | 129 ms
57,692 KB |
testcase_12 | AC | 140 ms
57,748 KB |
testcase_13 | AC | 138 ms
57,676 KB |
testcase_14 | AC | 131 ms
57,756 KB |
testcase_15 | AC | 140 ms
57,756 KB |
testcase_16 | AC | 139 ms
57,696 KB |
testcase_17 | AC | 146 ms
57,772 KB |
testcase_18 | AC | 139 ms
57,624 KB |
testcase_19 | AC | 141 ms
57,716 KB |
testcase_20 | AC | 139 ms
57,568 KB |
testcase_21 | AC | 138 ms
57,544 KB |
testcase_22 | AC | 219 ms
59,968 KB |
testcase_23 | AC | 215 ms
60,504 KB |
testcase_24 | AC | 254 ms
64,960 KB |
testcase_25 | AC | 212 ms
59,944 KB |
testcase_26 | AC | 255 ms
65,380 KB |
testcase_27 | AC | 236 ms
62,884 KB |
testcase_28 | AC | 219 ms
59,940 KB |
testcase_29 | AC | 200 ms
60,008 KB |
testcase_30 | AC | 201 ms
59,968 KB |
testcase_31 | AC | 250 ms
63,080 KB |
testcase_32 | MLE | - |
testcase_33 | AC | 1,584 ms
209,988 KB |
testcase_34 | MLE | - |
testcase_35 | MLE | - |
testcase_36 | AC | 560 ms
73,108 KB |
testcase_37 | AC | 1,961 ms
312,596 KB |
testcase_38 | AC | 1,724 ms
309,356 KB |
testcase_39 | MLE | - |
testcase_40 | AC | 1,619 ms
202,928 KB |
testcase_41 | AC | 1,791 ms
312,692 KB |
testcase_42 | MLE | - |
testcase_43 | MLE | - |
testcase_44 | MLE | - |
testcase_45 | AC | 1,118 ms
148,896 KB |
testcase_46 | MLE | - |
testcase_47 | AC | 1,686 ms
297,992 KB |
testcase_48 | MLE | - |
testcase_49 | MLE | - |
testcase_50 | AC | 1,759 ms
309,968 KB |
testcase_51 | MLE | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | MLE | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | MLE | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | MLE | - |
testcase_75 | WA | - |
testcase_76 | MLE | - |
testcase_77 | MLE | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | MLE | - |
testcase_81 | WA | - |
testcase_82 | TLE | - |
testcase_83 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
testcase_87 | -- | - |
testcase_88 | -- | - |
testcase_89 | -- | - |
testcase_90 | -- | - |
testcase_91 | -- | - |
testcase_92 | -- | - |
testcase_93 | -- | - |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList<HashMap<Integer, Integer>> apples = new ArrayList<>(); apples.add(new HashMap<>()); for (int i = 0; i < n; i++) { HashMap<Integer, Integer> tmp = new HashMap<Integer, Integer>(apples.get(i)); int x = sc.nextInt(); for (int j = 2; j <= Math.sqrt(x); j++) { while (x % j == 0) { tmp.put(j, tmp.getOrDefault(j, 0) + 1); x /= j; } } if (x > 1) { tmp.put(x, tmp.getOrDefault(x, 0) + 1); } apples.add(tmp); } int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int p = sc.nextInt(); HashMap<Integer, Integer> left = apples.get(sc.nextInt() - 1); HashMap<Integer, Integer> right = apples.get(sc.nextInt()); boolean can = true; for (int j = 2; j <= Math.sqrt(p) && can; j++) { if (p % j > 0) { continue; } int count = right.getOrDefault(j, 0) - left.getOrDefault(j, 0); while (p % j == 0) { count--; p /= j; } can = (count >= 0); } if (can && p > 1) { can = (right.getOrDefault(p, 0) - left.getOrDefault(p, 0) >= 1); } if (can) { sb.append("Yes"); } else { sb.append("NO"); } sb.append("\n"); } System.out.print(sb); } }