QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#588766#8081. Minimum Manhattan DistanceSwd146296#WA 266ms3952kbC++14949b2024-09-25 14:24:102024-09-25 14:24:11

Judging History

你现在查看的是最新测评结果

  • [2024-09-25 14:24:11]
  • 评测
  • 测评结果:WA
  • 用时:266ms
  • 内存:3952kb
  • [2024-09-25 14:24:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
const long double eps=1e-9;

int T;
int read()
{
    int r=0, f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {r=r*10+ch-'0'; ch=getchar();}
    return r*f;
}
int main()
{
    // freopen("testdata.in","r",stdin);
    T=read();
    while(T--)
    {
        ld x11,y11,x12,y12,x21,y21,x22,y22;
        cin >> x11 >> y11 >> x12 >> y12;
        cin >> x21 >> y21 >> x22 >> y22;
        ld X1=(x11+x12)/2, Y1=(y11+y12)/2, X2=(x21+x22)/2, Y2=(y21+y22)/2;
        // cout << X1 << " " << Y1 << " " << X2 << " " << Y2 << '\n';
        ld r=(y22-y21)*(y22-y21)+(x22-x21)*(x22-x21);
        r/=8;
        ld NX=X2-sqrt(r), NY=Y2-sqrt(r);
        // cout << man << " " << d << " " << r << '\n';
        cout << fixed << setprecision(10) << abs(NX-X1)+abs(NY-Y1) << '\n';
    }
    return (0-0);
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3856kb

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: 266ms
memory: 3952kb

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:

134852.5000000000
261665.6972985593
239662.0000000000
185481.0000000000
234957.0000000000
247484.5000000000
106258.7021872967
158048.5000000000
211323.5000000000
125930.0000000000
110927.1824394682
121482.2553263667
168426.9485719611
234097.1300690967
164202.0000000000
228879.0586081132
159326.00000...

result:

wrong answer Except 77664.492686403202, but found 134852.500000000000!QAQ