結果

問題 No.854 公平なりんご分配
ユーザー 夜
提出日時 2021-03-26 20:52:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,234 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 95,932 KB
実行使用メモリ 43,316 KB
最終ジャッジ日時 2023-08-19 06:36:12
合計ジャッジ時間 13,669 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 7 ms
4,684 KB
testcase_25 AC 4 ms
4,380 KB
testcase_26 AC 7 ms
4,676 KB
testcase_27 AC 6 ms
4,752 KB
testcase_28 AC 5 ms
4,376 KB
testcase_29 AC 3 ms
4,380 KB
testcase_30 AC 4 ms
4,380 KB
testcase_31 AC 7 ms
4,432 KB
testcase_32 AC 68 ms
30,660 KB
testcase_33 AC 67 ms
17,960 KB
testcase_34 AC 125 ms
40,916 KB
testcase_35 AC 90 ms
32,996 KB
testcase_36 AC 52 ms
5,048 KB
testcase_37 AC 65 ms
28,948 KB
testcase_38 AC 51 ms
24,276 KB
testcase_39 AC 180 ms
43,316 KB
testcase_40 AC 74 ms
15,776 KB
testcase_41 AC 86 ms
27,132 KB
testcase_42 AC 112 ms
40,272 KB
testcase_43 AC 126 ms
28,092 KB
testcase_44 AC 136 ms
37,536 KB
testcase_45 AC 120 ms
9,972 KB
testcase_46 AC 170 ms
37,132 KB
testcase_47 AC 67 ms
22,224 KB
testcase_48 AC 106 ms
39,712 KB
testcase_49 AC 101 ms
40,600 KB
testcase_50 AC 60 ms
28,728 KB
testcase_51 AC 168 ms
38,972 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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int sum[100010][330] = {};
vector<int> p;
int main() {
	for (int i = 2; i <= 2000; i++) {
		bool bo = true;
		for (int j = 2; j * j <= i; j++) {
			if (i % j == 0) {
				bo = false;
			}
		}
		if (bo) {
			p.emplace_back(i);
		}
	}
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		for (int j = 0; j < p.size(); j++) {
			if (a % p[j] == 0) {
				int co = 0;
				while (a % p[j] == 0) {
					a /= p[j];
					co++;
				}
				sum[i][j] += co;
			}
			sum[i][j] += sum[i - 1][j];
		}
	}
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int b, l, r;
		cin >> b >> l >> r;
		bool bo = true;
		for (int j = 0; j < p.size(); j++) {
			if (b % p[j] == 0) {
				int co = 0;
				while (b % p[j] == 0) {
					b /= p[j];
					co++;
				}
				if (sum[r][j] - sum[l - 1][j] < co) {
					bo = false;
				}
			}
		}
		if (b != 1) {
			bo = false;
		}
		if (bo) {
			cout << "Yes" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}
0