Submission #697519

# Submission time Handle Problem Language Result Execution time Memory
697519 2023-02-10T08:12:37 Z vjudge1 Mobile (BOI12_mobile) C++17
0 / 100
40 ms 16552 KB
// euzubillahimineşşeytanirracimbismillahirrahmanirrahim
//    <- bak boşluk tuşun çalışıyo niye kullanmıyon

#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define pii pair<int ,int>
#define st first
#define nd second
#define sp " "
#define endl "\n"
#define N 1000005
#define int long long

int x[N], y[N];
double l[N], r[N], sq[N];
const int INF = 1e18 + 7;

int32_t main()
{
	#ifndef ONLINE_JUDGE
	fileio();
	#endif
	fastio();

	queue<int> q;
	int n, L;
	cin >> n >> L;
	for (int i = 1; i <= n; i++)
	{
		cin >> x[i] >> y[i];
		sq[i] = x[i] * x[i] + y[i] * y[i];
	}

	q.push(1);
	l[1] = 0, r[1] = L;
	for (int i = 1; i <= n; i++)
	{
		int last = q.front();
		if (x[i] == x[last]) continue;
		l[i] = INF;
		double p = (sq[i] - sq[last]) / (2 * (x[i] - x[last]));
		p = max(p, (double)0);
		while (p < l[last])
		{
			q.pop();
			if (q.empty()) continue;
			last = q.front();
			p = (sq[i] - sq[last]) / (2 * (x[i] - x[last]));
			p = max(p, (double)0);
		}
		if (!q.empty())
		{
			int last = q.front();
			p = (sq[i] - sq[last]) / (2 * (x[i] - x[last]));
			p = max(p, (double)0);
			r[last] = p;
		}
		l[i] = p;
		r[i] = L;
		if (l[i] <= r[i]) q.push(i);
	}

	double ans = 0;
	for (int i = 1; i <= n; i++)
	{
		double gh = abs(x[i] - r[i]);
		double dist = y[i] * y[i] + gh * gh;
		ans = max(ans, dist);
		gh = abs(x[i] - l[i]);
		dist = y[i] * y[i] + gh * gh;
		ans = max(ans, dist);
	}

	double res = sqrt(ans);
	printf("%.5f\n", res);

	cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n";
}

Compilation message

mobile.cpp: In function 'int32_t main()':
mobile.cpp:6:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:24:2: note: in expansion of macro 'fileio'
   24 |  fileio();
      |  ^~~~~~
mobile.cpp:6:59: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
      |                                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:24:2: note: in expansion of macro 'fileio'
   24 |  fileio();
      |  ^~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 16500 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 16460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 16420 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 16460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16456 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16436 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 16460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 16460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 16480 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16500 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 16552 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 16504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 16456 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 32 ms 16504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 16456 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 16524 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 16532 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -