# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27058 | RayaBurong25_1 | Bulldozer (JOI17_bulldozer) | C++14 | 61 ms | 396 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 <stdio.h>
#include <vector>
#include <map>
#include <math.h>
double X[2005], Y[2005];
long long V[2005];
std::map<long long, long long> M;
double dist(int i, int j)
{
return sqrt((X[i]-X[j])*(X[i]-X[j]) + (Y[i]-Y[j])*(Y[i]-Y[j]));
}
long long min(long long a, long long b)
{
return (a < b)?a:b;
}
long long max(long long a, long long b)
{
return (a > b)?a:b;
}
int main()
{
// freopen("test.in", "r", stdin);
// freopen("test.out", "w", stdout);
int N;
scanf("%d", &N);
int i, j, k;
for (i = 0; i < N; i++)
scanf("%lf %lf %lld", &X[i], &Y[i], &V[i]);
double a;
long long r;
std::map<long long, long long>::iterator it;
long long sum, summin, ans = 0;
if (N == 1)
{
printf("%lld", max(0, ans));
return 0;
}
for (i = 0; i < N; i++)
{
for (j = i + 1; j < N; j++)
{
M.clear();
a = acos((Y[j] - Y[i])/dist(i, j));
for (k = 0; k < N; k++)
{
r = (-sin(a)*X[k]-cos(a)*Y[k] + 0.5)*1000LL;
// printf("%lld\n", r);
M[r] += V[k];
}
sum = 0;
summin = 0;
for (it = M.begin(); it != M.end(); it++)
{
sum += it->second;
summin = min(summin, sum);
ans = max(ans, sum - summin);
}
}
}
printf("%lld", ans);
}
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... |