QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#724528 | #8081. Minimum Manhattan Distance | Scene | WA | 53ms | 3944kb | C++14 | 858b | 2024-11-08 13:33:19 | 2024-11-08 13:33:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int read(){
int ret=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
while( isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch&15);ch=getchar();}
return ret*f;
}
int T;
struct node{
int x,y;
}A1,B1,A2,B2,O1,O2;
int dis(node A,node B){return abs(A.x-B.x)+abs(A.y-B.y);}
long long dis2(node A,node B){return 1ll*(A.x-B.x)*(A.x-B.x)+1ll*(A.y-B.y)*(A.y-B.y);}
double d;
int main(){
T=read();
while(T--){
A1.x=read()*2;A1.y=read()*2;
B1.x=read()*2;B1.y=read()*2;
A2.x=read()*2;A2.y=read()*2;
B2.x=read()*2;B2.y=read()*2;
O1=(node){(A1.x+B1.x)/2,(A1.y+B1.y)/2};
O2=(node){(A2.x+B2.x)/2,(A2.y+B2.y)/2};
d=sqrt(dis2(O2,A2)/2);
printf("%.10lf\n",dis(O1,O2)/2.0-d);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
input:
1 0 0 2 1 4 5 5 2
output:
4.2639320225
result:
ok Your answer is acceptable!^ ^
Test #2:
score: -100
Wrong Answer
time: 53ms
memory: 3944kb
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:
77664.4926907748 192928.3027014407 227607.1060560451 145831.4445800461 224138.5232125775 203168.4163282675 106258.7021872966 114459.0303542243 130191.3783464897 92639.9951336741 110927.1824394682 121482.2553314582 130471.0514280389 193239.8699431411 101942.1776022450 228879.0586132938 128129.5646587...
result:
wrong answer Except 7810.822330470300, but found 7810.836478267300!QAQ