結果

問題 No.1330 Multiply or Divide
ユーザー idat_50meidat_50me
提出日時 2021-01-08 21:50:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,426 bytes
コンパイル時間 2,213 ms
コンパイル使用メモリ 207,536 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 02:42:26
合計ジャッジ時間 3,804 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 19 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 16 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 36 ms
5,376 KB
testcase_09 AC 35 ms
5,376 KB
testcase_10 AC 36 ms
5,376 KB
testcase_11 AC 35 ms
5,376 KB
testcase_12 AC 35 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 35 ms
5,376 KB
testcase_19 AC 34 ms
5,376 KB
testcase_20 AC 35 ms
5,376 KB
testcase_21 AC 34 ms
5,376 KB
testcase_22 AC 34 ms
5,376 KB
testcase_23 AC 25 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 25 ms
5,376 KB
testcase_35 AC 8 ms
5,376 KB
testcase_36 AC 23 ms
5,376 KB
testcase_37 AC 20 ms
5,376 KB
testcase_38 AC 13 ms
5,376 KB
testcase_39 AC 9 ms
5,376 KB
testcase_40 AC 11 ms
5,376 KB
testcase_41 AC 6 ms
5,376 KB
testcase_42 AC 19 ms
5,376 KB
testcase_43 AC 23 ms
5,376 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

template<typename T, typename U>
using vp = vector<pair<T,U>>;
template<typename T>
using pque = priority_queue<T>;
template<typename T>
using lpque = priority_queue<T,vector<T>,greater<T>>;

using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using vint = vector<int>;
using vll = vector<ll>;
using vpint = vector<pint>;
using vpll = vector<pll>;
using vpil = vector<pil>;
using vpli = vector<pli>;
using qint = queue<int>;
using pqint = pque<int>;
using qll = queue<ll>;
using pqll = pque<ll>;

constexpr double PI = 3.141592653589793;
constexpr int INTINF = (1<<30)-1;
constexpr ll LLINF = (1LL<<62)-1;
constexpr int MPRIME = 1000000007;
constexpr int MPRIME9 = 998244353;
constexpr ll MMPRIME = (1LL<<61)-1;
constexpr char newl = '\n';

#define len length()
#define pushb push_back
#define fi first
#define se second

#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

template<typename T>
struct matrix{
private:
	vector<vector<T>> m;

public:
	matrix() : m(0, vector<T>(0)) {}
	matrix(int h, int w) : m(h, vector<T>(w)) {}
	matrix(int h, int w, const T &init) : m(h, vector<T>(w, init)) {}

	void assign(int h, int w) { m = vector(h, vector<T>(w)); }
	void assign(int h, int w, const T init) { m = vector(h, vector<T>(w, init)); }

	void in() {
		for(int i=0; i<m.size(); i++) for(int j=0; j<m[i].size(); j++) cin>>m[i][j];
	}

	void out() {
		for(int i=0; i<m.size(); i++) {
			int sz = m[i].size();
			for(int j=0; j<sz; j++) {
				cout<<m[i][j]<<(j==sz-1 ? '\n' : ' ');
			}
		}
		cout<<flush;
	}

	inline vector<T> &operator[](int idx) {
		assert(0<=idx && idx<m.size());
		return m[idx];
	}
};

template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

template<class T>
inline void out(T a) {
	cout<<a<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

long long binpow(long long a, long long ex, long long p=MMPRIME) {
	long long res = 1;
	while(ex > 0) {
		if(ex & 1) (res*=a) %= p;
		ex>>=1;
		(a*=a) %= p;
	}
	return res;
}


ll N,M,P;
vll A;

void input() {
	cin>>N>>M>>P;
	init(A,N);
}

void solve() {
	sort(rall(A));
	for(int i=0; i<N; i++) {
		if(A[i]>M) {
			cout<<1<<newl;
			return;
		}
		if(A[i]>1 && A[i]%P) {
			int ans=1;
			ll x=1;
			while((x*=A[i])<=M) ans++;
			cout<<ans<<newl;
			return;
		}
	}
	cout<<-1<<newl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t--) {
		input();
		solve();
	}
}
0