QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#605736#9227. Henry the Plumberucup-team3215#WA 1ms3612kbC++231.8kb2024-10-02 19:15:502024-10-02 19:15:54

Judging History

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

  • [2024-10-02 19:15:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3612kb
  • [2024-10-02 19:15:50]
  • 提交

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, T y, T z) : 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>;

bool online(vec3d p, vec3d a, vec3d b) {
    return a.cross(p, b).isnull();
}

void solve() {
    pii x, y, z, p, q, d;
    for (int i : {0, 1}) {
        cin >> x[i] >> y[i] >> z[i] >> p[i] >> q[i];
        d[i] = -(p[i] * x[i] + q[i] * y[i]);
    }
    vec3d a(p[0], q[0], 0), b(p[1], q[1], 0), e(x[0], y[0], z[0]), f(x[1], y[1], z[1]);
    if (p[0] * x[1] + q[0] * y[1] + d[0] == 0) {
        if (a.dot(b) == 0) {
            cout << (online(e, f, f + b) ? 4 : 3) << '\n';
        } else {
            cout << (a.cross(b).isnull() ? 2 : 3) << '\n';
        }
    } else if (p[1] * x[0] + q[1] * y[0] + d[1] == 0) {
        if (a.dot(b) == 0) {
            cout << (online(f, e, e + a) ? 4 : 3) << '\n';
        } else {
            cout << (a.cross(b).isnull() ? 2 : 3) << '\n';
        }
    } else if (a.dot(b) == 0) {
        cout << 3 << '\n';
    } else if (a.cross(b).isnull()) {
        cout << 4 << '\n';
    } else {
        cout << (z[0] == z[1] ? 5 : 4) << '\n';
    }
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}

详细

Test #1:

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

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: 1ms
memory: 3612kb

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:

4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
5
4
4
4
4
4

result:

wrong answer 7th numbers differ - expected: '3', found: '4'