CSES - Aalto Competitive Programming 2024 - wk11 - Wed - Results
Submission details
Task:Perfect run
Sender:aalto2024l_005
Submission time:2024-11-20 17:19:11 +0200
Language:C++ (C++17)
Status:READY
Result:ACCEPTED
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
#23ACCEPTED0.00 sdetails
#24ACCEPTED0.00 sdetails
#25ACCEPTED0.00 sdetails
#26ACCEPTED0.00 sdetails
#27ACCEPTED0.00 sdetails
#28ACCEPTED0.00 sdetails
#29ACCEPTED0.00 sdetails
#30ACCEPTED0.00 sdetails
#31ACCEPTED0.00 sdetails
#32ACCEPTED0.00 sdetails
#33ACCEPTED0.00 sdetails
#34ACCEPTED0.00 sdetails
#35ACCEPTED0.00 sdetails
#36ACCEPTED0.00 sdetails
#37ACCEPTED0.00 sdetails
#38ACCEPTED0.00 sdetails
#39ACCEPTED0.00 sdetails
#40ACCEPTED0.01 sdetails
#41ACCEPTED0.00 sdetails
#42ACCEPTED0.00 sdetails
#43ACCEPTED0.00 sdetails
#44ACCEPTED0.00 sdetails
#45ACCEPTED0.00 sdetails
#46ACCEPTED0.00 sdetails
#47ACCEPTED0.00 sdetails
#48ACCEPTED0.00 sdetails
#49ACCEPTED0.00 sdetails
#50ACCEPTED0.00 sdetails
#51ACCEPTED0.00 sdetails
#52ACCEPTED0.00 sdetails
#53ACCEPTED0.00 sdetails
#54ACCEPTED0.00 sdetails
#55ACCEPTED0.00 sdetails
#56ACCEPTED0.00 sdetails
#57ACCEPTED0.00 sdetails
#58ACCEPTED0.00 sdetails
#59ACCEPTED0.00 sdetails
#60ACCEPTED0.00 sdetails
#61ACCEPTED0.00 sdetails
#62ACCEPTED0.00 sdetails
#63ACCEPTED0.00 sdetails
#64ACCEPTED0.00 sdetails
#65ACCEPTED0.00 sdetails
#66ACCEPTED0.04 sdetails
#67ACCEPTED0.04 sdetails
#68ACCEPTED0.04 sdetails
#69ACCEPTED0.04 sdetails
#70ACCEPTED0.04 sdetails

Code

#include <iostream>
#include <vector>

using namespace std;

const long long MOD = 998244353;

long long mod_pow(long long x, long long y, long long mod) {
    long long result = 1;
    while (y > 0) {
        if (y % 2 == 1) {
            result = (result * x) % mod;
        }
        x = (x * x) % mod;
        y /= 2;
    }
    return result;
}

long long  modinv(long long a, long long MOD) {
    return mod_pow(a, MOD - 2, MOD);
}

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; ++i) {
        cin >> p[i];
    }

    long long total_time = 0;
    for(int i = 0; i < n; ++i) {
        long long numerator = (500 - 4LL * p[i]) % MOD;
        if (numerator < 0) numerator += MOD;
        long long denominator = p[i] % MOD;
        long long inv_denominator = modinv(denominator, MOD);
        long long res = (numerator * inv_denominator) % MOD;
        total_time = (total_time + res) % MOD;
    }

    cout << total_time << endl;
    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
1
65 

correct output
153576058

user output
153576058

Test 2

Verdict: ACCEPTED

input
1
26 

correct output
383940151

user output
383940151

Test 3

Verdict: ACCEPTED

input
1
83 

correct output
120270406

user output
120270406

Test 4

Verdict: ACCEPTED

input
1
56 

correct output
71303173

user output
71303173

Test 5

Verdict: ACCEPTED

input
2
21 43 

correct output
337170047

user output
337170047

Test 6

Verdict: ACCEPTED

input
2
63 91 

correct output
141387484

user output
141387484

Test 7

Verdict: ACCEPTED

input
2
21 100 

correct output
522889920

user output
522889920

Test 8

Verdict: ACCEPTED

input
2
55 76 

correct output
429865997

user output
429865997

Test 9

Verdict: ACCEPTED

input
2
5 89 

correct output
628108904

user output
628108904

Test 10

Verdict: ACCEPTED

input
2
50 39 

correct output
588708223

user output
588708223

Test 11

Verdict: ACCEPTED

input
3
16 82 16 

correct output
888681005

user output
888681005

Test 12

Verdict: ACCEPTED

input
3
42 100 73 

correct output
541773855

user output
541773855

Test 13

Verdict: ACCEPTED

input
3
16 45 75 

correct output
859599341

user output
859599341

Test 14

Verdict: ACCEPTED

input
3
52 67 95 

correct output
635416411

user output
635416411

Test 15

Verdict: ACCEPTED

input
3
97 91 55 

correct output
753898258

user output
753898258

Test 16

Verdict: ACCEPTED

input
3
23 6 88 

correct output
74309461

user output
74309461

Test 17

Verdict: ACCEPTED

input
4
90 95 34 21 

correct output
565470703

user output
565470703

Test 18

Verdict: ACCEPTED

input
4
12 86 98 91 

correct output
10046506

user output
10046506

Test 19

Verdict: ACCEPTED

input
4
37 84 46 90 

correct output
571617009

user output
571617009

Test 20

Verdict: ACCEPTED

input
4
30 41 81 60 

correct output
360101423

user output
360101423

Test 21

Verdict: ACCEPTED

input
4
93 66 88 9 

correct output
166699384

user output
166699384

Test 22

Verdict: ACCEPTED

input
5
36 48 35 83 94 

correct output
179015479

user output
179015479

Test 23

Verdict: ACCEPTED

input
5
89 92 79 24 43 

correct output
980334799

user output
980334799

Test 24

Verdict: ACCEPTED

input
5
56 8 71 84 30 

correct output
730439108

user output
730439108

Test 25

Verdict: ACCEPTED

input
5
52 93 78 66 88 

correct output
431191434

user output
431191434

Test 26

Verdict: ACCEPTED

input
5
23 6 88 84 21 

correct output
977482945

user output
977482945

Test 27

Verdict: ACCEPTED

input
5
90 95 34 21 83 

correct output
685741109

user output
685741109

Test 28

Verdict: ACCEPTED

input
5
8 23 78 32 44 

correct output
455631822

user output
455631822

Test 29

Verdict: ACCEPTED

input
5
88 2 97 24 87 

correct output
519774700

user output
519774700

Test 30

Verdict: ACCEPTED

input
5
2 37 51 50 50 

correct output
483516616

user output
483516616

Test 31

Verdict: ACCEPTED

input
10
55 60 72 85 61 86 55 85 43 63 

correct output
155971367

user output
155971367

Test 32

Verdict: ACCEPTED

input
10
42 100 73 94 1 13 31 100 15 24...

correct output
865571866

user output
865571866

Test 33

Verdict: ACCEPTED

input
10
44 19 3 94 55 95 44 49 43 33 

correct output
690840298

user output
690840298

Test 34

Verdict: ACCEPTED

input
10
56 8 71 84 30 13 52 57 90 44 

correct output
382913125

user output
382913125

Test 35

Verdict: ACCEPTED

input
10
97 91 55 18 98 86 72 61 70 60 

correct output
578788309

user output
578788309

Test 36

Verdict: ACCEPTED

input
10
23 6 88 84 21 37 92 98 49 9 

correct output
404411049

user output
404411049

Test 37

Verdict: ACCEPTED

input
10
90 95 34 21 83 7 5 38 11 99 

correct output
865572387

user output
865572387

Test 38

Verdict: ACCEPTED

input
10
8 23 78 32 44 98 73 46 98 31 

correct output
39915528

user output
39915528

Test 39

Verdict: ACCEPTED

input
10
88 2 97 24 87 38 54 82 24 43 

correct output
243950411

user output
243950411

Test 40

Verdict: ACCEPTED

input
10
2 37 51 50 50 1 14 32 15 2 

correct output
477575500

user output
477575500

Test 41

Verdict: ACCEPTED

input
100
55 60 72 85 61 86 55 85 43 63 ...

correct output
768902

user output
768902

Test 42

Verdict: ACCEPTED

input
100
42 100 73 94 1 13 31 100 15 24...

correct output
89425172

user output
89425172

Test 43

Verdict: ACCEPTED

input
100
44 19 3 94 55 95 44 49 43 33 3...

correct output
84130893

user output
84130893

Test 44

Verdict: ACCEPTED

input
100
56 8 71 84 30 13 52 57 90 44 9...

correct output
708013405

user output
708013405

Test 45

Verdict: ACCEPTED

input
100
97 91 55 18 98 86 72 61 70 60 ...

correct output
858305627

user output
858305627

Test 46

Verdict: ACCEPTED

input
100
23 6 88 84 21 37 92 98 49 9 62...

correct output
165441381

user output
165441381

Test 47

Verdict: ACCEPTED

input
100
90 95 34 21 83 7 5 38 11 99 60...

correct output
306956928

user output
306956928

Test 48

Verdict: ACCEPTED

input
100
8 23 78 32 44 98 73 46 98 31 5...

correct output
66655283

user output
66655283

Test 49

Verdict: ACCEPTED

input
100
88 2 97 24 87 38 54 82 24 43 2...

correct output
842227623

user output
842227623

Test 50

Verdict: ACCEPTED

input
100
2 37 51 50 50 1 14 32 15 2 22 ...

correct output
512304517

user output
512304517

Test 51

Verdict: ACCEPTED

input
200
55 60 72 85 61 86 55 85 43 63 ...

correct output
676541360

user output
676541360

Test 52

Verdict: ACCEPTED

input
200
42 100 73 94 1 13 31 100 15 24...

correct output
739616457

user output
739616457

Test 53

Verdict: ACCEPTED

input
200
44 19 3 94 55 95 44 49 43 33 3...

correct output
680607517

user output
680607517

Test 54

Verdict: ACCEPTED

input
200
56 8 71 84 30 13 52 57 90 44 9...

correct output
69478296

user output
69478296

Test 55

Verdict: ACCEPTED

input
200
97 91 55 18 98 86 72 61 70 60 ...

correct output
810350619

user output
810350619

Test 56

Verdict: ACCEPTED

input
200
23 6 88 84 21 37 92 98 49 9 62...

correct output
271509879

user output
271509879

Test 57

Verdict: ACCEPTED

input
200
90 95 34 21 83 7 5 38 11 99 60...

correct output
260281729

user output
260281729

Test 58

Verdict: ACCEPTED

input
200
8 23 78 32 44 98 73 46 98 31 5...

correct output
95628936

user output
95628936

Test 59

Verdict: ACCEPTED

input
200
88 2 97 24 87 38 54 82 24 43 2...

correct output
653095398

user output
653095398

Test 60

Verdict: ACCEPTED

input
200
2 37 51 50 50 1 14 32 15 2 22 ...

correct output
634589250

user output
634589250

Test 61

Verdict: ACCEPTED

input
1000
55 60 72 85 61 86 55 85 43 63 ...

correct output
333780085

user output
333780085

Test 62

Verdict: ACCEPTED

input
1000
42 100 73 94 1 13 31 100 15 24...

correct output
552341913

user output
552341913

Test 63

Verdict: ACCEPTED

input
1000
44 19 3 94 55 95 44 49 43 33 3...

correct output
390722203

user output
390722203

Test 64

Verdict: ACCEPTED

input
1000
56 8 71 84 30 13 52 57 90 44 9...

correct output
8321130

user output
8321130

Test 65

Verdict: ACCEPTED

input
1000
97 91 55 18 98 86 72 61 70 60 ...

correct output
860563428

user output
860563428

Test 66

Verdict: ACCEPTED

input
100000
23 6 88 84 21 37 92 98 49 9 62...

correct output
742189691

user output
742189691

Test 67

Verdict: ACCEPTED

input
100000
90 95 34 21 83 7 5 38 11 99 60...

correct output
318788252

user output
318788252

Test 68

Verdict: ACCEPTED

input
100000
8 23 78 32 44 98 73 46 98 31 5...

correct output
417579105

user output
417579105

Test 69

Verdict: ACCEPTED

input
100000
88 2 97 24 87 38 54 82 24 43 2...

correct output
376492818

user output
376492818

Test 70

Verdict: ACCEPTED

input
100000
2 37 51 50 50 1 14 32 15 2 22 ...

correct output
134636760

user output
134636760