Submission #7287265


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

template <class T>
inline bool read(T &ret)
{
    char c;
    int sgn;
    if (c = getchar(), c == EOF)
    {
        return 0;
    }
    while (c != '-' && (c < '0' || c > '9'))
    {
        c = getchar();
    }
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (c = getchar(), c >= '0' && c <= '9')
    {
        ret = ret * 10 + (c - '0');
    }
    ret *= sgn;
    return 1;
}

template <class T>
inline void write(T x)
{
    if (x > 9)
    {
        write(x / 10);
    }
    putchar(x % 10 + '0');
}

const int MAXN=110;
const double PI=acos(-1.0);

int n;
struct point
{
    double x,y;
};
point points[MAXN];
double ans;

double dfs()
{
    double r=rand();
    r/=RAND_MAX,r*=2*PI;
    double ansx=0,ansy=0;
    for(int i=1;i<=n;i++)
    {
        double ccx=cos(r)*points[i].x-sin(r)*points[i].y;
        double ccy=sin(r)*points[i].x+cos(r)*points[i].y;
        if(ccx>=0)
        {
            ansx+=ccx,ansy+=ccy;
        }
    }
    return sqrt(ansx*ansx+ansy*ansy);
}

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>points[i].x>>points[i].y;
    for(int i=1;i<=1000;i++)
        ans=max(ans,dfs());
    cout<<fixed<<setprecision(13)<<ans<<endl;
}

Submission Info

Submission Time
Task F - Engines
User Setsuge
Language C++14 (GCC 5.4.1)
Score 600
Code Size 1326 Byte
Status AC
Exec Time 3 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 7
AC × 41
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 3 ms 384 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 2 ms 256 KB
01-random-very-small-03.txt AC 2 ms 256 KB
02-random-small-01.txt AC 1 ms 256 KB
02-random-small-02.txt AC 2 ms 256 KB
02-random-small-03.txt AC 2 ms 256 KB
03-random-01.txt AC 1 ms 256 KB
03-random-02.txt AC 2 ms 256 KB
03-random-03.txt AC 2 ms 256 KB
04-zero-01.txt AC 2 ms 256 KB
05-same-01.txt AC 1 ms 256 KB
05-same-02.txt AC 2 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 2 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 2 ms 256 KB
08-90-degree-01.txt AC 2 ms 256 KB
08-90-degree-02.txt AC 2 ms 256 KB
09-180-degree-01.txt AC 2 ms 256 KB
09-180-degree-02.txt AC 2 ms 256 KB
10-sandglass-01.txt AC 2 ms 256 KB
10-sandglass-02.txt AC 2 ms 256 KB
11-circle-01.txt AC 1 ms 256 KB
11-circle-02.txt AC 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 AC 2 ms 256 KB
12-square-01.txt AC 2 ms 256 KB
12-square-02.txt AC 2 ms 256 KB
12-square-03.txt AC 2 ms 256 KB
13-corner-01.txt AC 1 ms 256 KB
13-corner-02.txt AC 1 ms 256 KB