CSES - Aalto Competitive Programming 2024 - wk1 - Wed - Results
Submission details
Task:Scorpion and frogs
Sender:aalto2024a_001
Submission time:2024-09-04 16:39:38 +0300
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#13ACCEPTED0.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#16ACCEPTED0.00 sdetails
#17ACCEPTED0.00 sdetails
#18ACCEPTED0.00 sdetails
#19ACCEPTED0.00 sdetails
#20ACCEPTED0.00 sdetails
#21ACCEPTED0.00 sdetails
#22ACCEPTED0.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.01 sdetails
#360.01 sdetails
#370.01 sdetails
#380.01 sdetails
#390.02 sdetails
#400.03 sdetails
#410.05 sdetails
#420.06 sdetails
#430.09 sdetails
#440.11 sdetails
#450.14 sdetails
#460.17 sdetails
#470.68 sdetails
#48--details
#49--details
#50--details
#51--details
#52--details
#53--details
#54--details
#55--details

Code

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

#define MODUL 998244353

typedef long long ll;

int calculate_jumps(int i, int m, ll* arr) {
    if (arr[i] != 0 || i == m-1) {
        return arr[i];
    }

    ll temp = 1;
    for (int j = i + 2; j < m; j++) {
        temp += calculate_jumps(j, m, arr) % MODUL;
    }
    return temp;
}

int main() {

    int n;
    cin >> n;
    int m = n + 2;

    ll arr[m];
    for (int i = 0; i < m; i++) {
        arr[i] = 0;
    }

    arr[m-2] = 1;
    arr[m-3] = 1;

    for (int i = m-2; i > 0; i--) {
        arr[i] = calculate_jumps(i, m, arr);
    }


    arr[0] = 1;
    for (int i = 1; i < m; i++) {
        arr[0] += arr[i] % MODUL;
    }
    cout << arr[0] << endl;
    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output
2

user output
2

Test 2

Verdict: ACCEPTED

input
2

correct output
3

user output
3

Test 3

Verdict: ACCEPTED

input
3

correct output
5

user output
5

Test 4

Verdict: ACCEPTED

input
4

correct output
8

user output
8

Test 5

Verdict: ACCEPTED

input
5

correct output
13

user output
13

Test 6

Verdict: ACCEPTED

input
6

correct output
21

user output
21

Test 7

Verdict: ACCEPTED

input
7

correct output
34

user output
34

Test 8

Verdict: ACCEPTED

input
8

correct output
55

user output
55

Test 9

Verdict: ACCEPTED

input
9

correct output
89

user output
89

Test 10

Verdict: ACCEPTED

input
10

correct output
144

user output
144

Test 11

Verdict: ACCEPTED

input
11

correct output
233

user output
233

Test 12

Verdict: ACCEPTED

input
12

correct output
377

user output
377

Test 13

Verdict: ACCEPTED

input
13

correct output
610

user output
610

Test 14

Verdict: ACCEPTED

input
14

correct output
987

user output
987

Test 15

Verdict: ACCEPTED

input
15

correct output
1597

user output
1597

Test 16

Verdict: ACCEPTED

input
16

correct output
2584

user output
2584

Test 17

Verdict: ACCEPTED

input
17

correct output
4181

user output
4181

Test 18

Verdict: ACCEPTED

input
18

correct output
6765

user output
6765

Test 19

Verdict: ACCEPTED

input
19

correct output
10946

user output
10946

Test 20

Verdict: ACCEPTED

input
20

correct output
17711

user output
17711

Test 21

Verdict: ACCEPTED

input
30

correct output
2178309

user output
2178309

Test 22

Verdict: ACCEPTED

input
40

correct output
267914296

user output
267914296

Test 23

Verdict:

input
50

correct output
9216450

user output
1795989973

Test 24

Verdict:

input
60

correct output
865709054

user output
2316940537

Test 25

Verdict:

input
70

correct output
659095774

user output
1758286387

Test 26

Verdict:

input
80

correct output
343522908

user output
3691825385

Test 27

Verdict:

input
90

correct output
666203437

user output
2102867496

Test 28

Verdict:

input
100

correct output
741707250

user output
2975480878

Test 29

Verdict:

input
200

correct output
319277240

user output
1059150361

Test 30

Verdict:

input
300

correct output
12089690

user output
1962015988

Test 31

Verdict:

input
400

correct output
356073916

user output
2116191699

Test 32

Verdict:

input
500

correct output
831535149

user output
2011805481

Test 33

Verdict:

input
600

correct output
627858041

user output
2604574164

Test 34

Verdict:

input
700

correct output
894762479

user output
2786805906

Test 35

Verdict:

input
800

correct output
695610340

user output
2060112747

Test 36

Verdict:

input
900

correct output
120428339

user output
2518619722

Test 37

Verdict:

input
1000

correct output
506723686

user output
1308696875

Test 38

Verdict:

input
2000

correct output
118272245

user output
2466949917

Test 39

Verdict:

input
3000

correct output
50602578

user output
2914723839

Test 40

Verdict:

input
4000

correct output
38687300

user output
2152648895

Test 41

Verdict:

input
5000

correct output
644069919

user output
682798727

Test 42

Verdict:

input
6000

correct output
905964874

user output
2644128504

Test 43

Verdict:

input
7000

correct output
917351342

user output
2181369119

Test 44

Verdict:

input
8000

correct output
606465604

user output
2122376196

Test 45

Verdict:

input
9000

correct output
676429656

user output
2501777566

Test 46

Verdict:

input
10000

correct output
634342956

user output
1014816898

Test 47

Verdict:

input
20000

correct output
215568895

user output
2697651475

Test 48

Verdict:

input
30000

correct output
54808147

user output
(empty)

Test 49

Verdict:

input
40000

correct output
242971895

user output
(empty)

Test 50

Verdict:

input
50000

correct output
575576968

user output
(empty)

Test 51

Verdict:

input
60000

correct output
923159168

user output
(empty)

Test 52

Verdict:

input
70000

correct output
621454924

user output
(empty)

Test 53

Verdict:

input
80000

correct output
562709198

user output
(empty)

Test 54

Verdict:

input
90000

correct output
389404104

user output
(empty)

Test 55

Verdict:

input
100000

correct output
66655788

user output
(empty)