結果
問題 | No.854 公平なりんご分配 |
ユーザー | 👑 hos.lyric |
提出日時 | 2019-07-26 21:46:33 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,276 bytes |
コンパイル時間 | 1,390 ms |
コンパイル使用メモリ | 106,932 KB |
実行使用メモリ | 65,060 KB |
最終ジャッジ日時 | 2023-09-15 01:01:14 |
合計ジャッジ時間 | 11,660 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
4,988 KB |
testcase_01 | AC | 3 ms
4,664 KB |
testcase_02 | AC | 3 ms
4,820 KB |
testcase_03 | AC | 4 ms
4,764 KB |
testcase_04 | AC | 3 ms
4,664 KB |
testcase_05 | AC | 3 ms
4,664 KB |
testcase_06 | AC | 4 ms
4,768 KB |
testcase_07 | AC | 4 ms
4,652 KB |
testcase_08 | AC | 4 ms
4,676 KB |
testcase_09 | AC | 3 ms
4,776 KB |
testcase_10 | AC | 3 ms
4,764 KB |
testcase_11 | AC | 4 ms
4,676 KB |
testcase_12 | AC | 4 ms
4,916 KB |
testcase_13 | AC | 3 ms
4,940 KB |
testcase_14 | AC | 3 ms
4,796 KB |
testcase_15 | AC | 3 ms
4,716 KB |
testcase_16 | AC | 4 ms
4,820 KB |
testcase_17 | AC | 4 ms
4,880 KB |
testcase_18 | AC | 4 ms
4,896 KB |
testcase_19 | AC | 4 ms
4,768 KB |
testcase_20 | AC | 4 ms
4,760 KB |
testcase_21 | AC | 3 ms
4,888 KB |
testcase_22 | AC | 5 ms
4,852 KB |
testcase_23 | AC | 6 ms
5,548 KB |
testcase_24 | AC | 8 ms
7,824 KB |
testcase_25 | AC | 5 ms
5,328 KB |
testcase_26 | AC | 8 ms
7,836 KB |
testcase_27 | AC | 8 ms
7,820 KB |
testcase_28 | AC | 5 ms
4,924 KB |
testcase_29 | AC | 5 ms
4,904 KB |
testcase_30 | AC | 5 ms
5,224 KB |
testcase_31 | AC | 8 ms
7,680 KB |
testcase_32 | AC | 86 ms
48,820 KB |
testcase_33 | AC | 108 ms
29,228 KB |
testcase_34 | AC | 218 ms
62,008 KB |
testcase_35 | AC | 142 ms
53,828 KB |
testcase_36 | AC | 37 ms
8,592 KB |
testcase_37 | AC | 83 ms
47,636 KB |
testcase_38 | AC | 63 ms
40,772 KB |
testcase_39 | AC | 365 ms
65,060 KB |
testcase_40 | AC | 105 ms
25,484 KB |
testcase_41 | AC | 141 ms
43,012 KB |
testcase_42 | AC | 176 ms
61,544 KB |
testcase_43 | AC | 242 ms
47,496 KB |
testcase_44 | AC | 254 ms
58,436 KB |
testcase_45 | AC | 113 ms
15,032 KB |
testcase_46 | AC | 339 ms
58,316 KB |
testcase_47 | AC | 101 ms
35,840 KB |
testcase_48 | AC | 161 ms
61,124 KB |
testcase_49 | AC | 141 ms
61,712 KB |
testcase_50 | AC | 72 ms
47,404 KB |
testcase_51 | AC | 328 ms
59,244 KB |
testcase_52 | TLE | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
testcase_74 | -- | - |
testcase_75 | -- | - |
testcase_76 | -- | - |
testcase_77 | -- | - |
testcase_78 | -- | - |
testcase_79 | -- | - |
testcase_80 | -- | - |
testcase_81 | -- | - |
testcase_82 | -- | - |
testcase_83 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
testcase_87 | -- | - |
testcase_88 | -- | - |
testcase_89 | -- | - |
testcase_90 | -- | - |
testcase_91 | -- | - |
testcase_92 | -- | - |
testcase_93 | -- | - |
ソースコード
#pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target ("avx") #include <cassert> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using Int = long long; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template <class T> void chmin(T &t, const T &f) { if (t > f) t = f; } template <class T> void chmax(T &t, const T &f) { if (t < f) t = f; } constexpr int LIM = 2005; bool isnp[100010]; int primesLen; int primes[320]; int N; int A[100010]; int Q; int M[100010], L[100010], R[100010]; int sums[320][100010]; int main() { for (int p = 2; p < LIM; ++p) { if (!isnp[p]) { for (int n = 2 * p; n < LIM; n += p) { isnp[n] = true; } } } for (int p = 2; p < LIM; ++p) { if (!isnp[p]) { primes[primesLen++] = p; } } cerr << "|primes| = " << primesLen << endl; for (; ~scanf("%d", &N); ) { for (int i = 0; i < N; ++i) { scanf("%d", &A[i]); } scanf("%d", &Q); for (int q = 0; q < Q; ++q) { scanf("%d%d%d", &M[q], &L[q], &R[q]); --L[q]; } for (int h = 0; h < primesLen; ++h) { const int p = primes[h]; for (int i = 0; i < N; ++i) { int e = 0; for (int a = A[i]; a % p == 0; a /= p) { ++e; } sums[h][i + 1] = sums[h][i] + e; } } for (int q = 0; q < Q; ++q) { bool ans = true; int m = M[q]; for (int h = 0; h < primesLen; ++h) { const int p = primes[h]; int e = 0; for (; m % p == 0; m /= p) { ++e; } ans = ans && (sums[h][R[q]] - sums[h][L[q]] >= e); } ans = ans && (m == 1); puts(ans ? "Yes" : "NO"); } } return 0; }