#include <bits/stdc++.h>
using namespace std;
template<class T, class U>
void ckmin(T &a, U b)
{
if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
if (a < b) a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
typedef __int128_t ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
const int MAXN = 2013;
struct point
{
int x, y, w;
};
int N;
point arr[MAXN];
long long ans;
void test(ll cx, ll cy)
{
vpl angs;
FOR(i, 0, N)
{
angs.PB({arr[i].x * cx + arr[i].y * cy, arr[i].w});
}
sort(ALL(angs));
ll sum = 0;
FOR(i, 0, N)
{
sum += angs[i].se;
if (i != N - 1 && angs[i + 1].fi == angs[i].fi)
{
continue;
}
ckmax(ans, sum);
ckmax(sum, 0);
}
return;
}
int32_t main()
{
cout << fixed << setprecision(12);
cerr << fixed << setprecision(4);
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> N;
FOR(i, 0, N)
{
cin >> arr[i].x >> arr[i].y >> arr[i].w;
ckmax(ans, arr[i].w);
}
test(0, 0);
test(0, 1);
test(1, 0);
FOR(i, 0, N)
{
FOR(j, i + 1, N)
{
ll dy = arr[i].y - arr[j].y, dx = arr[j].x - arr[i].x;
test(dy, dx);
test(dy * 200000009 + 1, dx * 200000009);
test(dy * 200000009 - 1, dx * dy * 200000009);
}
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
384 KB |
Output is correct |
2 |
Correct |
80 ms |
384 KB |
Output is correct |
3 |
Correct |
79 ms |
384 KB |
Output is correct |
4 |
Correct |
77 ms |
384 KB |
Output is correct |
5 |
Correct |
83 ms |
384 KB |
Output is correct |
6 |
Correct |
82 ms |
384 KB |
Output is correct |
7 |
Correct |
78 ms |
384 KB |
Output is correct |
8 |
Correct |
78 ms |
384 KB |
Output is correct |
9 |
Correct |
79 ms |
384 KB |
Output is correct |
10 |
Correct |
80 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
384 KB |
Output is correct |
2 |
Correct |
86 ms |
384 KB |
Output is correct |
3 |
Correct |
89 ms |
384 KB |
Output is correct |
4 |
Correct |
86 ms |
504 KB |
Output is correct |
5 |
Correct |
87 ms |
504 KB |
Output is correct |
6 |
Correct |
90 ms |
384 KB |
Output is correct |
7 |
Correct |
88 ms |
384 KB |
Output is correct |
8 |
Correct |
90 ms |
384 KB |
Output is correct |
9 |
Correct |
86 ms |
384 KB |
Output is correct |
10 |
Correct |
89 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
4 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
90 ms |
384 KB |
Output is correct |
22 |
Correct |
92 ms |
384 KB |
Output is correct |
23 |
Correct |
93 ms |
384 KB |
Output is correct |
24 |
Correct |
90 ms |
384 KB |
Output is correct |
25 |
Correct |
89 ms |
384 KB |
Output is correct |
26 |
Correct |
94 ms |
384 KB |
Output is correct |
27 |
Correct |
90 ms |
384 KB |
Output is correct |
28 |
Correct |
88 ms |
384 KB |
Output is correct |
29 |
Correct |
93 ms |
384 KB |
Output is correct |
30 |
Correct |
91 ms |
384 KB |
Output is correct |
31 |
Correct |
92 ms |
384 KB |
Output is correct |
32 |
Correct |
90 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
384 KB |
Output is correct |
2 |
Correct |
86 ms |
384 KB |
Output is correct |
3 |
Correct |
89 ms |
384 KB |
Output is correct |
4 |
Correct |
86 ms |
504 KB |
Output is correct |
5 |
Correct |
87 ms |
504 KB |
Output is correct |
6 |
Correct |
90 ms |
384 KB |
Output is correct |
7 |
Correct |
88 ms |
384 KB |
Output is correct |
8 |
Correct |
90 ms |
384 KB |
Output is correct |
9 |
Correct |
86 ms |
384 KB |
Output is correct |
10 |
Correct |
89 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
4 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
90 ms |
384 KB |
Output is correct |
22 |
Correct |
92 ms |
384 KB |
Output is correct |
23 |
Correct |
93 ms |
384 KB |
Output is correct |
24 |
Correct |
90 ms |
384 KB |
Output is correct |
25 |
Correct |
89 ms |
384 KB |
Output is correct |
26 |
Correct |
94 ms |
384 KB |
Output is correct |
27 |
Correct |
90 ms |
384 KB |
Output is correct |
28 |
Correct |
88 ms |
384 KB |
Output is correct |
29 |
Correct |
93 ms |
384 KB |
Output is correct |
30 |
Correct |
91 ms |
384 KB |
Output is correct |
31 |
Correct |
92 ms |
384 KB |
Output is correct |
32 |
Correct |
90 ms |
384 KB |
Output is correct |
33 |
Execution timed out |
2088 ms |
512 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
384 KB |
Output is correct |
2 |
Correct |
86 ms |
384 KB |
Output is correct |
3 |
Correct |
89 ms |
384 KB |
Output is correct |
4 |
Correct |
86 ms |
504 KB |
Output is correct |
5 |
Correct |
87 ms |
504 KB |
Output is correct |
6 |
Correct |
90 ms |
384 KB |
Output is correct |
7 |
Correct |
88 ms |
384 KB |
Output is correct |
8 |
Correct |
90 ms |
384 KB |
Output is correct |
9 |
Correct |
86 ms |
384 KB |
Output is correct |
10 |
Correct |
89 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
4 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
90 ms |
384 KB |
Output is correct |
22 |
Correct |
92 ms |
384 KB |
Output is correct |
23 |
Correct |
93 ms |
384 KB |
Output is correct |
24 |
Correct |
90 ms |
384 KB |
Output is correct |
25 |
Correct |
89 ms |
384 KB |
Output is correct |
26 |
Correct |
94 ms |
384 KB |
Output is correct |
27 |
Correct |
90 ms |
384 KB |
Output is correct |
28 |
Correct |
88 ms |
384 KB |
Output is correct |
29 |
Correct |
93 ms |
384 KB |
Output is correct |
30 |
Correct |
91 ms |
384 KB |
Output is correct |
31 |
Correct |
92 ms |
384 KB |
Output is correct |
32 |
Correct |
90 ms |
384 KB |
Output is correct |
33 |
Execution timed out |
2088 ms |
512 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
384 KB |
Output is correct |
2 |
Correct |
80 ms |
384 KB |
Output is correct |
3 |
Correct |
79 ms |
384 KB |
Output is correct |
4 |
Correct |
77 ms |
384 KB |
Output is correct |
5 |
Correct |
83 ms |
384 KB |
Output is correct |
6 |
Correct |
82 ms |
384 KB |
Output is correct |
7 |
Correct |
78 ms |
384 KB |
Output is correct |
8 |
Correct |
78 ms |
384 KB |
Output is correct |
9 |
Correct |
79 ms |
384 KB |
Output is correct |
10 |
Correct |
80 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
88 ms |
384 KB |
Output is correct |
17 |
Correct |
86 ms |
384 KB |
Output is correct |
18 |
Correct |
89 ms |
384 KB |
Output is correct |
19 |
Correct |
86 ms |
504 KB |
Output is correct |
20 |
Correct |
87 ms |
504 KB |
Output is correct |
21 |
Correct |
90 ms |
384 KB |
Output is correct |
22 |
Correct |
88 ms |
384 KB |
Output is correct |
23 |
Correct |
90 ms |
384 KB |
Output is correct |
24 |
Correct |
86 ms |
384 KB |
Output is correct |
25 |
Correct |
89 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
5 ms |
384 KB |
Output is correct |
29 |
Correct |
4 ms |
384 KB |
Output is correct |
30 |
Correct |
5 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
4 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
90 ms |
384 KB |
Output is correct |
37 |
Correct |
92 ms |
384 KB |
Output is correct |
38 |
Correct |
93 ms |
384 KB |
Output is correct |
39 |
Correct |
90 ms |
384 KB |
Output is correct |
40 |
Correct |
89 ms |
384 KB |
Output is correct |
41 |
Correct |
94 ms |
384 KB |
Output is correct |
42 |
Correct |
90 ms |
384 KB |
Output is correct |
43 |
Correct |
88 ms |
384 KB |
Output is correct |
44 |
Correct |
93 ms |
384 KB |
Output is correct |
45 |
Correct |
91 ms |
384 KB |
Output is correct |
46 |
Correct |
92 ms |
384 KB |
Output is correct |
47 |
Correct |
90 ms |
384 KB |
Output is correct |
48 |
Execution timed out |
2088 ms |
512 KB |
Time limit exceeded |
49 |
Halted |
0 ms |
0 KB |
- |