Submission #482825

# Submission time Handle Problem Language Result Execution time Memory
482825 2021-10-26T13:14:12 Z rainboy Odašiljači (COCI20_odasiljaci) C++17
70 / 70
4 ms 204 KB
#include <math.h>
#include <stdio.h>
#include <string.h>

#define N	1000
#define INF	0x3f3f3f3f3f3f3f3fLL

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() {
	static int xx[N], yy[N];
	static long long dd[N];
	int n, m, i;
	long long ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d%d", &xx[i], &yy[i]);
	ans = 0;
	memset(dd, 0x3f, n * sizeof *dd), dd[0] = 0;
	for (m = 1; m <= n; m++) {
		int i_ = -1;

		for (i = 0; i < n; i++)
			if (dd[i] != -1 && (i_ == -1 || dd[i_] > dd[i]))
				i_ = i;
		ans = max(ans, dd[i_]);
		dd[i_] = -1;
		for (i = 0; i < n; i++)
			dd[i] = min(dd[i], (long long) (xx[i] - xx[i_]) * (xx[i] - xx[i_]) + (long long) (yy[i] - yy[i_]) * (yy[i] - yy[i_]));
	}
	printf("%f\n", sqrt(ans) / 2);
	return 0;
}

Compilation message

odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
odasiljaci.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf("%d%d", &xx[i], &yy[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 3 ms 204 KB Output is correct
9 Correct 4 ms 204 KB Output is correct
10 Correct 4 ms 204 KB Output is correct