Submission #7283853


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define met(s) memset(s,0, sizeof(s))
const int mod=100000007;
const int maxn=1000000;
const int inf = 0x3f3f3f3f;
long double x[5]={0},y[5]={0};
long double x2[5]={0},y2[5]={0};
long double dis(long double a,long double b)
{
    return a*a+b*b;
}
void change(long double a,long double b)
{
    if(a>=0&&b>=0)
    {
        if(dis(a,b)>dis(x[1],y[1])&&dis(a,b)>dis(x2[1],y2[1]))
        {
            x2[1]=a;
            y2[1]=b;
        }
    }
    else if(a>=0&&b<0)
    {
        if(dis(a,b)>dis(x[4],y[4])&&dis(a,b)>dis(x2[4],y2[4]))
        {
            x2[4]=a;
            y2[4]=b;
        }
    }
    else if(a<0&&b<0)
    {
        if(dis(a,b)>dis(x[3],y[3])&&dis(a,b)>dis(x2[3],y2[3]))
        {
            x2[3]=a;
            y2[3]=b;
        }
    }
    else if(a<0&&b>=0)
    {
        if(dis(a,b)>dis(x[2],y[2])&&dis(a,b)>dis(x2[2],y2[2]))
        {
            x2[2]=a;
            y2[2]=b;
        }
    }
} 
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        long double a,b;
        scanf("%Lf%Lf",&a,&b);
        for(int j=1;j<=4;j++)
        {
            change(x[j]+a,y[j]+b);
           // printf("%Lf %Lf\n",x[j]+a,y[j]+b);
        }
        // for(int j=1;j<=4;j++)
        // {
        //     printf("now=%Lf %Lf\n",x2[i],y2[i]);
        // }
        for(int j=1;j<=4;j++)
        {
            if(dis(x2[j],y2[j])>dis(x[j],y[j]))
            {
                x[j]=x2[j];
                y[j]=y2[j];
            }
        }
    }
    long double ans=0;
    for(int i=1;i<=4;i++)
    {
        long double now=sqrt(x[i]*x[i]+y[i]*y[i]);
        //printf("%Lf %Lf\n",x[i],y[i]);
        if(now>ans) ans=now;
    }
    printf("%.14Lf\n",ans);
    return 0;
}

Submission Info

Submission Time
Task F - Engines
User WA_King
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1902 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:53:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
./Main.cpp:57:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%Lf%Lf",&a,&b);
                              ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 7
AC × 30
WA × 11
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 00-sample-04.txt, 00-sample-05.txt, 00-sample-06.txt, 00-sample-07.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 00-sample-04.txt, 00-sample-05.txt, 00-sample-06.txt, 00-sample-07.txt, 01-random-very-small-01.txt, 01-random-very-small-02.txt, 01-random-very-small-03.txt, 02-random-small-01.txt, 02-random-small-02.txt, 02-random-small-03.txt, 03-random-01.txt, 03-random-02.txt, 03-random-03.txt, 04-zero-01.txt, 05-same-01.txt, 05-same-02.txt, 06-linear-01.txt, 06-linear-02.txt, 06-linear-03.txt, 07-linear-positive-01.txt, 07-linear-positive-02.txt, 07-linear-positive-03.txt, 08-90-degree-01.txt, 08-90-degree-02.txt, 09-180-degree-01.txt, 09-180-degree-02.txt, 10-sandglass-01.txt, 10-sandglass-02.txt, 11-circle-01.txt, 11-circle-02.txt, 11-circle-03.txt, 11-circle-04.txt, 11-circle-05.txt, 12-square-01.txt, 12-square-02.txt, 12-square-03.txt, 13-corner-01.txt, 13-corner-02.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 1 ms 256 KB
00-sample-02.txt AC 1 ms 256 KB
00-sample-03.txt AC 1 ms 256 KB
00-sample-04.txt AC 1 ms 256 KB
00-sample-05.txt AC 1 ms 256 KB
00-sample-06.txt AC 1 ms 256 KB
00-sample-07.txt AC 1 ms 256 KB
01-random-very-small-01.txt AC 1 ms 256 KB
01-random-very-small-02.txt AC 1 ms 256 KB
01-random-very-small-03.txt WA 1 ms 256 KB
02-random-small-01.txt WA 1 ms 256 KB
02-random-small-02.txt WA 1 ms 256 KB
02-random-small-03.txt WA 1 ms 256 KB
03-random-01.txt AC 1 ms 256 KB
03-random-02.txt WA 1 ms 256 KB
03-random-03.txt WA 1 ms 256 KB
04-zero-01.txt AC 1 ms 256 KB
05-same-01.txt AC 1 ms 256 KB
05-same-02.txt AC 1 ms 256 KB
06-linear-01.txt AC 1 ms 256 KB
06-linear-02.txt AC 1 ms 256 KB
06-linear-03.txt AC 1 ms 256 KB
07-linear-positive-01.txt AC 1 ms 256 KB
07-linear-positive-02.txt AC 1 ms 256 KB
07-linear-positive-03.txt AC 1 ms 256 KB
08-90-degree-01.txt AC 1 ms 256 KB
08-90-degree-02.txt AC 1 ms 256 KB
09-180-degree-01.txt WA 1 ms 256 KB
09-180-degree-02.txt WA 1 ms 256 KB
10-sandglass-01.txt AC 1 ms 256 KB
10-sandglass-02.txt AC 1 ms 256 KB
11-circle-01.txt AC 1 ms 256 KB
11-circle-02.txt WA 1 ms 256 KB
11-circle-03.txt AC 1 ms 256 KB
11-circle-04.txt AC 1 ms 256 KB
11-circle-05.txt WA 1 ms 256 KB
12-square-01.txt AC 1 ms 256 KB
12-square-02.txt WA 1 ms 256 KB
12-square-03.txt AC 1 ms 256 KB
13-corner-01.txt AC 1 ms 256 KB
13-corner-02.txt AC 1 ms 256 KB