#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, V[0]));
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
bulldozer.cpp: In function 'int main()':
bulldozer.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
~~~~~^~~~~~~~~~
bulldozer.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lf %lf %lld", &X[i], &Y[i], &V[i]);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
384 KB |
Output is correct |
2 |
Correct |
44 ms |
364 KB |
Output is correct |
3 |
Correct |
29 ms |
256 KB |
Output is correct |
4 |
Correct |
30 ms |
384 KB |
Output is correct |
5 |
Correct |
28 ms |
256 KB |
Output is correct |
6 |
Correct |
30 ms |
384 KB |
Output is correct |
7 |
Correct |
30 ms |
360 KB |
Output is correct |
8 |
Correct |
31 ms |
384 KB |
Output is correct |
9 |
Correct |
29 ms |
356 KB |
Output is correct |
10 |
Correct |
29 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
256 KB |
Output is correct |
2 |
Correct |
59 ms |
376 KB |
Output is correct |
3 |
Correct |
58 ms |
384 KB |
Output is correct |
4 |
Correct |
58 ms |
256 KB |
Output is correct |
5 |
Correct |
60 ms |
476 KB |
Output is correct |
6 |
Correct |
60 ms |
256 KB |
Output is correct |
7 |
Correct |
59 ms |
384 KB |
Output is correct |
8 |
Correct |
60 ms |
356 KB |
Output is correct |
9 |
Correct |
56 ms |
400 KB |
Output is correct |
10 |
Correct |
69 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
20 |
Correct |
2 ms |
256 KB |
Output is correct |
21 |
Correct |
51 ms |
256 KB |
Output is correct |
22 |
Correct |
50 ms |
376 KB |
Output is correct |
23 |
Correct |
51 ms |
384 KB |
Output is correct |
24 |
Correct |
51 ms |
384 KB |
Output is correct |
25 |
Correct |
51 ms |
384 KB |
Output is correct |
26 |
Correct |
50 ms |
376 KB |
Output is correct |
27 |
Correct |
51 ms |
384 KB |
Output is correct |
28 |
Correct |
50 ms |
256 KB |
Output is correct |
29 |
Correct |
50 ms |
256 KB |
Output is correct |
30 |
Correct |
50 ms |
376 KB |
Output is correct |
31 |
Correct |
51 ms |
396 KB |
Output is correct |
32 |
Correct |
51 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
256 KB |
Output is correct |
2 |
Correct |
59 ms |
376 KB |
Output is correct |
3 |
Correct |
58 ms |
384 KB |
Output is correct |
4 |
Correct |
58 ms |
256 KB |
Output is correct |
5 |
Correct |
60 ms |
476 KB |
Output is correct |
6 |
Correct |
60 ms |
256 KB |
Output is correct |
7 |
Correct |
59 ms |
384 KB |
Output is correct |
8 |
Correct |
60 ms |
356 KB |
Output is correct |
9 |
Correct |
56 ms |
400 KB |
Output is correct |
10 |
Correct |
69 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
20 |
Correct |
2 ms |
256 KB |
Output is correct |
21 |
Correct |
51 ms |
256 KB |
Output is correct |
22 |
Correct |
50 ms |
376 KB |
Output is correct |
23 |
Correct |
51 ms |
384 KB |
Output is correct |
24 |
Correct |
51 ms |
384 KB |
Output is correct |
25 |
Correct |
51 ms |
384 KB |
Output is correct |
26 |
Correct |
50 ms |
376 KB |
Output is correct |
27 |
Correct |
51 ms |
384 KB |
Output is correct |
28 |
Correct |
50 ms |
256 KB |
Output is correct |
29 |
Correct |
50 ms |
256 KB |
Output is correct |
30 |
Correct |
50 ms |
376 KB |
Output is correct |
31 |
Correct |
51 ms |
396 KB |
Output is correct |
32 |
Correct |
51 ms |
256 KB |
Output is correct |
33 |
Execution timed out |
2053 ms |
512 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
256 KB |
Output is correct |
2 |
Correct |
59 ms |
376 KB |
Output is correct |
3 |
Correct |
58 ms |
384 KB |
Output is correct |
4 |
Correct |
58 ms |
256 KB |
Output is correct |
5 |
Correct |
60 ms |
476 KB |
Output is correct |
6 |
Correct |
60 ms |
256 KB |
Output is correct |
7 |
Correct |
59 ms |
384 KB |
Output is correct |
8 |
Correct |
60 ms |
356 KB |
Output is correct |
9 |
Correct |
56 ms |
400 KB |
Output is correct |
10 |
Correct |
69 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
20 |
Correct |
2 ms |
256 KB |
Output is correct |
21 |
Correct |
51 ms |
256 KB |
Output is correct |
22 |
Correct |
50 ms |
376 KB |
Output is correct |
23 |
Correct |
51 ms |
384 KB |
Output is correct |
24 |
Correct |
51 ms |
384 KB |
Output is correct |
25 |
Correct |
51 ms |
384 KB |
Output is correct |
26 |
Correct |
50 ms |
376 KB |
Output is correct |
27 |
Correct |
51 ms |
384 KB |
Output is correct |
28 |
Correct |
50 ms |
256 KB |
Output is correct |
29 |
Correct |
50 ms |
256 KB |
Output is correct |
30 |
Correct |
50 ms |
376 KB |
Output is correct |
31 |
Correct |
51 ms |
396 KB |
Output is correct |
32 |
Correct |
51 ms |
256 KB |
Output is correct |
33 |
Execution timed out |
2053 ms |
512 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
384 KB |
Output is correct |
2 |
Correct |
44 ms |
364 KB |
Output is correct |
3 |
Correct |
29 ms |
256 KB |
Output is correct |
4 |
Correct |
30 ms |
384 KB |
Output is correct |
5 |
Correct |
28 ms |
256 KB |
Output is correct |
6 |
Correct |
30 ms |
384 KB |
Output is correct |
7 |
Correct |
30 ms |
360 KB |
Output is correct |
8 |
Correct |
31 ms |
384 KB |
Output is correct |
9 |
Correct |
29 ms |
356 KB |
Output is correct |
10 |
Correct |
29 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
57 ms |
256 KB |
Output is correct |
17 |
Correct |
59 ms |
376 KB |
Output is correct |
18 |
Correct |
58 ms |
384 KB |
Output is correct |
19 |
Correct |
58 ms |
256 KB |
Output is correct |
20 |
Correct |
60 ms |
476 KB |
Output is correct |
21 |
Correct |
60 ms |
256 KB |
Output is correct |
22 |
Correct |
59 ms |
384 KB |
Output is correct |
23 |
Correct |
60 ms |
356 KB |
Output is correct |
24 |
Correct |
56 ms |
400 KB |
Output is correct |
25 |
Correct |
69 ms |
256 KB |
Output is correct |
26 |
Correct |
2 ms |
384 KB |
Output is correct |
27 |
Correct |
2 ms |
256 KB |
Output is correct |
28 |
Correct |
2 ms |
256 KB |
Output is correct |
29 |
Correct |
2 ms |
256 KB |
Output is correct |
30 |
Correct |
2 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |
33 |
Correct |
2 ms |
256 KB |
Output is correct |
34 |
Correct |
2 ms |
256 KB |
Output is correct |
35 |
Correct |
2 ms |
256 KB |
Output is correct |
36 |
Correct |
51 ms |
256 KB |
Output is correct |
37 |
Correct |
50 ms |
376 KB |
Output is correct |
38 |
Correct |
51 ms |
384 KB |
Output is correct |
39 |
Correct |
51 ms |
384 KB |
Output is correct |
40 |
Correct |
51 ms |
384 KB |
Output is correct |
41 |
Correct |
50 ms |
376 KB |
Output is correct |
42 |
Correct |
51 ms |
384 KB |
Output is correct |
43 |
Correct |
50 ms |
256 KB |
Output is correct |
44 |
Correct |
50 ms |
256 KB |
Output is correct |
45 |
Correct |
50 ms |
376 KB |
Output is correct |
46 |
Correct |
51 ms |
396 KB |
Output is correct |
47 |
Correct |
51 ms |
256 KB |
Output is correct |
48 |
Execution timed out |
2053 ms |
512 KB |
Time limit exceeded |
49 |
Halted |
0 ms |
0 KB |
- |