Submission #114799

# Submission time Handle Problem Language Result Execution time Memory
114799 2019-06-02T23:37:05 Z luciocf Mobile (BOI12_mobile) C++14
0 / 100
120 ms 896 KB
#include <bits/stdc++.h>

#define ff first
#define ss second

using namespace std;

const int maxn = 5e3+10;

typedef pair<double, double> pt;

pt p[maxn];

pt get(pt a, pt b)
{
	double p = (b.ss*b.ss - a.ss*a.ss)/(b.ff-a.ff);
	double q = a.ff + b.ff;

	return {(p+q)/2.00, 0.00};
}

double dist(pt a, pt b)
{
	double d1 = a.ff-b.ff;
	double d2 = a.ss-b.ss;

	return sqrt(d1*d1 + d2*d2);
}

int main(void)
{
	int n, L;
	scanf("%d %d", &n, &L);

	for (int i = 1; i <= n; i++)
		scanf("%lf %lf", &p[i].ff, &p[i].ss);

	double aux1 = 2e18+10, aux2 = 2e18+10;

	for (int i = 1; i <= n; i++)
	{
		aux1 = min(aux1, dist({0.00, 0.00}, p[i]));
		aux2 = min(aux2, dist({L, 0.00}, p[i]));
	}

	double ans = max(aux1, aux2);

	for (int i = 1; i <= n; i++)
	{
		for (int j = i+1; j <= n; j++)
		{
			pt limit = get(p[i], p[j]);

			ans = max(ans, min(dist(limit, p[i]), dist(limit, p[j])));
		}
	}

	printf("%.9lf\n", ans);
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &L);
  ~~~~~^~~~~~~~~~~~~~~~~
mobile.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf %lf", &p[i].ff, &p[i].ss);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 384 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 476 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 116 ms 476 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 116 ms 384 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 796 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -