QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#605695#9227. Henry the Plumberucup-team3215#WA 1ms3684kbC++231.3kb2024-10-02 18:48:162024-10-02 18:48:17

Judging History

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

  • [2024-10-02 18:48:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3684kb
  • [2024-10-02 18:48:16]
  • 提交

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 cross(v b) { return v(y * b.z - z * b.y, -(x * b.z - z * b.x), x * b.y - y * b.x); }
    bool isnull() { return x == 0 && y == 0 && z == 0; }
};

using vec3d = vec<ll>;

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);
    if (p[0] * x[1] + q[0] * y[1] + d[0] == 0 ||
        p[1] * x[0] + q[1] * y[0] + d[1] == 0) {
        if (a.dot(b) == 0) {
            cout << (z[0] == z[1] ? 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();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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'