結果
| 問題 |
No.691 E869120 and Constructing Array 5
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-09-24 12:06:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 310 ms / 1,000 ms |
| コード長 | 994 bytes |
| コンパイル時間 | 1,623 ms |
| コンパイル使用メモリ | 166,768 KB |
| 実行使用メモリ | 29,184 KB |
| 最終ジャッジ日時 | 2025-09-24 12:06:57 |
| 合計ジャッジ時間 | 12,194 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 27 |
ソースコード
#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(fabs(eps)<9e-11){
double cc=mb-(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;
}
/*
*/
vjudge1