답안 #1117595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1117595 2024-11-24T06:32:32 Z Pannda Bulldozer (JOI17_bulldozer) C++17
5 / 100
2 ms 524 KB
#include <bits/stdc++.h>
using namespace std;

typedef complex<long long> point;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<pair<point, int>> a;
    for (int i = 0; i < n; i++) {
        int x, y, w;
        cin >> x >> y >> w;
        a.emplace_back(point(x, y), w);
    }

    if (n == 1) {
        cout << max(0, a[0].second) << '\n';
        return 0;
    }

    sort(a.begin(), a.end(), [&](auto x, auto y) {
        if (x.first.real() != y.first.real()) return x.first.real() < y.first.real();
        return x.first.imag() < y.first.imag();
    });

    long long ans = 0;
    for (int i = 1; i < n; i++) {
        point line = a[i].first - a[0].first;
        vector<pair<point, int>> b = a;
        sort(b.begin(), b.end(), [&](auto xw, auto yw) {
            point x = xw. first, y = yw.first;
            point X(line.real() * x.real() + line.imag() * x.imag(), -line.imag() * x.real() + line.real() * x.imag());
            point Y(line.real() * y.real() + line.imag() * y.imag(), -line.imag() * y.real() + line.real() * y.imag());
            if (X.real() != Y.real()) return X.real() < Y.real();
            return X.imag() < Y.imag();
        });
        long long sum = 0;
        long long mnsum = 0;
        for (auto [p, w] : b) {
            sum += w;
            ans = max(ans, sum - mnsum);
            mnsum = min(mnsum, sum);
        }
    }

    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 524 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 524 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Incorrect 2 ms 336 KB Output isn't correct
17 Halted 0 ms 0 KB -