QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#569357 | #8081. Minimum Manhattan Distance | liubw_# | WA | 73ms | 3940kb | C++20 | 885b | 2024-09-16 22:23:29 | 2024-09-16 22:23:30 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define max(A,B) (A>B? A:B)
#define min(A,B) (A<B? A:B)
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define pir(X) pair<X,X>
#define mpr(A,B) make_pair(A,B)
#define fr first
#define sc second
using namespace std;
void slv(){
int x1,x2,y1,y2,x3,y3,x4,y4;
cin>>x1>>y1>>x2>>y2;
cin>>x3>>y3>>x4>>y4;
db ans=(abs(x1+x2-x3-x4)+abs(y1+y2-y3-y4))/2.0;
db r=0.5*sqrt((x4-x3)*(x4-x3)+(y3-y4)*(y3-y4));
// cout<<ans<<' '<<r<<'\n';
cout<<fixed<<setprecision(12)<<ans-sqrt(2)*r<<'\n';
}
void fst_IO(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
int main(){
fst_IO();
int T;
cin>>T;
while(T--){
slv();
}
return 0;
}
/*
1
0 0 2 1
5 2 4 5
*/
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3720kb
input:
1 0 0 2 1 4 5 5 2
output:
4.263932022500
result:
ok Your answer is acceptable!^ ^
Test #2:
score: -100
Wrong Answer
time: 73ms
memory: 3940kb
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:
-nan -nan 227607.106035306642 -nan 224138.523189468862 -nan -nan -nan 199492.598914283823 -nan 110927.182439468233 154352.400822803145 130471.051428038903 193239.869930903340 -nan 263673.134610343899 128129.564658762683 83809.437922788507 232037.118817330804 -nan 103257.998104072001 180822.576570445...
result:
wrong output format Expected double, but "-nan" found