CSES - Datatähti 2024 alku - Results
Submission details
Task:Säähavainnot
Sender:Niilo
Submission time:2023-11-12 20:58:08 +0200
Language:C++ (C++17)
Status:READY
Result:71
Feedback
groupverdictscore
#1ACCEPTED70.75
Test results
testverdicttimescore
#1ACCEPTED0.01 s9.13details
#2ACCEPTED0.01 s9details
#3ACCEPTED0.01 s9.13details
#4ACCEPTED0.01 s9details
#5ACCEPTED0.01 s8.88details
#6ACCEPTED0.01 s9details
#7ACCEPTED0.01 s8.25details
#8ACCEPTED0.02 s8.38details

Code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define TEST_MODE 0

float lim[12] = {20.0, 19.0, 17.9, 17.7, 8.3, 6.9, 6.3, 5.7, 4.9, 4.4, 4.4, 4.4};

const float mat1[12][24] = {{-0.01614634320139885, 0.0362265408039093, -0.05737016722559929, 0.06461174041032791, 0.0055098384618759155, 0.009169790893793106, -0.04859190061688423, 0.04562483727931976, -0.001301988959312439, -0.029392242431640625, 0.016525184735655785, 0.026433248072862625, -0.061187371611595154, 0.0590476468205452, -0.015416357666254044, -0.010562807321548462, 0.019678033888339996, -0.010125290602445602, -0.007130339741706848, -0.01022094115614891, -0.05266791582107544, 0.008738931268453598, 0.04908061772584915, 0.981070339679718}, {-0.03475956618785858, 0.024351879954338074, -0.02829805761575699, 0.08431905508041382, -0.010196033865213394, 0.0219875518232584, -0.04255467653274536, 0.048917826265096664, 0.010199524462223053, -0.0735962986946106, 0.04052255302667618, 0.05810274928808212, -0.0787806287407875, 0.07054285705089569, -0.024140872061252594, -0.013080708682537079, 0.0005664974451065063, 0.019679520279169083, -0.03600722551345825, 0.015484265983104706, -0.04997042194008827, 0.008147601038217545, 0.03170595318078995, 0.9605417251586914}, {-0.08223383128643036, 0.040043413639068604, -0.02930309623479843, 0.11380971223115921, -0.005014374852180481, 0.054808322340250015, -0.04915136843919754, 0.014094226062297821, 0.06581626832485199, -0.06403852254152298, 0.013345621526241302, 0.025179313495755196, -0.03957182914018631, 0.09915061295032501, -0.046384040266275406, -0.009627219289541245, -0.06177312135696411, 0.04745157063007355, -0.01353709027171135, 0.058412447571754456, -0.05975954607129097, -0.007513761520385742, 0.012457199394702911, 0.925576388835907}, {-0.10679318010807037, 0.06370677053928375, -0.07902427017688751, 0.10679255425930023, 0.08548809587955475, 0.04933224618434906, -0.07789190113544464, 0.05733199045062065, 0.0655360147356987, -0.0453810878098011, -0.021614592522382736, 0.028486987575888634, -0.05641436576843262, 0.10934251546859741, -0.0567021444439888, 0.03470149263739586, -0.12464696913957596, 0.07809935510158539, 0.06372442096471786, 0.02580113150179386, -0.06314511597156525, 0.00929134339094162, -0.04924698546528816, 0.9009968042373657}, {-0.10304341465234756, 0.023484542965888977, -0.07437413185834885, 0.05846545100212097, 0.14763101935386658, 0.08656011521816254, -0.05567609518766403, 0.03552364930510521, 0.03442186862230301, -0.031821589916944504, -0.005557596683502197, 0.00921030342578888, -0.01622522994875908, 0.114290252327919, -0.10608290135860443, 0.06683091074228287, -0.11816968768835068, 0.08218314498662949, 0.0951521247625351, 0.03707610070705414, -0.05419950932264328, -0.007073074579238892, -0.07533009350299835, 0.8484799265861511}, {-0.10372243076562881, 0.02049235999584198, -0.05601267144083977, -0.015070080757141113, 0.14648444950580597, 0.1280471682548523, -0.03696892783045769, 0.03662768751382828, 0.059852585196495056, -0.0806322768330574, 0.01596866175532341, -0.023587513715028763, 0.01674378104507923, 0.10938578844070435, -0.12269759178161621, 0.13669513165950775, -0.10092747211456299, 0.0756186842918396, 0.0927577018737793, 0.07748211920261383, -0.09574727714061737, 0.0028780102729797363, -0.0804017186164856, 0.7839201092720032}, {-0.11223805695772171, 0.024293333292007446, -0.03101884201169014, -0.09346640855073929, 0.19067399203777313, 0.08136917650699615, 0.029056817293167114, -0.012081366032361984, 0.11203396320343018, -0.1125185564160347, 0.05822373926639557, -0.057100024074316025, -0.002006668597459793, 0.16029822826385498, -0.14707279205322266, 0.18442516028881073, -0.051032498478889465, 0.05455760285258293, 0.08454945683479309, 0.047380466014146805, -0.07801611721515656, -0.022196650505065918, -0.05654245615005493, 0.7288386821746826}, {-0.1024087592959404, 0.03528408706188202, -0.0165066160261631, -0.11288334429264069, 0.17716270685195923, 0.054759904742240906, -0.005441192537546158, 0.03440231829881668, 0.10902513563632965, -0.12065783143043518, 0.07061710953712463, -0.021829739212989807, -0.050345294177532196, 0.19406411051750183, -0.14956240355968475, 0.20744426548480988, -0.011767633259296417, 0.027850743383169174, 0.09761281311511993, 0.02416648343205452, -0.053751390427351, -0.06410959362983704, -0.051447805017232895, 0.7011005878448486}, {-0.12049536406993866, 0.05107833445072174, -0.01037278026342392, -0.08458688855171204, 0.14389055967330933, 0.025957250967621803, 0.012177590280771255, 0.0030523091554641724, 0.129569411277771, -0.1180998757481575, 0.11325376480817795, -0.03659597411751747, -0.04433043301105499, 0.2060103416442871, -0.15209567546844482, 0.23337171971797943, 0.006127435714006424, -0.027903031557798386, 0.10890837013721466, 0.00225086510181427, -0.05981912836432457, -0.047123853117227554, -0.025282636284828186, 0.6553171873092651}, {-0.08252020925283432, 0.011562928557395935, 0.010087758302688599, -0.10498392581939697, 0.16586948931217194, -0.004828650504350662, -0.019762929528951645, 0.07312226295471191, 0.08687912672758102, -0.1107921451330185, 0.12188484519720078, -0.01276615634560585, -0.07180050015449524, 0.23269125819206238, -0.14313054084777832, 0.22580546140670776, 0.010214788839221, -0.030255842953920364, 0.10272137820720673, 0.02557447925209999, -0.10331888496875763, -0.019603978842496872, -0.035353176295757294, 0.6314746737480164}, {-0.062230806797742844, -0.01899157464504242, 0.03585556894540787, -0.11708919703960419, 0.1568901538848877, -0.005724743008613586, -0.03164020925760269, 0.06832210719585419, 0.13127204775810242, -0.15632422268390656, 0.11952930688858032, -0.008171118795871735, -0.026919633150100708, 0.16209489107131958, -0.08135507255792618, 0.22816148400306702, 0.023668574169278145, -0.07150435447692871, 0.13654495775699615, 0.0030690915882587433, -0.07544955611228943, -0.03386339545249939, -0.03318576142191887, 0.6129425764083862}, {-0.051354676485061646, -0.024118751287460327, 0.010272528976202011, -0.0799098014831543, 0.16077907383441925, -0.06381314992904663, -0.012153014540672302, 0.10165024548768997, 0.0925154983997345, -0.13475899398326874, 0.08609974384307861, 0.04204278066754341, -0.043234728276729584, 0.1179284006357193, 0.012752451002597809, 0.14405132830142975, 0.07316169142723083, -0.10566830635070801, 0.18633294105529785, 0.003267064690589905, -0.07588811218738556, -0.04625562205910683, -0.039462536573410034, 0.5972926616668701}};
const float mat2[12] = {0.055346012115478516, 0.04115915298461914, -0.010310649871826172, -0.07551431655883789, -0.13599061965942383, -0.1798691749572754, -0.226593017578125, -0.28537511825561523, -0.3401966094970703, -0.3933229446411133, -0.46521997451782227, -0.5100841522216797};

float ar[24];
int n;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  #if !TEST_MODE
  cin >> n;
  for (int i=0; i < n; i++) {
    for (int j=0; j < 24; j++) cin >> ar[j];

    float x1 = ar[0], x2 = ar[0];
    for (int j=1; j < 24; j++) {
      x1 = min(x1, ar[j]);
      x2 = max(x2, ar[j]);
    }
    float dif = abs(x1 - x2);

    int depth = 1;
    for (; depth <= 12; depth++) {
      if (dif > lim[depth-1]) break;
    }

    for (int j=0; j < 12; j++) {
      if (j >= depth) {
        cout << "? ";
        continue;
      }
      float q = mat2[j];
      for (int k=0; k < 24; k++) {
        q += mat1[j][k] * ar[k];
      }
      cout << q << ' ';
    }
  }
  #else
  int a[12] = {}, b[12] = {};

  freopen("data.txt", "r", stdin);

  cin >> n;
  for (int i=0; i < n; i++) {
    for (int j=0; j < 24; j++) cin >> ar[j];

    float x1 = ar[0], x2 = ar[0];
    for (int j=1; j < 24; j++) {
      x1 = min(x1, ar[j]);
      x2 = max(x2, ar[j]);
    }
    float dif = abs(x1 - x2);

    int depth = 1;
    for (; depth <= 12; depth++) {
      if (dif > lim[depth-1]) break;
    }

    for (int j=0; j < 12; j++) {
      float ans;
      cin >> ans;
      if (j >= depth) continue;

      float q = mat2[j];
      for (int k=0; k < 24; k++) {
        q += mat1[j][k] * ar[k];
      }

      if (abs(q - ans) < 0.75) a[j]++;
      if (abs(q - ans) > 2.05) b[j]++;
    }
  }
  int asum = 0, bsum = 0;
  printf(" i |  a   |  b   | a-b  | %%\n");
  for (int i=0; i < 12; i++) {
    printf("%2d |%5d |%5d |%5d |%.2f\n", i+1, a[i], b[i], a[i]-b[i], a[i]/(float)n);
    asum += a[i];
    bsum += b[i];
  }
  printf("   |%5d |%5d |%5d |%.2f\n", asum, bsum, (25*(asum-bsum)/n), asum/(float)n);
  #endif
}

Test details

Test 1

Verdict: ACCEPTED

input
1000
-0.4 -0.1 -0.2 -0.3 -0.4 -0.5 ...

correct output
0.4 0.4 0.5 0.8 0.9 1.1 1.3 1....

user output
0.272209 0.234621 0.145764 0.0...
Truncated

Test 2

Verdict: ACCEPTED

input
1000
2.9 2.9 2.9 2.1 2.6 2 2 2.2 2....

correct output
2.3 1.6 1.5 1.1 1 0.7 0.6 0.8 ...

user output
2.64682 2.62202 2.52204 2.4228...
Truncated

Test 3

Verdict: ACCEPTED

input
1000
6.6 6 6.4 6 4.6 4.6 4.2 4.3 4....

correct output
10 10.9 10.3 10.1 9.1 7.3 5.7 ...

user output
10.1777 10.0244 9.71418 9.1506...
Truncated

Test 4

Verdict: ACCEPTED

input
1000
19.4 20.2 19.1 18.9 18.3 17.3 ...

correct output
18 18.2 17 17.5 17.2 16.2 12 8...

user output
17.3924 17.3296 17.21 16.9247 ...
Truncated

Test 5

Verdict: ACCEPTED

input
1000
-5.7 -5.8 -5.8 -5.9 -7.1 -6.9 ...

correct output
-4.2 -4.1 -4 -3.8 -3.5 -3.2 -3...

user output
-4.44362 -4.53726 -4.82351 -5....
Truncated

Test 6

Verdict: ACCEPTED

input
1000
14.8 14.8 15.4 12.9 11.8 9.7 9...

correct output
11.8 11 11.6 10.8 10.4 10.4 10...

user output
12.7189 12.6796 12.3226 11.766...
Truncated

Test 7

Verdict: ACCEPTED

input
1000
0.7 1 2 1.4 0.6 -0.4 -0.9 -0.7...

correct output
-1.3 -0.5 -0.6 -1 -3.2 -7.2 -6...

user output
-1.65594 -1.61561 -1.65674 -1....
Truncated

Test 8

Verdict: ACCEPTED

input
1000
15.1 15.3 14.9 14.4 14.4 13.7 ...

correct output
15.6 15.9 16 15.2 14.6 14.4 13...

user output
15.2132 15.1698 14.9639 14.689...
Truncated