結果
問題 | No.854 公平なりんご分配 |
ユーザー | tenten |
提出日時 | 2020-12-16 10:10:03 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,568 bytes |
コンパイル時間 | 2,143 ms |
コンパイル使用メモリ | 76,972 KB |
実行使用メモリ | 259,512 KB |
最終ジャッジ日時 | 2024-09-20 04:35:17 |
合計ジャッジ時間 | 59,245 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 124 ms
54,008 KB |
testcase_01 | AC | 124 ms
53,684 KB |
testcase_02 | AC | 124 ms
53,880 KB |
testcase_03 | AC | 128 ms
53,900 KB |
testcase_04 | AC | 126 ms
53,712 KB |
testcase_05 | AC | 127 ms
53,992 KB |
testcase_06 | AC | 125 ms
53,660 KB |
testcase_07 | AC | 130 ms
53,956 KB |
testcase_08 | AC | 129 ms
54,160 KB |
testcase_09 | AC | 123 ms
53,772 KB |
testcase_10 | AC | 130 ms
54,080 KB |
testcase_11 | AC | 125 ms
53,976 KB |
testcase_12 | AC | 132 ms
54,012 KB |
testcase_13 | AC | 132 ms
53,972 KB |
testcase_14 | AC | 126 ms
53,672 KB |
testcase_15 | AC | 116 ms
52,876 KB |
testcase_16 | AC | 123 ms
54,268 KB |
testcase_17 | AC | 135 ms
54,036 KB |
testcase_18 | AC | 137 ms
54,136 KB |
testcase_19 | AC | 128 ms
53,764 KB |
testcase_20 | AC | 129 ms
54,024 KB |
testcase_21 | AC | 129 ms
53,964 KB |
testcase_22 | AC | 203 ms
57,024 KB |
testcase_23 | AC | 195 ms
56,408 KB |
testcase_24 | AC | 213 ms
57,556 KB |
testcase_25 | AC | 188 ms
56,604 KB |
testcase_26 | AC | 216 ms
57,616 KB |
testcase_27 | AC | 200 ms
56,732 KB |
testcase_28 | AC | 212 ms
56,708 KB |
testcase_29 | AC | 176 ms
54,000 KB |
testcase_30 | AC | 193 ms
56,708 KB |
testcase_31 | AC | 212 ms
57,452 KB |
testcase_32 | AC | 455 ms
94,652 KB |
testcase_33 | AC | 531 ms
78,868 KB |
testcase_34 | AC | 704 ms
122,120 KB |
testcase_35 | AC | 585 ms
100,064 KB |
testcase_36 | AC | 522 ms
65,096 KB |
testcase_37 | AC | 446 ms
89,040 KB |
testcase_38 | AC | 380 ms
81,688 KB |
testcase_39 | AC | 843 ms
124,104 KB |
testcase_40 | AC | 559 ms
80,048 KB |
testcase_41 | AC | 582 ms
95,348 KB |
testcase_42 | AC | 654 ms
116,420 KB |
testcase_43 | AC | 832 ms
103,084 KB |
testcase_44 | AC | 817 ms
119,944 KB |
testcase_45 | AC | 908 ms
78,604 KB |
testcase_46 | AC | 949 ms
125,128 KB |
testcase_47 | AC | 532 ms
84,796 KB |
testcase_48 | AC | 617 ms
114,668 KB |
testcase_49 | AC | 589 ms
115,352 KB |
testcase_50 | AC | 425 ms
88,764 KB |
testcase_51 | AC | 903 ms
120,584 KB |
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 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | AC | 1,361 ms
258,588 KB |
testcase_84 | AC | 1,508 ms
258,756 KB |
testcase_85 | AC | 1,383 ms
257,792 KB |
testcase_86 | AC | 1,191 ms
258,028 KB |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | AC | 1,490 ms
258,580 KB |
testcase_93 | AC | 1,501 ms
257,724 KB |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); boolean[] isNotPrime = new boolean[2000]; int size = 0; for (int i = 2; i < 2000; i++) { if (!isNotPrime[i]) { size++; for (int j = 2; j * i < 2000; j++) { isNotPrime[j * i] = true; } } } int[] primes = new int[size]; int idx = 0; for (int i = 2; i < 2000; i++) { if (!isNotPrime[i]) { primes[idx] = i; idx++; } } int[][] counts = new int[n + 1][]; counts[0] = new int[size]; for (int i = 0; i < n; i++) { int x = sc.nextInt(); counts[i + 1] = (int[])counts[i].clone(); for (int j = 0; j < size && x > 1; j++) { while (x % primes[j] == 0) { counts[i + 1][j]++; x /= primes[j]; } } } int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int p = sc.nextInt(); int left = sc.nextInt() - 1; int right = sc.nextInt(); for (int j = 0; j < size && p > 1; j++) { int limit = counts[right][j] - counts[left][j]; for (int k = 0; k < limit; k++) { if (p % primes[j] == 0) { p /= primes[j]; } else { break; } } } if (p == 1) { sb.append("Yes"); } else { sb.append("NO"); } sb.append("\n"); } System.out.print(sb); } }