QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#132309#5660. Simplified Genome Translationwillow#Compile Error//C++142.6kb2023-07-29 14:44:592023-07-29 14:45:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-29 14:45:01]
  • 评测
  • [2023-07-29 14:44:59]
  • 提交

answer

H
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
const int N = 2005;
const LL MOD = (1LL << 31) - 1;

template <typename T> inline void cmin(T &x, T y) {
	if (x > y) x = y;
}

struct Point {
	LD x, y;
	Point(LD _x = 0, LD _y = 0): x(_x), y(_y) {}
	Point operator + (const Point &rhs) const {
		return Point(x + rhs.x, y + rhs.y);
	}
	Point operator - (const Point &rhs) const {
		return Point(x - rhs.x, y - rhs.y);
	}
	LD operator ^ (const Point &rhs) const {
		return x * rhs.y - y * rhs.x;
	}
	LD operator * (const Point &rhs) const {
		return x * rhs.x + y * rhs.y;
	}
	Point operator * (const LD &rhs) const {
		return Point(x * rhs, y * rhs);
	}
	Point operator / (const LD &rhs) const {
		return Point(x / rhs, y / rhs);
	}
	inline LD len2() {
		return x * x + y * y;
	}
	inline LD len() {
		return sqrtl(len2());
	}
} p[N];

struct Circle {
	Point c;
	LD r;
	Circle() {}
	Circle(Point _c, LD _r): c(_c), r(_r) {}
};

Circle MakeCircle(Point a, Point b) {
	Point c = (a + b) * 0.5;
	LD r = (a - c).len();
	return Circle(c, r);
}

Circle MakeCircle(Point a, Point b, Point c) {
	Point p = b - a, q = c - a, s = Point(p * p / 2, q * q / 2);
	LD d = p ^ q;
	p = Point(s ^ Point(p.y, q.y), Point(p.x, q.x) ^ s) / d;
	return Circle(a + p, p.len());
}

bool PointInCircle(Circle c, Point p) {
	return c.r - (p - c.c).len() >= 0;
}

int n, k;
LL x1;
LD dp[N][N];

inline LL gen(LL x) {
	return (x * 233811181 + 1) % MOD;
}

void solve() {
	scanf("%d %d %lld", &n, &k, &x1);
	LL y1 = gen(x1);
	p[1] = Point(x1, y1);
	for (int i = 2; i <= n; ++i) {
		x1 = gen(y1);
		y1 = gen(x1);
		p[i] = Point(x1, y1);
	}
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= k; ++j) {
			dp[i][j] = 1e18;
		}
	}
	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		Circle cur = Circle(p[i], 0);
		for (int j = i + 1; j <= n; ++j) {
			if (!PointInCircle(cur, p[j])) {
//printf("%.10Lf\n", cur.r);
				for (int t = 0; t < k; ++t) {
					cmin(dp[j - 1][t + 1], dp[i][t] + cur.r);
				}
				cur = Circle(p[j], 0);
				for (int u = i; u < j; ++u) {
					if (!PointInCircle(cur, p[u])) {
						cur = MakeCircle(p[j], p[u]);
						for (int v = i; v < u; ++v) {
							if (!PointInCircle(cur, p[v])) {
								cur = MakeCircle(p[j], p[u], p[v]);
							}
						}
					}
				}
			}
		}
		for (int t = 0; t < k; ++t) {
			cmin(dp[n][t + 1], dp[i - 1][t] + cur.r);
		}
	}
	LD ans = 1e18;
	for (int i = 1; i <= k; ++i) {
		cmin(ans, dp[n][i]);
	}
	printf("%.10Lf\n", ans);
}

int main() {
	solve();
	return 0;
}

Details

answer.code:1:1: error: ‘H’ does not name a type
    1 | H
      | ^
In file included from /usr/include/c++/11/cmath:43,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:2:
/usr/include/c++/11/ext/type_traits.h:162:35: error: ‘bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  162 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/11/ext/type_traits.h:157:5: note: previous declaration ‘template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)’
  157 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/11/ext/type_traits.h:162:26: error: ‘nullptr_t’ is not a member of ‘std’
  162 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/11/bits/exception_ptr.h:40,
                 from /usr/include/c++/11/exception:147,
                 from /usr/include/c++/11/ios:39,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:2:
/usr/include/c++/11/new:126:26: error: declaration of ‘operator new’ as non-function
  126 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/11/new:126:44: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  126 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                            ^~~~~~
      |                                            time_t
/usr/include/c++/11/new:127:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  127 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/11/new:128:26: error: declaration of ‘operator new []’ as non-function
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/11/new:128:46: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                              ^~~~~~
      |                                              time_t
/usr/include/c++/11/new:129:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  129 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/11/new:135:34: error: ‘std::size_t’ has not been declared
  135 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                                  ^~~~~~
/usr/include/c++/11/new:137:36: error: ‘std::size_t’ has not been declared
  137 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                                    ^~~~~~
/usr/include/c++/11/new:140:26: error: declaration of ‘operator new’ as non-function
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/11/new:140:44: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                            ^~~~~~
      |                                            time_t
/usr/include/c++/11/new:140:52: error: expected primary-expression before ‘const’
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                    ^~~~~
/usr/include/c++/11/new:142:26: error: declaration of ‘operator new []’ as non-function
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/11/new:142:46: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                              ^~~~~~
      |                                              time_t
/usr/include/c++/11/new:142:54: error: expected primary-expression before ‘const’
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                      ^~~~~
/usr/include/c++/11/new:174:33: error: declaration of ‘operator new’ as non-function
  174 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
      |...