QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#194740#7521. Find the Gapucup-team484#WA 233ms3828kbC++171.5kb2023-09-30 22:03:372023-09-30 22:03:38

Judging History

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

  • [2023-09-30 22:03:38]
  • 评测
  • 测评结果:WA
  • 用时:233ms
  • 内存:3828kb
  • [2023-09-30 22:03:37]
  • 提交

answer

#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define st first
#define nd second
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;

template<class T> struct Point3D {
  typedef Point3D P;
  typedef const P& R;
  T x, y, z;
  explicit Point3D(T x=0, T y=0, T z=0) : x(x), y(y), z(z) {}
  P operator+(R p) const { return P(x+p.x, y+p.y, z+p.z); }
  P operator-(R p) const { return P(x-p.x, y-p.y, z-p.z); }
  T dot(R p) const { return x*p.x + y*p.y + z*p.z; }
  P cross(R p) const {
    return P(y*p.z - z*p.y, z*p.x - x*p.z, x*p.y - y*p.x);
  }
};

typedef Point3D<ll> P3;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	if (n <= 3) {
		cout << "0.0\n";
		return 0;
	}
	vector<P3> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i].x >> a[i].y >> a[i].z;
	ld ans = 1e18;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				P3 dir = (a[j] - a[i]).cross(a[k] - a[i]);
				int x = 0, y = 0;
				ld cur = 0, len = sqrtl(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z);
				for (int l = 0; l < n; l++) {
					ll val = dir.dot(a[l] - a[i]);
					x += val < 0;
					y += val > 0;
					cur = max(cur, (ld)abs(val) / len);
				}
				if (x > 0 && y > 0)
					continue;
				ans = min(ans, cur);
			}
		}
	}
	cout << fixed << setprecision(15) << ans << "\n";
}

詳細信息

Test #1:

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

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: 3812kb

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: 233ms
memory: 3752kb

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:

1000000000000000000.000000000000000

result:

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