結果
問題 | No.854 公平なりんご分配 |
ユーザー | 👑 hos.lyric |
提出日時 | 2019-07-26 21:50:12 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,714 bytes |
コンパイル時間 | 700 ms |
コンパイル使用メモリ | 121,300 KB |
実行使用メモリ | 133,812 KB |
最終ジャッジ日時 | 2024-06-22 01:57:11 |
合計ジャッジ時間 | 23,630 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | AC | 1 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,940 KB |
testcase_11 | AC | 1 ms
6,940 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 2 ms
6,944 KB |
testcase_14 | AC | 2 ms
6,944 KB |
testcase_15 | AC | 1 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,944 KB |
testcase_19 | AC | 2 ms
6,940 KB |
testcase_20 | AC | 1 ms
6,944 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 3 ms
6,940 KB |
testcase_23 | AC | 4 ms
6,940 KB |
testcase_24 | AC | 7 ms
6,940 KB |
testcase_25 | AC | 3 ms
6,944 KB |
testcase_26 | AC | 7 ms
6,944 KB |
testcase_27 | AC | 5 ms
6,944 KB |
testcase_28 | AC | 3 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 3 ms
6,944 KB |
testcase_31 | AC | 6 ms
6,944 KB |
testcase_32 | AC | 73 ms
29,464 KB |
testcase_33 | AC | 80 ms
19,380 KB |
testcase_34 | AC | 197 ms
40,620 KB |
testcase_35 | AC | 118 ms
32,300 KB |
testcase_36 | AC | 60 ms
6,944 KB |
testcase_37 | AC | 71 ms
27,688 KB |
testcase_38 | AC | 52 ms
23,388 KB |
testcase_39 | AC | 348 ms
42,780 KB |
testcase_40 | AC | 98 ms
15,788 KB |
testcase_41 | AC | 110 ms
25,560 KB |
testcase_42 | AC | 165 ms
40,660 KB |
testcase_43 | AC | 199 ms
28,044 KB |
testcase_44 | AC | 231 ms
36,528 KB |
testcase_45 | AC | 155 ms
10,512 KB |
testcase_46 | AC | 320 ms
37,536 KB |
testcase_47 | AC | 79 ms
22,904 KB |
testcase_48 | AC | 148 ms
37,768 KB |
testcase_49 | AC | 127 ms
40,540 KB |
testcase_50 | AC | 60 ms
28,208 KB |
testcase_51 | AC | 314 ms
36,808 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 | 604 ms
132,152 KB |
testcase_84 | AC | 601 ms
132,792 KB |
testcase_85 | AC | 628 ms
132,000 KB |
testcase_86 | AC | 492 ms
125,148 KB |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | AC | 1,538 ms
129,440 KB |
testcase_93 | AC | 1,494 ms
125,960 KB |
ソースコード
import std.conv, std.functional, std.range, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; } int readInt() { return readToken.to!int; } long readLong() { return readToken.to!long; } real readReal() { return readToken.to!real; } bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } } bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } } int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; } int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); } int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); } enum LIM = 2005; int N; int[] A; int Q; int[] M, L, R; void main() { auto isnp = new bool[LIM]; foreach (p; 2 .. LIM) { if (!isnp[p]) { for (int n = 2 * p; n < LIM; n += p) { isnp[n] = true; } } } int[] primes; foreach (p; 2 .. LIM) { if (!isnp[p]) { primes ~= p; } } stderr.writeln("|primes| = ", primes.length); const primesLen = cast(int)(primes.length); try { for (; ; ) { N = readInt(); A = new int[N]; foreach (i; 0 .. N) { A[i] = readInt(); } Q = readInt(); M = new int[Q]; L = new int[Q]; R = new int[Q]; foreach (q; 0 .. Q) { M[q] = readInt(); L[q] = readInt() - 1; R[q] = readInt(); } auto sums = new int[][](primesLen, N + 1); foreach (h; 0 .. primesLen) { const p = primes[h]; foreach (i; 0 .. N) { int e; if (A[i] == 0) { e = 32; } else { for (int a = A[i]; a % p == 0; a /= p) { ++e; } } sums[h][i + 1] = sums[h][i] + e; } } foreach (q; 0 .. Q) { bool ans = true; int m = M[q]; foreach (h; 0 .. primesLen) { const p = primes[h]; int e; for (; m % p == 0; m /= p) { ++e; } ans = ans && (sums[h][R[q]] - sums[h][L[q]] >= e); } ans = ans && (m == 1); writeln(ans ? "Yes" : "NO"); } } } catch (EOFException e) { } }