結果
問題 |
No.691 E869120 and Constructing Array 5
|
ユーザー |
![]() |
提出日時 | 2025-09-24 11:59:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 994 bytes |
コンパイル時間 | 1,704 ms |
コンパイル使用メモリ | 166,436 KB |
実行使用メモリ | 29,372 KB |
最終ジャッジ日時 | 2025-09-24 11:59:45 |
合計ジャッジ時間 | 11,183 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 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(eps<1e-10){ 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,1,1000000*f))print(p,f+1,1000000*f,1000000); 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);//?????? id++; a[id].x=i;a[id].y=j;a[id].f=f; } } sort(a+1,a+id+1,cmp); int Tc=1; cin>>Tc; while(Tc--)solve(); return 0; } /* */