# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338517 | 2020-12-23T10:09:06 Z | KazamaHoang | Bulldozer (JOI17_bulldozer) | C++14 | 328 ms | 364 KB |
/* -> Written by <- ----------- K_A_Z_A_M_A ___________ _ | | (^_^) | | /( | )\ | |____|_|____| H O A N G */ #include <bits/stdc++.h> #define Task "" #define F first #define S second #define pb push_back #define bit(x, i) ((x >> (i)) & 1) #define inf 1e9 + 7 #define INF 1e18 + 7 #define ll long long #define pii pair <int, int> #define debug(x) cerr << #x << " is " << x << "\n"; using namespace std; const int MOD = 1e9 + 7; const int maxn = 1e5 + 5; int n; pair <pii, int> a[maxn]; struct LINE{ ll A, B, C; }; pii Vt(pair<pii, int> p, pair<pii, int> q){ return {q.F.F - p.F.F, q.F.S - p.F.S}; } LINE Make_Line(pair<pii, int> p, pair<pii, int> q){ pii u = Vt(p, q); LINE c; c.A = u.S; c.B = - u.F; c.C = 1ll * p.F.S * u.F - 1ll * p.F.F * u.S; return c; } ll DisToLine(pair<pii, int> p, LINE d){ return abs(1ll * d.A * p.F.F + 1ll * d.B * p.F.S + d.C); } void Solve(){ cin >> n; for (int i = 1; i <= n; ++ i){ int x, y, w; cin >> x >> y >> w; a[i] = {{x, y}, w}; } ll res = 0; for (int i = 1; i < n; ++ i){ for (int j = i + 1; j <= n; ++ j){ LINE l = Make_Line(a[i], a[j]); for (int h = 1; h <= n; ++ h) if (h != i && h != j){ ll sdh = 1ll * l.A * a[h].F.F + 1ll * l.B * a[h].F.S + l.C; ll c = DisToLine(a[h], l); ll ans = 0; for (int k = 1; k <= n; ++ k) if (k != i && k != j && k != h){ ll sdk = 1ll * l.A * a[k].F.F + 1ll * l.B * a[k].F.S + l.C; if (sdh > 0 && sdk < 0) continue; if (sdh < 0 && sdk > 0) continue; ll d = DisToLine(a[k], l); if (c >= d) ans += a[k].S; } res = max(res, ans + a[i].S + a[j].S + a[h].S); } } } cout << res; } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); if(fopen(Task".inp", "r")){ freopen(Task".inp","r",stdin); freopen(Task".out","w",stdout); } int test_case = 1; // cin >> test_case; while (test_case --){ Solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 207 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 328 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 328 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 328 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 207 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |