QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#472540#6412. Classical Geometry ProblemUESTC_DECAYALI#WA 0ms3832kbC++173.0kb2024-07-11 17:03:272024-07-11 17:03:27

Judging History

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

  • [2024-07-11 17:03:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-07-11 17:03:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long

using LD = long double;
LD eps = 1e-8;
LD sqr(LD x){return x*x;}
int sgn(LD x){return fabs(x)<=eps ? 0 : (x>eps ? 1 : -1);}

struct Pt{
    LD x, y, z;
    Pt operator*(const LD &b)const{return Pt{x*b, y*b, z*b};}
    Pt operator-(const Pt &b)const{return Pt{x-b.x, y-b.y, z-b.z};}
    Pt operator+(const Pt &b)const{return Pt{x+b.x, y+b.y, z+b.z};}
    LD len()const{return sqrt(x*x+y*y+z*z);}
    Pt unit()const{return (*this)*(1/len());}
};

int t;
signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(10);
    cin >> t;
    while (t--){
        Pt T0, C0, V0, T1, C1, V1, T2;
        int tz1, ty2;
        int m=3;
        cin >> T0.x >> T0.y >> T0.z;

        if (0==sgn(T0.x) || 0==sgn(T0.x-255) || 0==sgn(T0.y) || 0==sgn(T0.y-255) || 0==sgn(T0.z) || 0==sgn(T0.z-255)){
            tz1 = (int)T0.z, ty2 = (int)T0.y;
            m=1;
            if (255==tz1) ++m;
            if (255==ty2) ++m;
            printf("%lld\n", m);
            if (tz1==255) printf("0 0 255 255\n");
            if (ty2==255) printf("0 255 %lld 255\n", tz1);
            printf("255 %lld %lld %.10Lf\n", ty2, tz1, abs(T0.x));
            continue;
        }

        C0.x = (T0.x <= 127 ? 0 : 255);
        C0.y = (T0.y <= 127 ? 0 : 255);
        C0.z = (T0.z > 127 ? 0 : 255);
        tz1 = (T0.z <= 127 ? 0 : 255);
        if (255==tz1) ++m;
        LD tt1;
        if (sgn(T0.z-C0.z)==0) tt1=0;
        else{
            V0 = (T0-C0).unit();
            tt1 = (tz1-T0.z)/V0.z;
        }
        T1 = T0 + V0*tt1;

        C1.z = tz1;
        C1.x = (sgn(T1.y-T1.x)>=0 ? 0 : 255);
        C1.y = (sgn(T1.y-T1.x)>=0 ? 0 : 255);
        ty2 = (sgn(T1.y-T1.x)<0 ? 0 : 255);
        if (255==ty2) ++m;
        LD tt2;
        if (sgn(T1.y-C1.y)==0) tt2=0;
        else{
            V1 = (T1-C1).unit();
            tt2 = (ty2-T1.y)/V1.y;
        }
        T2 = T1 + V1*tt2;

        // printf("tz1=%lld ty2=%lld\n", tz1, ty2);
        // printf("T2(%Lf %Lf %Lf)\n", T2.x, T2.y, T2.z);
        // printf("V1(%Lf %Lf %Lf)\n", V1.x, V1.y, V1.z);
        // printf("T1(%Lf %Lf %Lf)\n", T1.x, T1.y, T1.z);
        // printf("V0(%Lf %Lf %Lf)\n", V0.x, V0.y, V0.z);
        // printf("T0(%Lf %Lf %Lf)\n", T0.x, T0.y, T0.z);
        printf("%lld\n", m);
        if (tz1==255) printf("0 0 255 255\n");
        if (ty2==255) printf("0 255 %lld 255\n", tz1);
        printf("255 %lld %lld %.10Lf\n", ty2, tz1, abs(T2.x));
        // cout << 255 << ' ' << ty2 << ' ' << tz1 << ' ' << abs(T2.x) << '\n';
        printf("%lld %lld %lld %.10Lf\n", (int)C1.x, (int)C1.y, (int)C1.z, abs(tt2));
        // cout << C1.x << ' ' << C1.y << ' ' << C1.z << ' ' << abs(tt2) << '\n';
        printf("%lld %lld %lld %.10Lf\n", (int)C0.x, (int)C0.y, (int)C0.z, abs(tt1));
        // cout << C0.x << ' ' << C0.y << ' ' << C0.z << ' ' << abs(tt1) << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3832kb

input:

3
105 255 175
174 174 174
0 0 0

output:

2
0 255 175 255
255 255 175 105.0000000000
5
0 0 255 255
0 255 255 255
255 255 255 255.0000000000
0 0 255 167.8769030507
255 255 0 96.9774205427
1
255 0 0 0.0000000000

result:

wrong answer to[1][3] is equal to neither 0 nor 255 (test case 1)