QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#396152#7073. Absolute SpacehazeAC ✓1ms4272kbC++235.2kb2024-04-22 13:54:582024-04-22 13:54:58

Judging History

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

  • [2024-04-22 13:54:58]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4272kb
  • [2024-04-22 13:54:58]
  • 提交

answer

//
// Created by DELLPC on 24-4-21.
//
#include<bits/stdc++.h>
using namespace std;
#define irep(i, l, r) for(int i = l; i <= r; ++ i)
#define drep(i, r, l) for(int i = r; i >= l; -- i)
const int N = 500000 +7;
const int mod = 1000000000 + 7;
#define ll long long
#define LD double

struct point{
    LD x, y, z;
    point(){}
    point(LD x1, LD y1, LD z1){
        x = x1, y = y1, z = z1;
    }
    point operator + (const point A)const{
        return point(x + A.x, y + A.y, z + A.z);
    }
};


point rot(point z0, LD t1, LD t2){
    auto [x, y, z] = z0;
    LD t = atan2(x, y), rho = sqrt(x * x + y * y);
    t += t1;
    x = rho * cos(t), y = rho * sin(t);
    t = atan2(x, z), rho = sqrt(x * x + z * z);
    t += t2;
    x = rho * cos(t), z = rho * sin(t);
    return point(x, y, z);
}
LD dis(point A, point B){
    return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) *(A.y - B.y) + (A.z - B.z) * (A.z - B.z));
}
void solve(){
    vector<vector<point>>base = {
            {},
            {{ 0.000000000,0.000000000,0.000000000},
             {1.000000000,0.000000000,0.000000000}},

            {{ 0.000000000,0.000000000,0.000000000},
                    {1.000000000,0.000000000,0.000000000},
                    {0.500000000,0.866025404,0.000000000}},
            {
                    {0.500000000,0.000000000,-0.353553391},
                    {-0.500000000,0.000000000,-0.353553391},
                    { 0.000000000,0.500000000,0.353553391},
                    { 0.000000000,-0.500000000,0.353553391}
            },
            {
                    {0.707106781,0.000000000,0.000000000},
                    {-0.707106781,0.000000000,0.000000000},
                    {0.000000000,0.707106781,0.000000000},
                    {0.000000000,-0.707106781,0.000000000},
                    {0.000000000,0.000000000,0.707106781},
                    {0.000000000,0.000000000,-0.707106781}
            },
            {
                    { 0.000000000, 0.500000000, 0.809016994},
                    { 0.000000000, -0.500000000, 0.809016994},
                    { 0.000000000, 0.500000000 ,-0.809016994},
                    { 0.000000000, -0.500000000 ,-0.809016994},
                    { 0.500000000, 0.809016994 ,0.000000000},
                    { 0.500000000, -0.809016994, 0.000000000},
                    { -0.500000000, 0.809016994 ,0.000000000},
                    { -0.500000000, -0.809016994, 0.000000000},
                    { 0.809016994, 0.000000000 ,0.500000000},
                    { 0.809016994, 0.000000000,-0.500000000},
                    { -0.809016994,0.000000000, 0.500000000},
                    { -0.809016994,0.000000000,-0.500000000}
            }
    };
    base.resize(11);
    int n;
    cin >> n;
    vector<array<int, 2>>add(11);
    add[6] = {3,3};
    add[7] = {3,4};
    add[8] = {4,4};
    add[9] = {8,1};
    add[10] = {6, 4};
    //16 * 6
    //32 * 3 = 96
    irep(i, 6, 10){
        vector<point>A, B;
        auto [p1, p2] = add[i];
        A = base[p1], B = base[p2];
        for(auto &L : A){
            if(n == 10)L = rot(L, -0.27, 0.3);
            else L = rot(L, 0.7, 0.85);

        }
//        base[i] = A;
        for(auto p:A){
            for(auto q : B){
                base[i].push_back(p + q);
            }
        }
    }
    cout << setprecision(12);

    cout << base[n].size() <<'\n';
    for(auto A : base[n]){
        cout << A.x << ' ' << A.y << ' ' << A.z << endl;
    }
    int K = base[n].size();
//    irep(i, 0, K - 1){
//        int cnt = 0;
//        irep(j, 0, K - 1){
//            if(dis(base[n][i], base[n][j]) < 1.000001 && dis(base[n][i], base[n][j]) >= 0.999999)
//                ++ cnt;
//           // cout << dis(base[n][i], base[n][j]) << endl;
//           if(i == j)continue;
//           assert(dis(base[n][i], base[n][j]) > 0.01);
//        }
//        cout << cnt << endl;
//    }
    return;
}

int main(){
    int T = 1;
//    cin >> T;
    while(T --){
        solve();
    }
    return 0;
}
/*
 2
 0.000000000 0.000000000 0.000000000
 1.000000000 0.000000000 0.000000000
3
{ 0.000000000,0.000000000,0.000000000},
 {1.000000000,0.000000000,0.000000000},
 {0.500000000,0.866025404,0.000000000}
 4
 {0.500000000,0.000000000,-0.353553391},
 {-0.500000000,0.000000000,-0.353553391},
{ 0.000000000,0.500000000,0.353553391},
{ 0.000000000,-0.500000000,0.353553391}
  6
 {0.707106781,0.000000000,0.000000000},
 {-0.707106781,0.000000000,0.000000000},
 {0.000000000,0.707106781,0.000000000},
 {0.000000000,-0.707106781,0.000000000},
 {0.000000000,0.000000000,0.707106781},
 {0.000000000,0.000000000,-0.707106781}

12
{ 0.000000000, 0.500000000, 0.809016994},
{ 0.000000000, -0.500000000, 0.809016994},
{ 0.000000000, 0.500000000 ,-0.809016994},
{ 0.000000000, -0.500000000 ,-0.809016994},
{ 0.500000000, 0.809016994 ,0.000000000},
{ 0.500000000, -0.809016994, 0.000000000},
{ -0.500000000, 0.809016994 ,0.000000000},
{ -0.500000000, -0.809016994, 0.000000000},
{ 0.809016994, 0.000000000 ,0.500000000},
{ 0.809016994, 0.000000000,-0.500000000},
{ -0.809016994,0.000000000, 0.500000000},
{ -0.809016994,0.000000000,-0.500000000},
 *
 */

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4104kb

input:

1

output:

2
0 0 0
1 0 0

result:

ok required_n=1, sz=2

Test #2:

score: 0
Accepted
time: 0ms
memory: 4204kb

input:

2

output:

3
0 0 0
1 0 0
0.5 0.866025404 0

result:

ok required_n=2, sz=3

Test #3:

score: 0
Accepted
time: 0ms
memory: 4144kb

input:

3

output:

4
0.5 0 -0.353553391
-0.5 0 -0.353553391
0 0.5 0.353553391
0 -0.5 0.353553391

result:

ok required_n=3, sz=4

Test #4:

score: 0
Accepted
time: 1ms
memory: 4124kb

input:

4

output:

6
0.707106781 0 0
-0.707106781 0 0
0 0.707106781 0
0 -0.707106781 0
0 0 0.707106781
0 0 -0.707106781

result:

ok required_n=4, sz=6

Test #5:

score: 0
Accepted
time: 1ms
memory: 4168kb

input:

5

output:

12
0 0.5 0.809016994
0 -0.5 0.809016994
0 0.5 -0.809016994
0 -0.5 -0.809016994
0.5 0.809016994 0
0.5 -0.809016994 0
-0.5 0.809016994 0
-0.5 -0.809016994 0
0.809016994 0 0.5
0.809016994 0 -0.5
-0.809016994 0 0.5
-0.809016994 0 -0.5

result:

ok required_n=5, sz=12

Test #6:

score: 0
Accepted
time: 1ms
memory: 4200kb

input:

6

output:

16
0.508654783303 0.382421093642 -0.831757533758
-0.491345216697 0.382421093642 -0.831757533758
0.00865478330275 0.882421093642 -0.124650751758
0.00865478330275 -0.117578906358 -0.124650751758
0.0246666582363 -0.382421093642 -0.4065847179
-0.975333341764 -0.382421093642 -0.4065847179
-0.475333341764...

result:

ok required_n=6, sz=16

Test #7:

score: 0
Accepted
time: 1ms
memory: 4196kb

input:

7

output:

24
0.715761564303 0.382421093642 -0.478204142758
-0.698451997697 0.382421093642 -0.478204142758
0.00865478330275 1.08952787464 -0.478204142758
0.00865478330275 -0.324685687358 -0.478204142758
0.00865478330275 0.382421093642 0.228902638242
0.00865478330275 0.382421093642 -1.18531092376
0.231773439236...

result:

ok required_n=7, sz=24

Test #8:

score: 0
Accepted
time: 1ms
memory: 4272kb

input:

8

output:

36
1.04933806616 0.540825097024 -0.30064258119
-0.364875495842 0.540825097024 -0.30064258119
0.342231285158 1.24793187802 -0.30064258119
0.342231285158 -0.166281683976 -0.30064258119
0.342231285158 0.540825097024 0.40646419981
0.342231285158 0.540825097024 -1.00774936219
0.364875495842 -0.5408250970...

result:

ok required_n=8, sz=36

Test #9:

score: 0
Accepted
time: 1ms
memory: 4068kb

input:

9

output:

72
-0.00131589520233 1.15098711493 -0.399017611112
0.998684104798 1.15098711493 -0.399017611112
-0.685778465518 0.0693369208784 0.202267551267
0.314221534482 0.0693369208784 0.202267551267
-0.749858478362 1.06569271299 0.258560418985
0.250141521638 1.06569271299 0.258560418985
0.0627641176417 0.1546...

result:

ok required_n=9, sz=72

Test #10:

score: 0
Accepted
time: 1ms
memory: 4192kb

input:

10

output:

96
0.244318034643 -0.0101585676371 0.377275558818
-1.16989552736 -0.0101585676371 0.377275558818
-0.462788746357 0.696948213363 0.377275558818
-0.462788746357 -0.717265348637 0.377275558818
-0.462788746357 -0.0101585676371 1.08438233982
-0.462788746357 -0.0101585676371 -0.329831222182
0.323142563937...

result:

ok required_n=10, sz=96