QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#537724#7521. Find the GapOIer_kzc#WA 8ms2032kbC++171.3kb2024-08-30 17:47:362024-08-30 17:47:36

Judging History

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

  • [2024-08-30 17:47:36]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:2032kb
  • [2024-08-30 17:47:36]
  • 提交

answer

#include <stdio.h>
#include <string.h>

#include <cmath>
#include <algorithm>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long LL;
typedef long double LDB;
constexpr int N = 1000005;

int n;
struct Vec {
	LL x, y, z;
	Vec operator - (const Vec &t) const {
		return (Vec){x - t.x, y - t.y, z - t.z};
	}
	Vec operator * (const Vec &t) const {
		return (Vec){y * t.z - z * t.y, x * t.z - z * t.x, x * t.y - y * t.x};
	}
	LL operator & (const Vec &t) const {
		return x * t.x + y * t.y + z * t.z;
	}
	LDB md() const {
		return sqrtl(x * x + y * y + z * z);
	}
} w[N];
LDB res = 1e36;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d%d%d", &w[i].x, &w[i].y, &w[i].z);
	}
	for (int k = 0; k < n; ++k) {
		LL maxv = 0;
		auto chk = [&](const Vec &t) {
			for (int i = 0; i < n; ++i) {
				LL v = (w[i] - w[k]) & t;
				if (v < 0) {
					return false;
				}
				if (v > maxv) {
					maxv = v;
				}
			}
			return true;
		};
		for (int i = k + 1; i < n; ++i) {
			for (int j = k + 1; j < n; ++j) {
				if (i == j) {
					continue;
				}
				Vec m = (w[i] - w[k]) * (w[j] - w[k]);
				if (!chk(m)) {
					continue;
				}
				res = min(res, maxv / m.md());
			}
		}
	}
	printf("%.15Lf\n", res);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 2032kb

input:

8
1 1 1
1 1 2
1 2 1
1 2 2
2 1 1
2 1 2
2 2 1
2 2 2

output:

1.000000000000000

result:

ok found '1.000000000', expected '1.000000000', error '0.000000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 1944kb

input:

5
1 1 1
1 2 1
1 1 2
1 2 2
2 1 1

output:

0.707106781186548

result:

ok found '0.707106781', expected '0.707106781', error '0.000000000'

Test #3:

score: -100
Wrong Answer
time: 8ms
memory: 2024kb

input:

50
973 1799 4431
1036 1888 4509
1099 1977 4587
1162 2066 4665
1225 2155 4743
1288 2244 4821
1351 2333 4899
1414 2422 4977
1540 2600 5133
1603 2689 5211
1666 2778 5289
1729 2867 5367
1792 2956 5445
1855 3045 5523
1918 3134 5601
1981 3223 5679
2044 3312 5757
2107 3401 5835
2170 3490 5913
2296 3668 606...

output:

1000000000000000042420637374017961984.000000000000000

result:

wrong answer 1st numbers differ - expected: '0.0000000', found: '1000000000000000042420637374017961984.0000000', error = '1000000000000000042420637374017961984.0000000'