QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#58288 | #2173. What's Our Vector, Victor? | CharlieVinnie | WA | 282ms | 6308kb | C++20 | 1.9kb | 2022-10-25 17:24:19 | 2022-10-25 17:24:20 |
Judging History
answer
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
using namespace std;
const int N=505; typedef long long ll;
int d,n; double pos[N][N],dis[N],cur[N],F[N];
mt19937 rng(190345);
// double f(double x,double e) { return (x-e)*(x-e)*(x-e)/800000; }
// double f(double x,double e) { return (x-e)/100; }
int sgn(double x) { return x>=0?1:-1; }
double f(double x,double e) { return pow(abs(x-e),1+1e-6)*sgn(x-e)/1000; }
signed main(){
cin>>d>>n; For(i,1,n) { For(j,1,d){cin>>pos[i][j];} cin>>dis[i]; }
For(qwq,1,5){
For(i,1,d) cur[i]=uniform_real_distribution<double>(-100,100)(rng);
// For(i,1,d) cur[i]=0;
double T=1;
For(e,0,100){
For(i,1,d) F[i]=0.0;
For(i,1,n){
double x=0.0;
For(j,1,d)
x+=(cur[j]-pos[i][j])*(cur[j]-pos[i][j]);
// cerr<<"x="<<x<<endl;
x=sqrt(x);
For(j,1,d)
F[j]+=f(x,dis[i])*(pos[i][j]-cur[j]);
}
int ok=1; For(i,1,d) if(abs(cur[i])>1000) { ok=0; break; }
For(i,1,d) cur[i]+=F[i]*T;
if (!ok) {/*cerr<<"remake.."<<endl;*/ For(i,1,d) cur[i]=uniform_real_distribution<double>(-100,100)(rng);}
// T*=0.999998;
T*=1-1e-3;
}
int ok=1;
For(i,1,n){
double x=0.0;
For(j,1,d) x+=(cur[j]-pos[i][j])*(cur[j]-pos[i][j]);
x=sqrt(x);
if(abs(x-dis[i])>1e-3) { ok=0; break; }
}
if(ok) { cerr<<"qwq\n"; break; }
}
For(i,1,d) cout<<cur[i]<<' ';
cout<<'\n';
cerr<<"Time = "<<clock()<<" ms"<<endl;
return 0;
}
// START TYPING IF YOU DON'T KNOW WHAT TO DO
详细
Test #1:
score: 0
Wrong Answer
time: 282ms
memory: 6308kb
input:
500 500 60.00268893933372283 70.35885554610950976 -8.98574176457012186 46.16014112676185732 66.31422279348288384 29.03050764912902082 -35.06996828144599476 -59.10319321730690234 67.85808505028276727 20.30232033048615392 62.38784996896146140 59.92659390534240060 -36.26787439344059294 30.8251981981496...
output:
-68.521 13.8607 78.0951 -47.1126 -96.268 -26.6948 41.4737 89.1783 -45.3553 26.4323 79.5589 68.5284 42.1066 -25.8122 20.7583 86.4115 60.0536 -21.609 80.5318 67.7706 -78.6784 -96.6044 -60.5209 64.6626 -38.4168 -0.247447 65.545 -55.7388 35.0275 -93.3659 -59.0227 -1.96529 -42.4922 -8.5432 -94.7722 -18.7...
result:
wrong answer distance to vector 1 should be 1769.53592263014638775 but is 1802.95199481526969976, error 0.01888408805821551