結果
| 問題 |
No.691 E869120 and Constructing Array 5
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-09-21 23:01:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,527 bytes |
| コンパイル時間 | 1,952 ms |
| コンパイル使用メモリ | 202,172 KB |
| 実行使用メモリ | 29,920 KB |
| 最終ジャッジ日時 | 2025-09-21 23:01:46 |
| 合計ジャッジ時間 | 12,593 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:35:62: warning: ‘r’ may be used uninitialized [-Wmaybe-uninitialized]
35 | double r=x-sqrt(t[l].x)-sqrt(t[l].y)-sqrt(t[r].x)-sqrt(t[r].y);
| ^
main.cpp:35:24: note: ‘r’ was declared here
35 | double r=x-sqrt(t[l].x)-sqrt(t[l].y)-sqrt(t[r].x)-sqrt(t[r].y);
| ^
main.cpp:47:62: warning: ‘r’ may be used uninitialized [-Wmaybe-uninitialized]
47 | double r=x-sqrt(t[l].x)-sqrt(t[l].y)-sqrt(t[r].x)-sqrt(t[r].y);
| ^
main.cpp:47:24: note: ‘r’ was declared here
47 | double r=x-sqrt(t[l].x)-sqrt(t[l].y)-sqrt(t[r].x)-sqrt(t[r].y);
| ^
ソースコード
#include<bits/stdc++.h>
#define int long long
// #define double long double
#define N 1000005
using namespace std;
int T,n,m;
struct node{
int x,y;
double d;
bool operator<(const node&t)const{
return d<t.d;
}
};
vector<node> t;
signed main(){
cin.tie(0)->sync_with_stdio(0);
int T;
cin>>T;
for(int i=1000;i<=2000;i++){
for(int j=0;j<=1000;j++){
double x=sqrt(i)+sqrt(j);
t.push_back({i,j,modf(x,&x)});
}
}
sort(t.begin(),t.end());
// cout<<t.size()<<"\n";
while(T--){
double x,d,dd;
cin>>x,d=modf(x,&dd);
// cout<<fixed<<setprecision(12)<<d<<endl;
int l=0,r=1002000*d;
while(l<r){
double tmp=d-t[l].d-t[r].d;
if(fabs(tmp)<9.2e-11){
double r=x-sqrt(t[l].x)-sqrt(t[l].y)-sqrt(t[r].x)-sqrt(t[r].y);
cout<<5<<" "<<t[l].x<<" "<<t[l].y<<" "<<t[r].x<<" "<<t[r].y<<" "<<(int)(r*r+0.5)<<"\n";
goto ok;
}
if(tmp<0) r--;
else l++;
}
goto FAIL;ok:;continue;FAIL:;
l=1002000*d,r=1002000;
while(l<r){
double tmp=d+1-t[l].d-t[r].d;
if(fabs(tmp)<9.2e-11){
double r=x-sqrt(t[l].x)-sqrt(t[l].y)-sqrt(t[r].x)-sqrt(t[r].y);
cout<<5<<" "<<t[l].x<<" "<<t[l].y<<" "<<t[r].x<<" "<<t[r].y<<" "<<(int)(r*r+0.5)<<"\n";
break;
}
if(tmp<0) r--;
else l++;
}
}
}
vjudge1