11111111

#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <cmath>
#define re register
#define LL long long
#define ull unsigned LL
#define INF 100000009
using namespace std;

const LL N=1e6+100,M=2020,mod=1e9+7;
LL n,t,ans,maxn,a[N]={ 0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59 };
void dfs ( LL now,LL num,LL gs,LL sum )
{
	if ( ( sum>maxn ) || ( sum==maxn && now<ans ) ) maxn=sum,ans=now;
	for ( int i=1;i<=gs;i++ )
	{
		if ( 1e18/a[num]<now ) return;
		now*=a[num];
		if ( now>n ) return;
		dfs ( now,num+1,i,sum*( i+1 ) );
	}
}

int main ( )
{
	scanf ( "%lld",&t );
	while ( t-- )
	{
		ans=maxn=0;
		scanf ( "%lld",&n );
		dfs ( 1,1,n,1 );
		printf ( "%lld %lld\n",ans,maxn );
	}
	return 0;
}
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <cmath>
#define re register
#define LL long long
#define ull unsigned LL
#define INF 100000009
using namespace std;

const LL N=1e6+100,M=2020,mod=1e9+7;
bool fg,f[N];
int t,l,n,a,b,k[N];
vector < int > q[N];
bool find ( int x )
{
	int len=q[x].size ( );
	for ( int i=0;i<len;i++ )
	{
		int to=q[x][i];
		if ( f[to] ) continue;
		f[to]=1;
		return 1;
	}
	return 0;
}
void put ( int a )
{
	l=lower_bound ( k+1,k+1+n,ceil ( a*1.0/2 ) )-k;
	for ( int i=l,to;i<=n;i++ )
	{
		to=lower_bound ( k+1,k+1+n,a-k[i] )-k;
		if ( k[to]!=a-k[i] ) continue;
		q[i].push_back ( to ),q[to].push_back ( i );
	}
}

int main ( )
{
	scanf ( "%d",&t );
	while ( t-- )
	{
		memset ( f,0,sizeof ( f ) );
		fg=0;
		scanf ( "%d %d %d",&n,&a,&b );
		for ( int i=1;i<=n;i++ ) scanf ( "%d",&k[i] ),q[i].clear ( );
		sort ( k+1,k+1+n );
		if ( k[n]>=a && k[n]>=b ) { printf ( "NO\n" );continue; }
		put ( a ),put ( b );
		for ( int i=1;i<=n;i++ )
		{
			if ( f[i] || find ( i ) ) continue;
			else { fg=1;break; }
		}
		if ( !fg ) printf ( "YES\n" );
		else printf ( "NO\n" );
	}
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值