답안 #78928

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
78928 2018-10-09T16:01:16 Z ekrem Bulldozer (JOI17_bulldozer) C++
0 / 100
63 ms 504 KB
#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

bulldozer.cpp: In function 'int main()':
bulldozer.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
bulldozer.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",x + i, y + i, z + i);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 392 KB Output is correct
2 Correct 61 ms 396 KB Output is correct
3 Correct 61 ms 384 KB Output is correct
4 Correct 63 ms 384 KB Output is correct
5 Correct 61 ms 504 KB Output is correct
6 Correct 61 ms 356 KB Output is correct
7 Correct 61 ms 304 KB Output is correct
8 Correct 62 ms 384 KB Output is correct
9 Correct 62 ms 424 KB Output is correct
10 Correct 61 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Incorrect 2 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 392 KB Output is correct
2 Correct 61 ms 396 KB Output is correct
3 Correct 61 ms 384 KB Output is correct
4 Correct 63 ms 384 KB Output is correct
5 Correct 61 ms 504 KB Output is correct
6 Correct 61 ms 356 KB Output is correct
7 Correct 61 ms 304 KB Output is correct
8 Correct 62 ms 384 KB Output is correct
9 Correct 62 ms 424 KB Output is correct
10 Correct 61 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Incorrect 2 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 392 KB Output is correct
2 Correct 61 ms 396 KB Output is correct
3 Correct 61 ms 384 KB Output is correct
4 Correct 63 ms 384 KB Output is correct
5 Correct 61 ms 504 KB Output is correct
6 Correct 61 ms 356 KB Output is correct
7 Correct 61 ms 304 KB Output is correct
8 Correct 62 ms 384 KB Output is correct
9 Correct 62 ms 424 KB Output is correct
10 Correct 61 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Incorrect 2 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -