結果

問題 No.691 E869120 and Constructing Array 5
ユーザー vjudge1
提出日時 2025-09-24 12:02:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 987 bytes
コンパイル時間 1,387 ms
コンパイル使用メモリ 166,460 KB
実行使用メモリ 29,412 KB
最終ジャッジ日時 2025-09-24 12:02:44
合計ジャッジ時間 10,946 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2000010;
const int mod=1e9+7;
struct Node{
	int x,y;
	double f;
}a[N];
int id;
bool cmp(Node a,Node b){
	return a.f<b.f;
}
double p,f;
bool print(double mb,double f,int i,int j){
	while(i<j){
		double eps=f-(a[i].f+a[j].f);
		if(eps<9e-11){
			double cc=p-(sqrt(a[i].x)+sqrt(a[i].y)+sqrt(a[j].x)+sqrt(a[j].y));
			cout<<"5 "<<a[i].x<<" "<<a[i].y<<" "<<a[j].x<<" "<<a[j].y<<" "<<(int)(cc*cc+0.5)<<"\n";
			return true;
		}
		if(eps<0)j--;
		else i++;
	}
	return false;
}
void solve(){
	cin>>p;
	double x;
	f=modf(p,&x);//????
	if(!print(p,f,0,999999*f))print(p,f+1,999999*f,999999);
	return;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	for(int i=1000;i<2000;i++){
		for(int j=0;j<1000;j++){
			double x=sqrt(i)+sqrt(j);
			double f=modf(x,&x);//??????
			a[id].x=i;a[id].y=j;a[id].f=f;
			id++;
		}
	}
	sort(a,a+id,cmp);
	int Tc=1;
	cin>>Tc;
	while(Tc--)solve();
	return 0;
}
/*

*/
0