답안 #228059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
228059 2020-04-29T18:34:54 Z qkxwsm Bulldozer (JOI17_bulldozer) C++14
0 / 100
33 ms 384 KB
#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 long long 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
{
    ll x, y, w;
};

int N;
point arr[MAXN];
vpl angs;
ll ans;

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;
    }
    FOR(i, 0, N)
    {
        FOR(j, i + 1, N)
        {
            ll dx = arr[j].x - arr[i].x, dy = arr[i].y - arr[j].y;
            vpl ok;
            FOR(k, 0, N)
            {
                ok.PB({dy * arr[k].x + dx * arr[k].y, arr[k].w});
            }
            sort(ALL(ok));
            ll sum = 0;
            FOR(k, 0, N)
            {
                sum += ok[k].se;
                if (sum == 0) sum = 0;
                ckmax(ans, sum);
            }
            FOR(k, 0, N - 1)
            {
                if (ok[k].fi == ok[k + 1].fi)
                {
                    swap(ok[k], ok[k + 1]);
                    break;
                }
            }
            sum = 0;
            FOR(k, 0, N)
            {
                sum += ok[k].se;
                if (sum == 0) sum = 0;
                ckmax(ans, sum);
            }
        }
    }
    cout << ans << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -