QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#563668 | #8081. Minimum Manhattan Distance | Liangsheng298# | WA | 131ms | 4016kb | C++14 | 1.1kb | 2024-09-14 14:55:14 | 2024-09-14 14:55:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(){
T x=0;char ch=getchar();bool fl=false;
while(!isdigit(ch)){if(ch=='-')fl=true;ch=getchar();}
while(isdigit(ch)){
x=(x<<3)+(x<<1)+(ch^48);ch=getchar();
}
return fl?-x:x;
}
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define LL long long
#define read() read<int>()
#define LD long double
LD R1,R2,ans;
int x_1,y_1,x_2,y_2;
const int dx[]={-1,-1,1,1};
const int dy[]={-1,1,-1,1};
int main(){
FASTIO;
int T;cin>>T;
while(T--){
cin>>x_1>>y_1>>x_2>>y_2;
LD X1=(x_1+x_2)/2.0,Y1=(y_1+y_2)/2.0,R1=sqrt((x_2-x_1)*(x_2-x_1)+(y_2-y_1)*(y_2-y_1))/2.0;
cin>>x_1>>y_1>>x_2>>y_2;
LD X2=(x_1+x_2)/2.0,Y2=(y_1+y_2)/2.0,R2=sqrt((x_2-x_1)*(x_2-x_1)+(y_2-y_1)*(y_2-y_1))/2.0;
LD base=R2/sqrt(2);
LD ans=1e9;
for(int i=0;i<4;i++){
LD x=X2+base*dx[i],y=Y2+base*dy[i];
//cout<<x<<' '<<y<<'\n';
ans=min(ans,fabs(x-X1)+fabs(y-Y1));
}
cout<<fixed<<setprecision(9);
cout<<ans<<'\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3916kb
input:
1 0 0 2 1 4 5 5 2
output:
4.263932023
result:
ok Your answer is acceptable!^ ^
Test #2:
score: -100
Wrong Answer
time: 131ms
memory: 4016kb
input:
100000 64184 -33682 59295 3067 16568 83379 -30901 17899 4747 16156 33365 80028 -41011 -93961 -89583 -95743 96914 -33206 12828 -88885 -93518 29681 -82022 42270 40225 76998 25677 84480 66361 -32945 94822 -81258 -17979 41800 -91442 80586 40229 -78184 30070 -89624 -21082 -94587 48262 -87979 -95197 91518...
output:
1000000000.000000000 1000000000.000000000 227607.106035307 1000000000.000000000 224138.523189469 1000000000.000000000 1000000000.000000000 1000000000.000000000 199492.598914284 1000000000.000000000 110927.182439468 154352.400822803 130471.051428039 193239.869930903 1000000000.000000000 263673.134610...
result:
wrong answer Except 77664.492686403202, but found 1000000000.000000000000!QAQ