CSES - Datatähti 2024 alku - Results
Submission details
Task:Säähavainnot
Sender:chaotic
Submission time:2023-11-02 16:15:16 +0200
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

In file included from input/code.cpp:1:
/usr/include/c++/11/array: In instantiation of 'struct std::array<std::reference_wrapper<const std::array<double, 73> >, 12>':
input/code.cpp:179:80:   required from here
/usr/include/c++/11/array:111:56: error: 'std::array<_Tp, _Nm>::_M_elems' has incomplete type
  111 |       typename _AT_Type::_Type                         _M_elems;
      |                                                        ^~~~~~~~
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/array:38,
                 from input/code.cpp:1:
/usr/include/c++/11/type_traits:48:11: note: declaration of 'class std::reference_wrapper<const std::array<double, 73> >'
   48 |     class reference_wrapper;
      |           ^~~~~~~~~~~~~~~~~
input/code.cpp:180:80: error: too many initializers for 'const std::array<std::reference_...

Code

#include <array>

constexpr std::array<double, 73> coeffs0 = {
    0.00766925,   -0.0152275,  0.000983599,  -2.35601e-05, 0.0168686,  -0.000402097,
    -1.23509e-05, 0.00304878,  -0.00340812,  7.57372e-05,  0.0374575,  0.00152225,
    -3.16092e-05, -0.0182843,  0.00155329,   -6.26147e-05, 0.00306138, 0.000619179,
    5.35856e-05,  -0.0297402,  -0.000781041, -2.56154e-05, 0.0653388,  0.000568441,
    -1.98927e-05, -0.0510004,  -0.000132666, 7.88617e-05,  0.00514666, 0.000112344,
    -3.38687e-05, 0.00312502,  -0.000377664, -1.23875e-05, 0.0179219,  -0.00102039,
    -2.87833e-05, -0.0572452,  0.000576139,  0.000102372,  0.010822,   0.0013362,
    5.22881e-05,  0.0506703,   -0.001513,    -0.000220544, -0.0495059, 0.00137524,
    0.000178251,  0.00482799,  -0.00132573,  -1.66445e-05, 0.007311,   0.00117387,
    -2.342e-05,   -0.00292137, 0.00121374,   -4.14102e-05, 0.0123776,  -0.00174378,
    9.87679e-06,  -0.0542158,  -0.000289026, 6.54544e-05,  -0.0273884, 0.00197059,
    -6.18012e-05, 0.0105729,   0.00487263,   -8.35412e-05, 1.05961,    -0.00631764,
    8.79278e-05,
};

constexpr std::array<double, 73> coeffs1 = {
    -0.0660465,  -0.0523863,   0.00290234,   -6.23062e-05, 0.0279323,    -0.00143928,  1.73708e-06,
    0.0141463,   -0.005198,    0.00016202,   0.0780376,    0.00232198,   -9.72459e-05, -0.0117064,
    0.00263476,  -0.000140647, -0.0189935,   -5.90258e-05, 0.000143234,  -0.0711243,   -0.000468948,
    3.09947e-05, 0.114186,     -0.000111775, -0.00010362,  -0.0354674,   0.00202552,   6.7354e-05,
    -0.0370191,  -0.00161064,  2.4727e-05,   0.0286061,    0.000336308,  -4.90408e-05, 0.0419965,
    -0.00197436, -2.92422e-05, -0.099989,    0.000189314,  9.84368e-05,  8.32877e-06,  0.00101646,
    0.000104693, 0.0617418,    0.00130221,   -0.000305534, -0.0498766,   -0.000118494, 0.000218671,
    -0.0212647,  -0.000491674, 8.94399e-05,  0.0236246,    0.000679779,  -0.000143165, 0.0275308,
    0.0013992,   -1.25276e-05, 0.0196942,    -0.00182278,  -1.17582e-05, -0.0791713,   -0.00126338,
    9.73349e-05, -0.0220166,   0.0032494,    -8.13857e-05, -0.0384851,   0.00864635,   -0.000203234,
    1.10878,     -0.0113024,   0.000203164,
};

constexpr std::array<double, 73> coeffs2 = {
    -0.159233,   -0.0778349,   0.00463196,  -9.9843e-05,  0.00638828,   -0.00197854,  1.88567e-05,
    0.00192733,  -0.00619822,  0.000189395, 0.111196,     0.000803877,  -4.31455e-05, -0.0105218,
    0.00370532,  -0.000155689, 0.0404681,   0.000687006,  6.61611e-05,  -0.103385,    -0.000299858,
    7.78533e-05, 0.105869,     6.02967e-05, -7.85276e-05, -0.0371411,   0.00179115,   2.57414e-05,
    -0.0202491,  -0.000842176, 4.49825e-05, 0.0207288,    -5.3584e-06,  -5.38268e-05, 0.0521417,
    -0.00273558, -7.37968e-05, -0.0989728,  0.00027777,   0.000150667,  -0.0351368,   0.000914818,
    0.000122424, 0.0717416,    0.00143801,  -0.000319664, -0.028557,    -5.4664e-05,  0.000176168,
    -0.0774796,  -0.000296889, 0.00014111,  0.0500274,    0.00130991,   -0.000120924, 0.0332956,
    0.00257536,  -5.51853e-05, 0.0944641,   -0.00294156,  -9.16695e-05, -0.0728534,   -0.00243153,
    0.000205147, -0.08279,     0.0045601,   -9.55065e-05, -0.0290182,   0.00976638,   -0.000329404,
    1.09715,     -0.0138122,   0.000293621,
};

constexpr std::array<double, 73> coeffs3 = {
    -0.282158,    -0.0696095,   0.00339944,  -7.94632e-05, -0.014656,    -0.000814109, -2.8753e-05,
    -0.0829653,   -0.00661034,  0.000282699, 0.147478,     0.000676931,  -7.01854e-05, 0.0747956,
    0.00460475,   -0.000238705, 0.0211699,   0.000456073,  8.84238e-05,  -0.13225,     -0.00124869,
    0.00021389,   0.130225,     0.00120772,  -0.000132048, -0.0303239,   0.00227197,   -7.86832e-05,
    -0.00260217,  -0.00127373,  7.17083e-05, -0.027095,    0.00156907,   -5.65716e-05, 0.109969,
    -0.00462967,  -5.0313e-05,  -0.141695,   0.000339583,  0.000157553,  -0.0456829,   0.00291742,
    0.000140348,  0.102027,     -0.00104496, -0.00038681,  -0.0772817,   0.000190304,  0.000308533,
    -0.0831058,   0.000619507,  0.000101607, 0.0920874,    0.00305422,   -0.000206923, 0.0770148,
    -5.64646e-05, 1.70059e-05,  0.119889,    -0.00266125,  -0.000162711, -0.0582026,   -0.00289234,
    0.000210363,  -0.126028,    0.00679545,  -7.28566e-05, -0.0781218,   0.0089482,    -0.000307205,
    1.1104,       -0.0149193,   0.000260931,
};

constexpr std::array<double, 73> coeffs4 = {
    -0.385888,   -0.0684688,   0.0027519,    -6.53062e-05, -0.0532685,   0.000852822,  -6.53579e-05,
    -0.0833564,  -0.00894833,  0.00035945,   0.0787293,    0.00217242,   -8.48793e-05, 0.0898204,
    0.00494615,  -0.00028147,  0.102182,     0.000594155,  7.25099e-05,  -0.0943494,   -0.00251974,
    0.000260518, 0.138982,     0.0013727,    -0.000150805, -0.122199,    0.00407552,   9.75668e-06,
    0.0832472,   -0.00101584,  -0.000128874, -0.0803602,   0.000723537,  0.000100428,  0.121549,
    -0.00427706, -7.56763e-05, -0.139427,    0.00101135,   0.000198254,  -0.0235968,   0.002117,
    2.84707e-05, 0.0572549,    -0.0015671,   -0.000200535, -0.0634509,   0.000781027,  0.000159382,
    -0.0925803,  0.00135629,   9.60912e-05,  0.133475,     0.00333472,   -0.000209912, 0.12694,
    -0.00215413, 8.79664e-05,  0.145015,     -0.00228078,  -0.000192411, -0.0716851,   -0.00243203,
    0.000126594, -0.0988659,   0.00589692,   -5.54681e-05, -0.127094,    0.0128553,    -0.000399106,
    1.0559,      -0.0188179,   0.000393127,
};

constexpr std::array<double, 73> coeffs5 = {
    -0.46506,    -0.0586907,   0.00132253,   -4.53477e-05, -0.042409,    0.00287138,   -0.000143297,
    -0.0973444,  -0.00851252,  0.000375566,  0.000459652,  0.000484058,  -1.48065e-05, 0.0314459,
    0.0037391,   -0.000244219, 0.152505,     0.00117272,   8.07798e-05,  0.00915874,   -0.000274203,
    0.00014601,  0.0886509,    -0.000814426, -2.47952e-05, -0.121128,    0.00761951,   -7.37067e-05,
    0.0773576,   -0.00356234,  -9.67506e-05, -0.0660973,   0.00100002,   0.00011193,   0.139157,
    -0.00384951, -0.000198069, -0.116295,    0.0019349,    0.000259189,  -0.0546106,   0.00036712,
    2.36302e-05, 0.019563,     -0.00114166,  -0.000122497, -0.0430367,   0.00161671,   0.000109029,
    -0.0402775,  0.00184552,   5.86724e-05,  0.220533,     0.00324397,   -0.000229226, 0.0793501,
    -0.0053041,  0.000213201,  0.11471,      0.000956578,  -0.000213552, -0.0556105,   -0.00287486,
    0.000106274, -0.0513184,   0.00714198,   -0.000190013, -0.106074,    0.0122207,    -0.000363314,
    0.93374,     -0.020158,    0.000447021,
};

constexpr std::array<double, 73> coeffs6 = {
    -0.525526,   -0.0724773,   0.000148522,  -4.79879e-05, -0.0383199,  0.00365391,   -0.000132362,
    -0.087597,   -0.00717153,  0.000364359,  -0.0293866,   -0.0013004,  -2.02765e-05, -0.0296842,
    0.00526655,  -0.000224975, 0.143921,     -0.00252698,  0.000109647, 0.0836788,    0.00324218,
    0.000109069, 0.0544878,    -0.00285698,  0.000109001,  -0.103565,   0.0103274,    -0.000230855,
    0.114653,    -0.00517161,  -5.38674e-05, -0.0793052,   0.00176543,  0.000131211,  0.142502,
    -0.00212922, -0.000248802, -0.0976414,   -0.000699901, 0.000245839, -0.0953563,   0.000119718,
    9.35412e-05, 0.00043999,   0.00135412,   -0.000126349, -0.0086474,  0.000806402,  0.000143736,
    0.126062,    0.0018905,    -0.000176986, 0.151144,     0.00184759,  -8.1935e-05,  0.0212118,
    -0.00434886, 0.000292262,  0.104912,     0.00117061,   -0.00022459, -0.00610418,  -0.00216656,
    3.40687e-05, -0.0413439,   0.00649343,   -0.000188027, -0.0894272,  0.0131026,    -0.000386172,
    0.84533,     -0.0217109,   0.000469793,
};

constexpr std::array<double, 73> coeffs7 = {
    -0.633589,   -0.0658289,   -0.000244531, -7.00149e-05, -0.019621,    0.00484468,   -0.000136132,
    -0.0984868,  -0.00922368,  0.000449105,  -0.0416755,   -0.000188331, -6.33007e-05, -0.0561148,
    0.00804612,  -0.000296994, 0.114408,     -0.00632052,  0.000210889,  0.0639793,    0.00213261,
    4.05895e-05, 0.0602189,    -0.00188264,  0.000201156,  -0.115787,    0.01185,      -0.000221628,
    0.191699,    -0.00396191,  -0.000177934, -0.116619,    0.000732679,  0.000207608,  0.170775,
    -0.00304258, -0.000298362, -0.0879719,   -0.000950724, 0.00024087,   -0.101429,    0.00056935,
    0.000152442, 0.0122781,    0.00306445,   -0.0001561,   0.0634574,    0.000573269,  7.78119e-05,
    0.181017,    0.00161008,   -0.000215533, 0.0559691,    0.00153896,   -1.3166e-05,  -0.00795821,
    -0.00450346, 0.000346559,  0.14575,      0.00162777,   -0.000252211, -0.0473803,   -0.00090856,
    5.87936e-05, 0.0243375,    0.00559234,   -0.000232322, -0.11863,     0.0138848,    -0.00037664,
    0.801012,    -0.0238063,   0.000468061,
};

constexpr std::array<double, 73> coeffs8 = {
    -0.726605,    -0.0955604, -0.00062043,  -6.17374e-05, -0.0156778, 0.00581542,
    -0.000138782, -0.0656898, -0.00928287,  0.000425549,  -0.0457586, 0.000497694,
    -6.96689e-05, -0.0902655, 0.00702086,   -0.000259051, 0.116809,   -0.00686549,
    0.000241154,  0.0736266,  0.00131242,   -5.90614e-05, -0.0114263, -0.0044023,
    0.000265126,  -0.0574285, 0.0145486,    -0.000238415, 0.203171,   -0.00278737,
    -0.000194126, -0.136213,  -0.000466055, 0.000257898,  0.212159,   -0.00140743,
    -0.000385131, -0.0946765, -0.0017821,   0.000277827,  -0.112356,  0.00178981,
    0.000262862,  0.0817634,  0.00383957,   -0.000248703, 0.0620299,  0.000197015,
    5.27358e-05,  0.229014,   0.000610261,  -0.000287512, -0.050794,  0.00180371,
    0.000118202,  0.0177192,  -0.00547718,  0.000353153,  0.124094,   0.00269125,
    -0.000224985, -0.0423416, -0.000233209, 3.19159e-05,  0.0494855,  0.0062734,
    -0.000283506, -0.0908049, 0.0122724,    -0.000339173, 0.736591,   -0.0240808,
    0.000448602,
};

constexpr std::array<double, 73> coeffs9 = {
    -0.810086,    -0.0784208, -0.000775006, -7.08006e-05, -0.041122, 0.00655653,
    -0.000171176, -0.0149588, -0.0107369,   0.000446826,  -0.117483, 0.000944377,
    -1.76855e-05, -0.076214,  0.00939985,   -0.00034963,  0.124092,  -0.0102122,
    0.000356311,  0.0558894,  0.00260939,   -0.000131136, -0.032602, -0.00682393,
    0.000285506,  -0.0302991, 0.015352,     -0.000247062, 0.207471,  -0.00208218,
    -0.00022558,  -0.159028,  0.000353279,  0.000329158,  0.26385,   -0.00369733,
    -0.000402215, -0.112318,  0.00103473,   0.000214975,  -0.11044,  0.00218066,
    0.000344431,  0.11368,    0.0039149,    -0.000329535, 0.0797381, 0.000315781,
    0.000107519,  0.225746,   -0.000942574, -0.000364835, -0.111084, 0.00345116,
    0.000262185,  0.0698713,  -0.00733177,  0.000300302,  0.109315,  0.00406603,
    -0.000232152, -0.060813,  -0.000517889, 7.59956e-05,  0.057497,  0.00658956,
    -0.000287847, -0.0639832, 0.013884,     -0.000420062, 0.689174,  -0.0258611,
    0.000476182,
};

constexpr std::array<double, 73> coeffs10 = {
    -0.905451,   -0.0620926,   -0.00140601,  -7.89076e-05, -0.0666362,   0.00703395,   -0.000139023,
    0.035458,    -0.0103143,   0.000370719,  -0.157153,    -0.000113349, 4.4546e-05,   -0.0683334,
    0.0108939,   -0.0003691,   0.0727486,    -0.0110365,   0.000404426,  0.0946822,    0.00321509,
    -0.00021939, -0.0510535,   -0.00850332,  0.000327262,  0.032021,     0.0149411,    -0.000308556,
    0.127698,    -0.0010127,   -0.000198873, -0.140662,    -0.000271593, 0.00037994,   0.300537,
    -0.00338427, -0.000448074, -0.130726,    0.0004628,    0.00022798,   -0.107391,    0.00435878,
    0.000397438, 0.136625,     0.00416413,   -0.000362611, 0.1035,       -0.000268459, 4.44048e-05,
    0.222274,    -0.00129316,  -0.000370993, -0.152862,    0.00315919,   0.000343944,  0.104278,
    -0.00697675, 0.000262785,  0.107738,     0.00340461,   -0.000199289, -0.0588311,   0.000776607,
    5.2795e-05,  -0.00296248,  0.00644316,   -0.000219184, -0.00185655,  0.0151465,    -0.000523986,
    0.648694,    -0.0276708,   0.000523509,
};

constexpr std::array<double, 73> coeffs11 = {
    -0.991743,    -0.0250385,   -0.00157808,  -0.000122033, -0.0836214,   0.00597695,  -7.79421e-05,
    0.00958369,   -0.00852214,  0.000338588,  -0.14841,     -0.00197136,  0.000104224, -0.0726166,
    0.0133226,    -0.000432772, 0.0510559,    -0.0117227,   0.000418028,  0.118969,    0.00272181,
    -0.000258616, -0.0832931,   -0.00910047,  0.000422102,  0.0509364,    0.014764,    -0.000363426,
    0.130695,     -0.000323092, -0.000231584, -0.169126,    -0.00153075,  0.00049807,  0.358308,
    -0.00302922,  -0.000560802, -0.154834,    0.00123517,   0.000291464,  -0.10321,    0.0039686,
    0.000388845,  0.159834,     0.0046293,    -0.000429312, 0.0882609,    0.000268662, 0.000146947,
    0.26756,      -0.00206309,  -0.000554544, -0.203089,    0.00304674,   0.000543682, 0.108214,
    -0.00575747,  0.00019946,   0.104434,     0.00311171,   -0.000189347, -0.0135981,  -0.000184924,
    5.27834e-05,  -0.0611654,   0.0065887,    -0.000190481, 0.00983708,   0.0177139,   -0.00059873,
    0.642704,     -0.0296153,   0.000545273,
};

#include <iostream>

constexpr std::array<std::reference_wrapper<std::array<double, 73> const>, 12> all_coeffs = {coeffs0, coeffs1, coeffs2, coeffs3, coeffs4,  coeffs5,
                         coeffs6, coeffs7, coeffs8, coeffs9, coeffs10, coeffs11};

double estimate_using(std::array<double, 24> const& vals, std::array<double, 73> const& coeffs) {
    double r = coeffs[0];

    for (int i = 0; i < 24; ++i) {
        double x  = vals[i];
        r        += coeffs[1 + 3 * i + 0] * x;
        r        += coeffs[1 + 3 * i + 1] * x * x;
        r        += coeffs[1 + 3 * i + 2] * x * x * x;
    }
    return r;
}

int main() {
    int n;
    std::cin >> n;

    for (int i = 0; i < n; ++i) {
        // Read input
        std::array<double, 24> vals;
        for (auto& x: vals) {
            double v;
            std::cin >> v;
            x = v;
        }

        // Read extra 12
//        std::cin.getline(nullptr, 1000, '\n');

        // Calculate all
        for (int i = 0; i < 12; ++i) {
            double r = estimate_using(vals, all_coeffs[i]);
            std::cout << r << " ";
        }
        std::cout << "\n";
    }
}