QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#572243#6401. Classic: N Real DNA Potszfasion#Compile Error//C++141.5kb2024-09-18 13:15:022024-09-18 13:15:03

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 13:15:03]
  • 评测
  • [2024-09-18 13:15:02]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const long long N = 3e6 + 20, M = 998244353;
#define eps 5e-12
#define int long long
// #define int __int128
#define ll long long
#define all(x) x.begin(), x.end()
#define endl '\n'
#define ls (p << 1)
#define rs ((p << 1) | 1)
#define f1 first
#define pb push_back
#define f2 second
#define IOS std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0), std::cout << std::fixed << std::setprecision(7);
int n;
double x[N], y[N], a[N], b[N];
int dp[N];
int read()
{
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9')
	{
		f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9')
	{
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	x *= f;
	return x;
}
void write(int x)
{
	if (x < 0)
	{
		putchar('-');
		x = -x;
	}
	if (x > 9)
		write(x / 10);
	putchar(x % 10 + '0');
}
signed main()
{
	eps*=5;
	IOS;
	int k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		cin >> x[i] >> y[i];
	double l , r = LLONG_MAX;
	l=-r;
	auto check = [&](double k1) -> bool
	{
		for (int i = 1; i <= n; i++)
			dp[i] = 0, a[i] = y[i] - k1 * x[i];
		int len = 0;
		for (int i = 1; i <= n; i++)
		{
			if (a[i] > b[len])
			{
				b[++len] = a[i];
			}
			else
			{
				b[lower_bound(b + 1, b + len + 1, a[i]) - b] = a[i];
			}
		}
		return len >= k;
	};
	//check(0.5);
	while (l < r - eps)
	{
		double mid = (l + r) / 2;
		if (check(mid))
			l = mid + eps * 0.01;
		else
			r = mid - eps * 0.01;
	}
	cout << l << endl;
	return false;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:49:14: error: lvalue required as left operand of assignment
   49 |         eps*=5;
      |              ^