結果

問題 No.1330 Multiply or Divide
ユーザー tails
提出日時 2021-01-08 22:27:15
言語 cLay
(20241019-1)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 178,724 KB
実行使用メモリ 15,208 KB
最終ジャッジ日時 2024-07-05 14:56:05
合計ジャッジ時間 5,829 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 1 TLE * 1 -- * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

priority_queue<pair<ll,ll>>q;
ll a[2d5];
{
	ll@n,@m,@p;
	rd(a(n));
	q.push({0,1});
	while(!q.empty()){
		pair<ll,ll>t=q.top();
		q.pop();
		int k=-t.first;
		int x=t.second;
		if(x>m){
			wt(k);
			exit(0);
		}
		if(k>=1000){
			wt(-1);
			exit(0);
		}
		rep(i,n){
			int y=x*a[i],z=k+1;
			while(y%p<1){
				y/=p;
				++z;
			}
			if(y>x){
				q.push({-z,y});
			}
		}
	}
	wt(-1);
}
0