QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#606010 | #9227. Henry the Plumber | ucup-team3215# | WA | 0ms | 3704kb | C++23 | 1.6kb | 2024-10-02 21:28:29 | 2024-10-02 21:28:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
using vi = vector<int>;
using pii = array<int, 2>;
using ll = long long;
template<class T>
struct vec {
T x, y, z;
using v = vec<T>;
vec(T x = 0, T y = 0, T z = 0) : x(x), y(y), z(z) {}
T dot(v b) { return x * b.x + y * b.y + z * b.z; }
vec operator+(v b) {return v(x + b.x, y + b.y, z + b.z); }
vec operator-(v b) {return v(x - b.x, y - b.y, z - b.z); }
vec cross(v b) { return v(y * b.z - z * b.y, -(x * b.z - z * b.x), x * b.y - y * b.x); }
vec cross(v a, v b) { return (a - *this).cross(b - *this); }
bool isnull() { return x == 0 && y == 0 && z == 0; }
};
using vec3d = vec<ll>;
struct plane {
ll a, b, c, d;
bool onplane(vec3d v) {
return v.x * a + v.y * b + v.z * c + d == 0;
}
};
void solve() {
array<vec3d, 2> p, v;
array<plane, 2> pl;
for (int i : {0, 1}) {
cin >> p[i].x >> p[i].y >> p[i].z >> v[i].x >> v[i].y;
v[i].z = 0;
pl[i] = {v[i].x, v[i].y, 0, -(p[i].x * v[i].x + p[i].y * v[i].y)};
}
int ans = -1;
if (pl[0].onplane(p[1]) && pl[1].onplane(p[0])) {
ans = 2;
} else if (pl[0].onplane(p[1]) || pl[1].onplane(p[1])) {
ans = 3 + (p[0].z == p[1].z);
} else if (v[0].dot(v[1]) == 0) {
ans = 3;
} else if (v[0].cross(v[1]).isnull()) {
ans = 4;
} else {
ans = 4 + (p[0].z == p[1].z);
}
cout << ans << '\n';
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3704kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 3
result:
ok 2 number(s): "4 3"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
100 -13 -5 -7 -19 19 -19 -13 0 -7 15 -20 20 19 -17 18 20 -20 -1 18 -19 -18 15 -14 -19 18 19 -20 6 20 -19 -12 9 1 7 -16 -13 -14 -8 8 -13 -19 16 9 20 -19 19 -18 -11 19 -18 19 20 -8 12 20 -11 -9 18 -19 -18 8 11 -13 12 -18 18 13 8 4 -18 -16 20 17 -19 18 20 -18 -3 20 -19 -17 -20 -5 -18 -19 19 16 15 19 20...
output:
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 3 3 3 3 3
result:
wrong answer 1st numbers differ - expected: '4', found: '3'