Contest Duration: - (local time) (100 minutes) Back to Home

Submission #7295494

Source Code Expand

Copy
```#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

int N;

long long int x[105], y[105];

int used[105];

long long int  dis(long long int x, long long int y) {
return x*x + y*y;
}

long long int prod(long long int x, long long int y, long long int a, long long int b) {

return a*x + b*y;
}

int main(void) {

cin >> N;

long long int ans = 0;

for (int i = 1; i <= N; i++) {
cin >> x[i] >> y[i];
}

long long int X, Y;

for (long long int a = -1000000; a <= 1000000; a++) {
long long int b = 1000000 - abs(a);

X = 0; Y = 0;
for (int i = 1; i <= N; i++) {
if (prod(a, b, x[i], y[i]) >= 0) { X += x[i]; Y += y[i]; }
}
ans = max(ans, dis(X, Y));
}

for (long long int a = -1000000; a <= 1000000; a++) {
long long int b = -(1000000 - abs(a));

X = 0; Y = 0;
for (int i = 1; i <= N; i++) {
if (prod(a, b, x[i], y[i]) >= 0) { X += x[i]; Y += y[i]; }
}
ans = max(ans, dis(X, Y));
}

long double ANS;

ANS = sqrt(1.0L*ans);

cout << setprecision(15) << fixed << ANS << endl;

return 0;
}```

#### Submission Info

Submission Time 2019-09-01 23:46:33+0900 F - Engines LEE_0102 C++14 (GCC 5.4.1) 600 1180 Byte AC 587 ms 256 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 23 ms 256 KB
00-sample-02.txt AC 32 ms 256 KB
00-sample-03.txt AC 35 ms 256 KB
00-sample-04.txt AC 23 ms 256 KB
00-sample-05.txt AC 12 ms 256 KB
00-sample-06.txt AC 17 ms 256 KB
00-sample-07.txt AC 65 ms 256 KB
01-random-very-small-01.txt AC 58 ms 256 KB
01-random-very-small-02.txt AC 477 ms 256 KB
01-random-very-small-03.txt AC 524 ms 256 KB
02-random-small-01.txt AC 59 ms 256 KB
02-random-small-02.txt AC 504 ms 256 KB
02-random-small-03.txt AC 536 ms 256 KB
03-random-01.txt AC 60 ms 256 KB
03-random-02.txt AC 515 ms 256 KB
03-random-03.txt AC 536 ms 256 KB
04-zero-01.txt AC 520 ms 256 KB
05-same-01.txt AC 236 ms 256 KB
05-same-02.txt AC 507 ms 256 KB
06-linear-01.txt AC 78 ms 256 KB
06-linear-02.txt AC 251 ms 256 KB
06-linear-03.txt AC 530 ms 256 KB
07-linear-positive-01.txt AC 150 ms 256 KB
07-linear-positive-02.txt AC 326 ms 256 KB
07-linear-positive-03.txt AC 501 ms 256 KB
08-90-degree-01.txt AC 451 ms 256 KB
08-90-degree-02.txt AC 536 ms 256 KB
09-180-degree-01.txt AC 350 ms 256 KB
09-180-degree-02.txt AC 555 ms 256 KB
10-sandglass-01.txt AC 316 ms 256 KB
10-sandglass-02.txt AC 533 ms 256 KB
11-circle-01.txt AC 22 ms 256 KB
11-circle-02.txt AC 32 ms 256 KB
11-circle-03.txt AC 71 ms 256 KB
11-circle-04.txt AC 303 ms 256 KB
11-circle-05.txt AC 532 ms 256 KB
12-square-01.txt AC 492 ms 256 KB
12-square-02.txt AC 560 ms 256 KB
12-square-03.txt AC 587 ms 256 KB
13-corner-01.txt AC 17 ms 256 KB
13-corner-02.txt AC 17 ms 256 KB