Task: | Perfect run |
Sender: | aalto2024l_005 |
Submission time: | 2024-11-20 17:19:11 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
#15 | ACCEPTED | 0.00 s | details |
#16 | ACCEPTED | 0.00 s | details |
#17 | ACCEPTED | 0.00 s | details |
#18 | ACCEPTED | 0.00 s | details |
#19 | ACCEPTED | 0.00 s | details |
#20 | ACCEPTED | 0.00 s | details |
#21 | ACCEPTED | 0.00 s | details |
#22 | ACCEPTED | 0.00 s | details |
#23 | ACCEPTED | 0.00 s | details |
#24 | ACCEPTED | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | ACCEPTED | 0.00 s | details |
#28 | ACCEPTED | 0.00 s | details |
#29 | ACCEPTED | 0.00 s | details |
#30 | ACCEPTED | 0.00 s | details |
#31 | ACCEPTED | 0.00 s | details |
#32 | ACCEPTED | 0.00 s | details |
#33 | ACCEPTED | 0.00 s | details |
#34 | ACCEPTED | 0.00 s | details |
#35 | ACCEPTED | 0.00 s | details |
#36 | ACCEPTED | 0.00 s | details |
#37 | ACCEPTED | 0.00 s | details |
#38 | ACCEPTED | 0.00 s | details |
#39 | ACCEPTED | 0.00 s | details |
#40 | ACCEPTED | 0.01 s | details |
#41 | ACCEPTED | 0.00 s | details |
#42 | ACCEPTED | 0.00 s | details |
#43 | ACCEPTED | 0.00 s | details |
#44 | ACCEPTED | 0.00 s | details |
#45 | ACCEPTED | 0.00 s | details |
#46 | ACCEPTED | 0.00 s | details |
#47 | ACCEPTED | 0.00 s | details |
#48 | ACCEPTED | 0.00 s | details |
#49 | ACCEPTED | 0.00 s | details |
#50 | ACCEPTED | 0.00 s | details |
#51 | ACCEPTED | 0.00 s | details |
#52 | ACCEPTED | 0.00 s | details |
#53 | ACCEPTED | 0.00 s | details |
#54 | ACCEPTED | 0.00 s | details |
#55 | ACCEPTED | 0.00 s | details |
#56 | ACCEPTED | 0.00 s | details |
#57 | ACCEPTED | 0.00 s | details |
#58 | ACCEPTED | 0.00 s | details |
#59 | ACCEPTED | 0.00 s | details |
#60 | ACCEPTED | 0.00 s | details |
#61 | ACCEPTED | 0.00 s | details |
#62 | ACCEPTED | 0.00 s | details |
#63 | ACCEPTED | 0.00 s | details |
#64 | ACCEPTED | 0.00 s | details |
#65 | ACCEPTED | 0.00 s | details |
#66 | ACCEPTED | 0.04 s | details |
#67 | ACCEPTED | 0.04 s | details |
#68 | ACCEPTED | 0.04 s | details |
#69 | ACCEPTED | 0.04 s | details |
#70 | ACCEPTED | 0.04 s | details |
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 |