# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78928 | ekrem | Bulldozer (JOI17_bulldozer) | C++98 | 63 ms | 504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;
typedef long long ll;
int n, x[N], y[N], z[N];
ll ans;
map < double , ll > :: iterator it;
int main() {
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
scanf("%d",&n);
for(int i = 1; i <= n; i++)
scanf("%d %d %d",x + i, y + i, z + i);
for(int i = 1; i <= n; i++)
for(int j = i + 1; j <= n; j++){
if(x[i] == x[j])
continue;
map < double , ll > h;
double a = (double)(y[i] - y[j])/(double)(x[i] - x[j]);
double b = -1, c = -x[i]*a + y[i];
double bol = sqrt(a*a + b*b);
for(int k = 1; k <= n; k++){
double uz = (a*x[k] + b*y[k] + c)/bol;
h[uz] += z[k];
}
ll top = 0;
for(it = h.begin(); it != h.end(); it++){
top += it->nd;
top = max(0ll, top);
ans = max(ans, top);
}
}
cout << ans << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |