QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#605981#9227. Henry the Plumberucup-team3215#WA 1ms3724kbC++231.8kb2024-10-02 21:07:302024-10-02 21:07:30

Judging History

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

  • [2024-10-02 21:07:30]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3724kb
  • [2024-10-02 21:07:30]
  • 提交

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 &&p[1] * x[0] + q[1] * y[0] + d[1] == 0) {
        cout << "2\n";
    } else 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 << 3 + (z[0] == z[1]) << '\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 << 3 + (z[0] == z[1]) << '\n';
        }
    } else if (a.dot(b) == 0) {
        cout << 3 << '\n';
    } else {
        cout << 4 << '\n';
    }
}

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

詳細信息

Test #1:

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

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

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
4
4
4
4
4
4

result:

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