結果

問題 No.854 公平なりんご分配
ユーザー heno239heno239
提出日時 2019-07-26 23:08:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,054 bytes
コンパイル時間 1,473 ms
コンパイル使用メモリ 115,508 KB
実行使用メモリ 129,164 KB
最終ジャッジ日時 2023-09-15 04:04:34
合計ジャッジ時間 17,673 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
8,524 KB
testcase_01 AC 8 ms
8,424 KB
testcase_02 AC 8 ms
8,260 KB
testcase_03 AC 8 ms
8,500 KB
testcase_04 AC 8 ms
8,508 KB
testcase_05 AC 8 ms
8,504 KB
testcase_06 AC 7 ms
8,264 KB
testcase_07 AC 8 ms
8,492 KB
testcase_08 AC 8 ms
8,524 KB
testcase_09 AC 8 ms
8,524 KB
testcase_10 AC 8 ms
8,448 KB
testcase_11 AC 8 ms
8,420 KB
testcase_12 AC 8 ms
8,712 KB
testcase_13 AC 8 ms
8,644 KB
testcase_14 AC 8 ms
8,492 KB
testcase_15 AC 8 ms
8,480 KB
testcase_16 AC 8 ms
8,860 KB
testcase_17 AC 8 ms
8,676 KB
testcase_18 AC 8 ms
8,688 KB
testcase_19 AC 9 ms
8,776 KB
testcase_20 AC 8 ms
8,768 KB
testcase_21 AC 9 ms
8,632 KB
testcase_22 AC 11 ms
8,880 KB
testcase_23 AC 11 ms
9,396 KB
testcase_24 AC 13 ms
9,840 KB
testcase_25 AC 10 ms
9,104 KB
testcase_26 AC 13 ms
9,872 KB
testcase_27 AC 12 ms
9,864 KB
testcase_28 AC 10 ms
8,876 KB
testcase_29 AC 9 ms
8,988 KB
testcase_30 AC 10 ms
9,152 KB
testcase_31 AC 13 ms
9,720 KB
testcase_32 AC 76 ms
34,176 KB
testcase_33 AC 74 ms
22,408 KB
testcase_34 AC 133 ms
43,708 KB
testcase_35 AC 99 ms
36,176 KB
testcase_36 AC 55 ms
10,184 KB
testcase_37 AC 71 ms
32,452 KB
testcase_38 AC 58 ms
27,952 KB
testcase_39 AC 184 ms
45,832 KB
testcase_40 AC 80 ms
20,328 KB
testcase_41 AC 92 ms
30,700 KB
testcase_42 AC 121 ms
43,312 KB
testcase_43 AC 131 ms
31,896 KB
testcase_44 AC 140 ms
40,484 KB
testcase_45 AC 124 ms
14,676 KB
testcase_46 AC 174 ms
40,180 KB
testcase_47 AC 75 ms
26,164 KB
testcase_48 AC 112 ms
42,576 KB
testcase_49 AC 111 ms
43,280 KB
testcase_50 AC 70 ms
32,284 KB
testcase_51 AC 176 ms
41,684 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 541 ms
128,868 KB
testcase_84 AC 541 ms
128,880 KB
testcase_85 AC 495 ms
128,876 KB
testcase_86 AC 524 ms
129,004 KB
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 586 ms
128,880 KB
testcase_93 AC 589 ms
129,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

const int mn = 2001;
bool isp[mn];
vector<int> c[mn];
vector<int> p;
void init() {
	fill(isp + 2, isp + mn,true);
	for (int i = 2; i < mn; i++) {
		if (!isp[i])continue;
		p.push_back(i);
		for (int j = 2 * i; j < mn; j += i) {
			isp[j] = false;
		}
	}
	rep1(i, mn - 1) {
		c[i].resize(p.size());
		int cop = i;
		rep(j, p.size()) {
			int cnt = 0;
			while (cop%p[j] == 0) {
				cop /= p[j]; cnt++;
			}
			c[i][j] = cnt;
		}
	}
	c[0].resize(p.size(),30);
}

vec r[1 << 17];

void solve() {
	r[0].resize(p.size(), 0);
	int n, q; cin >> n;
	rep(i, n) {
		int a; cin >> a;
		r[i + 1] = r[i];
		rep(j, p.size()) {
			r[i + 1][j] += c[a][j];
		}
	}
	cin >> q;
	rep(i, q) {
		int a, le, ri; cin >> a >> le >> ri;
		le--; ri--;
		rep(j, p.size()) {
			int num = r[ri + 1][j] - r[le][j];
			rep(k, num) {
				if (a%p[j])break;
				a /= p[j];
			}
		}
		if (a == 1) {
			cout << "Yes" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	init();
	solve();
	//cout << "finish" << endl;
	//stop
	return 0;
}
0