QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#58289 | #2173. What's Our Vector, Victor? | CharlieVinnie | WA | 269ms | 6120kb | C++20 | 1.9kb | 2022-10-25 17:29:26 | 2022-10-25 17:29:28 |
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.000005)*sgn(x-e)/1000; }
double f(double x,double e) { return 1.0/(1.0+exp(-(x-e)))-0.5; }
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
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 269ms
memory: 6120kb
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:
-7415.93 8132.64 8394.59 10309.9 -353.832 773.943 -2137.58 5737.69 3106.72 7978.6 7624.23 -834.042 3044.21 -3274.52 -2038.46 -4087.19 -7066.95 -5812.1 6750.49 -1535.92 4113.58 1191.04 2142.4 -3293.96 -4490.63 391.895 7492.86 3933.71 4987.25 2739.27 -8754.33 -3600.72 -6553.8 5789.21 -7334.86 851.212 ...
result:
wrong answer distance to vector 1 should be 1769.53592263014638775 but is 118552.76307246208307333, error 65.99652804801577588