CSES - Aalto Competitive Programming 2024 - wk3 - Wed - Results
Submission details
Task:Wario kart II
Sender:minghao
Submission time:2024-09-18 16:54:35 +0300
Language:C++11
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#130.00 sdetails
#140.00 sdetails
#150.00 sdetails
#160.00 sdetails
#170.00 sdetails
#180.00 sdetails
#190.00 sdetails
#200.00 sdetails
#210.00 sdetails
#220.00 sdetails
#230.00 sdetails
#240.00 sdetails
#250.00 sdetails
#260.00 sdetails
#270.00 sdetails
#280.00 sdetails
#290.00 sdetails
#300.00 sdetails
#310.00 sdetails
#320.00 sdetails
#330.00 sdetails
#340.00 sdetails
#350.00 sdetails
#360.00 sdetails
#370.00 sdetails
#380.00 sdetails
#390.00 sdetails
#400.00 sdetails
#410.00 sdetails
#420.00 sdetails
#430.00 sdetails
#440.00 sdetails
#450.00 sdetails
#460.00 sdetails
#470.00 sdetails
#480.00 sdetails
#490.01 sdetails
#500.02 sdetails
#510.02 sdetails
#520.03 sdetails
#530.02 sdetails
#540.03 sdetails
#550.02 sdetails
#560.03 sdetails
#570.02 sdetails
#580.03 sdetails
#590.01 sdetails

Compiler report

input/code.cpp: In function 'void Test()':
input/code.cpp:21:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     freopen("temp\\in.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
input/code.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~

Code

#include<iostream>
#include<cstdio>
#include<algorithm>
typedef long long LL;
using std::min;

const int N=100005, K=105;

int a[N], f[N];

double ans=1e6;
void UpdateAns(int now, int len, int v)
{
printf("Update with(%d, %d, %d)\n", now, len, v);
    double add = (double)len / (double)v;
    ans = min(ans, now + add);
}

void Test()
{
    freopen("temp\\in.txt", "r", stdin);
}


int main()
{
    // Test();
    int n, k;
    scanf("%d%d", &n, &k);

    for(int i=0; i<n; i++)
    {
        scanf("%d", &a[i]);
        f[i] = N;
    }
    f[0] = 0, f[n] = N;
    for(int i=0; i<n; i++)
    {
        if(i+a[i] >= n)
        {
            // take the boost over the end
            UpdateAns(f[i], n - i, a[i]);
        } else if (i+a[i]+k >=n) {
            // take and move to end
            UpdateAns(f[i], n - (i+a[i]), 1);
        } else {
            // take and update
            f[i+a[i]+k] = min(f[i+a[i]+k], f[i]+1+k);
        }

        // not take
        f[i+1] = min(f[i+1], f[i]+1);
    }
    UpdateAns(f[n], 0, 1);

    printf("%lf", ans);

    return 0;
}

Test details

Test 1

Verdict:

input
1 5

correct output
0.33333333333333333334

user output
Update with(0, 1, 3)
Update with(1, 0, 1)
0.333333

Test 2

Verdict:

input
2 5
3 4 

correct output
0.66666666666666666668

user output
Update with(0, 2, 3)
Update with(1, 1, 4)
Update with(2, 0, 1)
0.666667

Test 3

Verdict:

input
2 5
2 2 

correct output
1.00000000000000000000

user output
Update with(0, 2, 2)
Update with(1, 1, 2)
Update with(2, 0, 1)
1.000000

Test 4

Verdict:

input
3 5
2 2 2 

correct output
2.00000000000000000000

user output
Update with(0, 1, 1)
Update with(1, 2, 2)
Update with(2, 1, 2)
Update with(3, 0, 1)
1.000000

Test 5

Verdict:

input
3 5
3 4 3 

correct output
1.00000000000000000000

user output
Update with(0, 3, 3)
Update with(1, 2, 4)
Update with(2, 1, 3)
Update with(3, 0, 1)
1.000000

Test 6

Verdict:

input
3 5
2 2 2 

correct output
2.00000000000000000000

user output
Update with(0, 1, 1)
Update with(1, 2, 2)
Update with(2, 1, 2)
Update with(3, 0, 1)
1.000000

Test 7

Verdict:

input
4 5
3 4 3 4 

correct output
1.75000000000000000000

user output
Update with(0, 1, 1)
Update with(1, 3, 4)
Update with(2, 2, 3)
Update with(3, 1, 4)
Update with(4, 0, 1)
...

Test 8

Verdict:

input
4 5
2 2 2 4 

correct output
3.00000000000000000000

user output
Update with(0, 2, 1)
Update with(1, 1, 1)
Update with(2, 2, 2)
Update with(3, 1, 4)
Update with(4, 0, 1)
...

Test 9

Verdict:

input
4 3
2 2 2 2 

correct output
3.00000000000000000000

user output
Update with(0, 2, 1)
Update with(1, 1, 1)
Update with(2, 2, 2)
Update with(3, 1, 2)
Update with(4, 0, 1)
...

Test 10

Verdict:

input
5 5
3 4 3 4 3 

correct output
2.00000000000000000000

user output
Update with(0, 2, 1)
Update with(1, 4, 4)
Update with(2, 3, 3)
Update with(3, 2, 4)
Update with(4, 1, 3)
...

Test 11

Verdict:

input
5 5
2 2 2 4 2 

correct output
3.50000000000000000000

user output
Update with(0, 3, 1)
Update with(1, 2, 1)
Update with(2, 1, 1)
Update with(3, 2, 4)
Update with(4, 1, 2)
...

Test 12

Verdict:

input
5 5
2 2 2 2 2 

correct output
4.00000000000000000000

user output
Update with(0, 3, 1)
Update with(1, 2, 1)
Update with(2, 1, 1)
Update with(3, 2, 2)
Update with(4, 1, 2)
...

Test 13

Verdict:

input
5 5
2 2 3 3 4 

correct output
3.00000000000000000000

user output
Update with(0, 3, 1)
Update with(1, 2, 1)
Update with(2, 3, 3)
Update with(3, 2, 3)
Update with(4, 1, 4)
...

Test 14

Verdict:

input
5 1
4 4 4 3 4 

correct output
2.00000000000000000000

user output
Update with(0, 1, 1)
Update with(1, 4, 4)
Update with(2, 3, 4)
Update with(3, 2, 3)
Update with(4, 1, 4)
...

Test 15

Verdict:

input
5 4
2 3 5 5 3 

correct output
2.59999999999999999991

user output
Update with(0, 3, 1)
Update with(1, 1, 1)
Update with(2, 3, 5)
Update with(3, 2, 5)
Update with(4, 1, 3)
...

Test 16

Verdict:

input
5 1
3 2 2 2 2 

correct output
2.50000000000000000000

user output
Update with(2, 1, 1)
Update with(3, 2, 2)
Update with(2, 1, 2)
Update with(3, 0, 1)
2.500000

Test 17

Verdict:

input
5 1
3 5 4 3 5 

correct output
1.79999999999999999996

user output
Update with(1, 4, 5)
Update with(2, 3, 4)
Update with(3, 2, 3)
Update with(2, 1, 5)
Update with(3, 0, 1)
...

Test 18

Verdict:

input
5 1
5 3 4 5 2 

correct output
1.00000000000000000000

user output
Update with(0, 5, 5)
Update with(1, 1, 1)
Update with(2, 3, 4)
Update with(3, 2, 5)
Update with(4, 1, 2)
...

Test 19

Verdict:

input
5 2
3 2 2 2 2 

correct output
3.00000000000000000000

user output
Update with(0, 2, 1)
Update with(1, 2, 1)
Update with(2, 1, 1)
Update with(3, 2, 2)
Update with(4, 1, 2)
...

Test 20

Verdict:

input
10 5
3 4 3 4 3 3 3 3 3 2 

correct output
6.66666666666666666652

user output
Update with(1, 5, 1)
Update with(2, 5, 1)
Update with(3, 3, 1)
Update with(4, 3, 1)
Update with(5, 2, 1)
...

Test 21

Verdict:

input
10 5
2 2 2 4 2 2 2 3 2 3 

correct output
7.00000000000000000000

user output
Update with(3, 3, 1)
Update with(4, 4, 1)
Update with(5, 3, 1)
Update with(6, 2, 1)
Update with(6, 3, 3)
...

Test 22

Verdict:

input
10 5
2 2 2 2 2 2 2 2 2 2 

correct output
8.00000000000000000000

user output
Update with(3, 5, 1)
Update with(4, 4, 1)
Update with(5, 3, 1)
Update with(6, 2, 1)
Update with(6, 1, 1)
...

Test 23

Verdict:

input
10 5
2 2 3 3 4 3 4 2 2 2 

correct output
7.00000000000000000000

user output
Update with(2, 5, 1)
Update with(3, 4, 1)
Update with(4, 2, 1)
Update with(5, 2, 1)
Update with(6, 4, 4)
...

Test 24

Verdict:

input
10 1
4 4 4 3 4 3 2 2 4 2 

correct output
4.50000000000000000000

user output
Update with(4, 1, 1)
Update with(5, 2, 4)
Update with(4, 1, 2)
Update with(5, 0, 1)
4.500000

Test 25

Verdict:

input
10 4
2 3 5 5 3 2 4 3 5 3 

correct output
6.00000000000000000000

user output
Update with(2, 3, 1)
Update with(3, 2, 1)
Update with(4, 3, 1)
Update with(5, 3, 1)
Update with(5, 4, 4)
...

Test 26

Verdict:

input
10 1
3 2 2 2 2 3 3 2 3 3 

correct output
5.33333333333333333348

user output
Update with(4, 1, 1)
Update with(4, 1, 1)
Update with(5, 2, 3)
Update with(5, 1, 3)
Update with(6, 0, 1)
...

Test 27

Verdict:

input
10 1
3 5 4 3 5 3 4 3 4 2 

correct output
4.00000000000000000000

user output
Update with(2, 1, 1)
Update with(4, 4, 4)
Update with(3, 3, 3)
Update with(4, 2, 4)
Update with(5, 1, 2)
...

Test 28

Verdict:

input
10 1
5 3 4 5 2 3 2 4 3 5 

correct output
3.75000000000000000000

user output
Update with(3, 3, 4)
Update with(4, 2, 3)
Update with(4, 1, 5)
Update with(5, 0, 1)
3.750000

Test 29

Verdict:

input
10 2
3 2 2 2 2 2 2 4 3 2 

correct output
5.75000000000000000000

user output
Update with(4, 2, 1)
Update with(5, 3, 4)
Update with(6, 2, 3)
Update with(6, 1, 2)
Update with(7, 0, 1)
...

Test 30

Verdict:

input
100 72
51 37 52 34 51 26 38 40 24 27 ...

correct output
42.00000000000000000000

user output
Update with(0, 49, 1)
Update with(1, 62, 1)
Update with(2, 46, 1)
Update with(3, 63, 1)
Update with(4, 45, 1)
...

Test 31

Verdict:

input
100 72
94 2 14 31 100 16 25 11 41 20 ...

correct output
4.96000000000000000003

user output
Update with(0, 6, 1)
Update with(3, 66, 1)
Update with(4, 96, 100)
Update with(6, 69, 1)
Update with(8, 51, 1)
...

Test 32

Verdict:

input
100 2
19 12 20 10 11 9 8 8 4 5 15 13...

correct output
18.70588235294117647120

user output
Update with(20, 1, 1)
Update with(18, 18, 20)
Update with(18, 12, 17)
Update with(19, 1, 1)
Update with(20, 2, 1)
...

Test 33

Verdict:

input
100 71
8 4 2 6 6 9 5 9 2 3 2 3 3 2 2 ...

correct output
85.00000000000000000000

user output
Update with(25, 68, 1)
Update with(26, 69, 1)
Update with(27, 67, 1)
Update with(28, 63, 1)
Update with(29, 69, 1)
...

Test 34

Verdict:

input
100 55
17 89 79 66 56 64 55 21 14 89 ...

correct output
12.00000000000000000000

user output
Update with(1, 10, 1)
Update with(2, 19, 1)
Update with(3, 31, 1)
Update with(4, 40, 1)
Update with(5, 31, 1)
...

Test 35

Verdict:

input
100 87
6 3 4 7 7 4 2 5 4 6 4 5 4 3 7 ...

correct output
90.00000000000000000000

user output
Update with(9, 85, 1)
Update with(10, 86, 1)
Update with(11, 84, 1)
Update with(12, 84, 1)
Update with(13, 84, 1)
...

Test 36

Verdict:

input
100 33
21 79 8 5 36 12 94 57 11 51 59...

correct output
7.00000000000000000000

user output
Update with(1, 20, 1)
Update with(6, 94, 94)
Update with(10, 31, 1)
Update with(15, 25, 1)
Update with(16, 5, 1)
...

Test 37

Verdict:

input
100 78
9 12 24 18 12 24 9 14 8 13 3 3...

correct output
77.00000000000000000000

user output
Update with(2, 74, 1)
Update with(5, 71, 1)
Update with(9, 78, 1)
Update with(12, 77, 1)
Update with(15, 72, 1)
...

Test 38

Verdict:

input
100 97
2 3 2 3 3 2 2 2 3 2 3 2 2 3 3 ...

correct output
98.00000000000000000000

user output
Update with(1, 96, 1)
Update with(2, 96, 1)
Update with(3, 94, 1)
Update with(4, 93, 1)
Update with(5, 93, 1)
...

Test 39

Verdict:

input
100 50
20 20 2 6 13 7 2 10 34 17 7 11...

correct output
52.96666666666666666713

user output
Update with(19, 47, 1)
Update with(21, 42, 1)
Update with(22, 49, 1)
Update with(24, 39, 1)
Update with(25, 48, 1)
...

Test 40

Verdict:

input
200 72
51 37 52 34 51 26 38 40 24 27 ...

correct output
89.00000000000000000000

user output
Update with(73, 70, 1)
Update with(74, 71, 1)
Update with(80, 65, 1)
Update with(84, 57, 1)
Update with(87, 72, 1)
...

Test 41

Verdict:

input
200 72
94 2 14 31 100 16 25 11 41 20 ...

correct output
73.91891891891891892136

user output
Update with(34, 72, 1)
Update with(39, 64, 1)
Update with(45, 67, 1)
Update with(46, 67, 1)
Update with(47, 63, 1)
...

Test 42

Verdict:

input
200 2
19 12 20 10 11 9 8 8 4 5 15 13...

correct output
36.90000000000000000139

user output
Update with(34, 2, 1)
Update with(36, 18, 20)
Update with(38, 16, 17)
Update with(37, 12, 18)
Update with(38, 11, 14)
...

Test 43

Verdict:

input
200 71
8 4 2 6 6 9 5 9 2 3 2 3 3 2 2 ...

correct output
177.00000000000000000000

user output
Update with(115, 71, 1)
Update with(116, 68, 1)
Update with(117, 71, 1)
Update with(118, 68, 1)
Update with(119, 68, 1)
...

Test 44

Verdict:

input
200 55
17 89 79 66 56 64 55 21 14 89 ...

correct output
58.62790697674418604821

user output
Update with(59, 55, 1)
Update with(65, 48, 1)
Update with(68, 48, 1)
Update with(72, 47, 1)
Update with(74, 21, 1)
...

Test 45

Verdict:

input
200 87
6 3 4 7 7 4 2 5 4 6 4 5 4 3 7 ...

correct output
184.00000000000000000000

user output
Update with(103, 84, 1)
Update with(104, 87, 1)
Update with(105, 84, 1)
Update with(106, 85, 1)
Update with(107, 81, 1)
...

Test 46

Verdict:

input
200 33
21 79 8 5 36 12 94 57 11 51 59...

correct output
39.97647058823529411797

user output
Update with(48, 22, 1)
Update with(46, 25, 1)
Update with(45, 31, 1)
Update with(46, 22, 1)
Update with(41, 30, 1)
...

Test 47

Verdict:

input
1000 78
9 12 24 18 12 24 9 14 8 13 3 3...

correct output
778.00000000000000000000

user output
Update with(721, 76, 1)
Update with(722, 74, 1)
Update with(723, 71, 1)
Update with(724, 75, 1)
Update with(725, 75, 1)
...

Test 48

Verdict:

input
1000 97
2 3 2 3 3 2 2 2 3 2 3 2 2 3 3 ...

correct output
980.00000000000000000000

user output
Update with(884, 97, 1)
Update with(885, 96, 1)
Update with(886, 96, 1)
Update with(887, 94, 1)
Update with(888, 94, 1)
...

Test 49

Verdict:

input
10000 50
20 20 2 6 13 7 2 10 34 17 7 11...

correct output
6049.00000000000000000000

user output
Update with(6029, 40, 1)
Update with(6030, 39, 1)
Update with(6031, 45, 1)
Update with(6032, 49, 1)
Update with(6028, 37, 1)
...

Test 50

Verdict:

input
100000 59
39252 46336 33082 47087 29905 ...

correct output
64.97006295772838237179

user output
Update with(161, 54667, 54841)
Update with(212, 54573, 54832)
Update with(141, 54469, 54785)
Update with(156, 16, 1)
Update with(164, 54140, 54641)
...

Test 51

Verdict:

input
100000 100
30041 38891 6 5345 12609 41664...

correct output
203.77740406665647454609

user output
Update with(237, 41531, 41641)
Update with(243, 41525, 41573)
Update with(275, 41215, 41658)
Update with(300, 41190, 41553)
Update with(244, 41016, 41578)
...

Test 52

Verdict:

input
100000 18
1132 40617 23967 41323 18982 2...

correct output
40.94677609727978918885

user output
Update with(59, 43563, 43595)
Update with(63, 3, 1)
Update with(88, 43289, 43439)
Update with(78, 1, 1)
Update with(81, 43255, 43453)
...

Test 53

Verdict:

input
100000 7
39007 46266 16025 6684 28138 3...

correct output
14.93255621844882973827

user output
Update with(44, 54563, 54894)
Update with(68, 54442, 54892)
Update with(44, 54395, 54731)
Update with(51, 54387, 54895)
Update with(69, 54321, 54550)
...

Test 54

Verdict:

input
100000 90
52921 16702 94063 82743 69126 ...

correct output
91.66979787325027796002

user output
Update with(233, 96309, 96653)
Update with(246, 96296, 96636)
Update with(362, 95761, 96308)
Update with(257, 95703, 96565)
Update with(283, 95677, 96012)
...

Test 55

Verdict:

input
100000 5
19332 18457 4591 8077 20395 21...

correct output
35.88927530302255408320

user output
Update with(44, 21951, 22117)
Update with(50, 21925, 22057)
Update with(46, 21922, 21972)
Update with(49, 21893, 22001)
Update with(49, 21790, 22131)
...

Test 56

Verdict:

input
100000 95
29643 18699 73326 5739 3724 33...

correct output
96.91999685748703713406

user output
Update with(346, 89204, 89284)
Update with(288, 89188, 89208)
Update with(342, 88955, 89178)
Update with(374, 88923, 89164)
Update with(251, 88808, 88878)
...

Test 57

Verdict:

input
100000 22
5953 2436 3347 7466 5522 3478 ...

correct output
330.93907248742010063225

user output
Update with(338, 7592, 7596)
Update with(353, 7533, 7578)
Update with(347, 7456, 7581)
Update with(350, 2, 1)
Update with(347, 17, 1)
...

Test 58

Verdict:

input
100000 1
84598 20915 75920 32975 46369 ...

correct output
2.81955087271179225200

user output
Update with(96, 87328, 87333)
Update with(116, 86882, 87165)
Update with(121, 86726, 87045)
Update with(92, 86667, 86680)
Update with(110, 86649, 87209)
...

Test 59

Verdict:

input
100000 36
522 520 516 9 140 330 149 15 2...

correct output
3870.97771317829457360382

user output
Update with(3881, 34, 1)
Update with(3869, 27, 1)
Update with(3870, 1009, 1032)
Update with(3871, 1008, 1035)
Update with(3876, 994, 1017)
...