#include <bits/stdc++.h>
using namespace std;
struct Point {
double pos;
int64_t x, y, w;
};
int main() {
//freopen("in.txt", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
int N;
vector<Point> P;
cin >> N;
P.resize(N);
for (int i = 0; i < N; ++i) {
cin >> P[i].x >> P[i].y >> P[i].w;
}
int64_t max_sum = 0;
// For each axis
for (int i = 0; i < N - 1; ++i) {
for (int j = i + 1; j < N; ++j) {
double ux = P[j].x - P[i].x;
double uy = P[j].y - P[i].y;
for (auto& p : P) {
p.pos = double(uy * p.x - ux * p.y + P[j].x * P[i].y - P[j].y * P[i].x) / (ux * ux + uy * uy);
}
sort(P.begin(), P.end(), [](const Point& lhs, const Point& rhs) -> bool {
return lhs.pos < rhs.pos;
});
for (int64_t i = 0, sum = 0; i < N;) {
double pos = P[i].pos;
int64_t w = 0;
while (abs(P[i].pos - pos) < 0.0001 && i < N) {
w += P[i].w;
++i;
}
if (sum < 0) {
sum = w;
} else {
sum += w;
}
max_sum = max(max_sum, sum);
}
}
}
cout << max_sum << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
384 KB |
Output is correct |
2 |
Correct |
27 ms |
384 KB |
Output is correct |
3 |
Correct |
27 ms |
384 KB |
Output is correct |
4 |
Correct |
27 ms |
384 KB |
Output is correct |
5 |
Correct |
28 ms |
384 KB |
Output is correct |
6 |
Correct |
28 ms |
384 KB |
Output is correct |
7 |
Correct |
28 ms |
384 KB |
Output is correct |
8 |
Correct |
26 ms |
384 KB |
Output is correct |
9 |
Correct |
28 ms |
384 KB |
Output is correct |
10 |
Correct |
27 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
384 KB |
Output is correct |
2 |
Correct |
27 ms |
384 KB |
Output is correct |
3 |
Correct |
27 ms |
384 KB |
Output is correct |
4 |
Correct |
27 ms |
384 KB |
Output is correct |
5 |
Correct |
28 ms |
384 KB |
Output is correct |
6 |
Correct |
28 ms |
384 KB |
Output is correct |
7 |
Correct |
28 ms |
384 KB |
Output is correct |
8 |
Correct |
26 ms |
384 KB |
Output is correct |
9 |
Correct |
28 ms |
384 KB |
Output is correct |
10 |
Correct |
27 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
384 KB |
Output is correct |
2 |
Correct |
27 ms |
384 KB |
Output is correct |
3 |
Correct |
27 ms |
384 KB |
Output is correct |
4 |
Correct |
27 ms |
384 KB |
Output is correct |
5 |
Correct |
28 ms |
384 KB |
Output is correct |
6 |
Correct |
28 ms |
384 KB |
Output is correct |
7 |
Correct |
28 ms |
384 KB |
Output is correct |
8 |
Correct |
26 ms |
384 KB |
Output is correct |
9 |
Correct |
28 ms |
384 KB |
Output is correct |
10 |
Correct |
27 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |