Task: | Yet another game |
Sender: | aalto2024c_010 |
Submission time: | 2024-09-18 16:35:51 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | WRONG ANSWER | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.00 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
#45 | WRONG ANSWER | 0.00 s | details |
#46 | WRONG ANSWER | 0.00 s | details |
#47 | WRONG ANSWER | 0.00 s | details |
#48 | WRONG ANSWER | 0.00 s | details |
#49 | WRONG ANSWER | 0.00 s | details |
#50 | WRONG ANSWER | 0.00 s | details |
#51 | WRONG ANSWER | 0.00 s | details |
#52 | WRONG ANSWER | 0.00 s | details |
#53 | WRONG ANSWER | 0.00 s | details |
#54 | WRONG ANSWER | 0.00 s | details |
#55 | WRONG ANSWER | 0.00 s | details |
#56 | WRONG ANSWER | 0.01 s | details |
#57 | WRONG ANSWER | 0.01 s | details |
#58 | WRONG ANSWER | 0.01 s | details |
#59 | WRONG ANSWER | 0.02 s | details |
#60 | WRONG ANSWER | 0.02 s | details |
#61 | WRONG ANSWER | 0.02 s | details |
#62 | WRONG ANSWER | 0.02 s | details |
Code
// ~/.vim/cpp_template.cpp #include <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm> #include <string> #define REP(i,a,b) for (int i = a; i < b; i++) using namespace std; template <typename T> void pV(const std::vector<T>& vec, const std::string& label = "Vector") { std::cout << label << ": [ "; for (const auto& elem : vec) { std::cout << elem << " "; } std::cout << "]" << std::endl; } using namespace std; void dfs(int s, vector<bool> *visited, vector<int> (*adj)[]) { if ((*visited)[s]) return; (*visited)[s] = true; // process node s for (auto u: (*adj)[s]) { dfs(u, visited, adj); } } /* vector<int> adj[N]; vector<bool> visited(N, false); int u, v; for(int i = 0; i < M;i++){ cin >> u >> v; u--; v--; adj[u].push_back(v); adj[v].push_back(u); } */ int main() { ios::sync_with_stdio(0); cin.tie(0); // Your code starts here int n, k; cin>>n>>k; vector<int> val(n,0); REP(i, 0, n){ cin >> val[i]; } vector<double> dp(n+1, 1e9); dp[0] = 0; REP(i, 0, (int)dp.size()-1){ if(dp[i] == 1e9) continue; dp[i+1] = min(dp[i + 1], dp[i] + 1); int dex = min(i+val[i] + k, n); if(dex < n){ dp[dex] = min(dp[dex], dp[i] + 1 + k); }else{ if(i + val[i] < n){ dp[n] = min(dp[n], dp[i] + 1 + n - (i + val[i])); }else{ dp[n] = min(dp[n], dp[i] + 1.0 * (n-i) / val[i]); } } } double res = dp[n]; cout << setprecision(20) << res << '\n'; return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1 7 |
correct output |
---|
Maija |
user output |
---|
1 |
Test 2
Verdict: WRONG ANSWER
input |
---|
1 9 |
correct output |
---|
Maija |
user output |
---|
1 |
Test 3
Verdict: WRONG ANSWER
input |
---|
2 3 8 |
correct output |
---|
Uolevi |
user output |
---|
0.25 |
Test 4
Verdict: WRONG ANSWER
input |
---|
2 0 4 |
correct output |
---|
Maija |
user output |
---|
0.5 |
Test 5
Verdict: WRONG ANSWER
input |
---|
3 0 7 8 |
correct output |
---|
Uolevi |
user output |
---|
0.42857142857142854764 |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 2 8 9 |
correct output |
---|
Uolevi |
user output |
---|
0.375 |
Test 7
Verdict: WRONG ANSWER
input |
---|
3 5 8 9 |
correct output |
---|
Maija |
user output |
---|
0.375 |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 0 3 6 10 |
correct output |
---|
Maija |
user output |
---|
1.5 |
Test 9
Verdict: WRONG ANSWER
input |
---|
4 4 6 7 9 |
correct output |
---|
Uolevi |
user output |
---|
0.66666666666666662966 |
Test 10
Verdict: WRONG ANSWER
input |
---|
4 2 6 7 9 |
correct output |
---|
Uolevi |
user output |
---|
0.66666666666666662966 |
Test 11
Verdict: WRONG ANSWER
input |
---|
4 2 6 7 9 |
correct output |
---|
Uolevi |
user output |
---|
0.66666666666666662966 |
Test 12
Verdict: WRONG ANSWER
input |
---|
4 0 3 5 8 |
correct output |
---|
Uolevi |
user output |
---|
1.6000000000000000888 |
Test 13
Verdict: WRONG ANSWER
input |
---|
5 4 5 6 7 9 |
correct output |
---|
Maija |
user output |
---|
1 |
Test 14
Verdict: WRONG ANSWER
input |
---|
5 0 1 4 7 10 |
correct output |
---|
Uolevi |
user output |
---|
2 |
Test 15
Verdict: WRONG ANSWER
input |
---|
5 0 2 4 6 10 |
correct output |
---|
Uolevi |
user output |
---|
1.5 |
Test 16
Verdict: WRONG ANSWER
input |
---|
5 0 3 6 7 9 |
correct output |
---|
Maija |
user output |
---|
1.2222222222222223209 |
Test 17
Verdict: WRONG ANSWER
input |
---|
5 1 6 7 9 10 |
correct output |
---|
Maija |
user output |
---|
0.83333333333333337034 |
Test 18
Verdict: WRONG ANSWER
input |
---|
5 0 2 4 9 10 |
correct output |
---|
Maija |
user output |
---|
1.3333333333333332593 |
Test 19
Verdict: WRONG ANSWER
input |
---|
5 0 2 3 9 10 |
correct output |
---|
Uolevi |
user output |
---|
1.3333333333333332593 |
Test 20
Verdict: WRONG ANSWER
input |
---|
5 0 2 3 4 8 |
correct output |
---|
Maija |
user output |
---|
1.75 |
Test 21
Verdict: WRONG ANSWER
input |
---|
5 0 2 4 9 10 |
correct output |
---|
Maija |
user output |
---|
1.3333333333333332593 |
Test 22
Verdict: WRONG ANSWER
input |
---|
5 0 1 3 4 5 |
correct output |
---|
Maija |
user output |
---|
2.75 |
Test 23
Verdict: WRONG ANSWER
input |
---|
10 1 6 8 9 11 12 13 15 17 18 |
correct output |
---|
Maija |
user output |
---|
2.1764705882352939348 |
Test 24
Verdict: WRONG ANSWER
input |
---|
10 0 1 2 3 4 6 8 15 19 20 |
correct output |
---|
Maija |
user output |
---|
3.1578947368421053099 |
Test 25
Verdict: WRONG ANSWER
input |
---|
10 0 3 4 6 8 9 10 11 14 19 |
correct output |
---|
Maija |
user output |
---|
1.875 |
Test 26
Verdict: WRONG ANSWER
input |
---|
10 0 1 2 6 9 10 11 14 17 18 |
correct output |
---|
Maija |
user output |
---|
2.7777777777777776791 |
Test 27
Verdict: WRONG ANSWER
input |
---|
10 2 3 4 11 12 14 15 17 18 20 |
correct output |
---|
Maija |
user output |
---|
2.727272727272727515 |
Test 28
Verdict: WRONG ANSWER
input |
---|
10 1 4 7 8 10 12 17 18 19 20 |
correct output |
---|
Maija |
user output |
---|
2.2941176470588233727 |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 0 1 2 4 6 7 17 18 19 20 |
correct output |
---|
Maija |
user output |
---|
3.2222222222222223209 |
Test 30
Verdict: WRONG ANSWER
input |
---|
10 1 4 5 6 9 10 11 15 16 20 |
correct output |
---|
Uolevi |
user output |
---|
2.4545454545454545858 |
Test 31
Verdict: WRONG ANSWER
input |
---|
10 0 4 5 7 8 11 12 17 18 20 |
correct output |
---|
Maija |
user output |
---|
1.5454545454545454142 |
Test 32
Verdict: WRONG ANSWER
input |
---|
10 0 1 2 4 5 6 7 8 10 18 |
correct output |
---|
Uolevi |
user output |
---|
3.1111111111111111605 |
Test 33
Verdict: WRONG ANSWER
input |
---|
100 20175392 21709340 41258986 608... |
correct output |
---|
Maija |
user output |
---|
4.6063123061318311615e-06 |
Test 34
Verdict: WRONG ANSWER
input |
---|
100 122815 19636891 20795113 29407... |
correct output |
---|
Maija |
user output |
---|
5.0924558271469753677e-06 |
Test 35
Verdict: WRONG ANSWER
input |
---|
100 27838075 70100849 85518673 881... |
correct output |
---|
Uolevi |
user output |
---|
1.4265162466149305466e-06 |
Test 36
Verdict: WRONG ANSWER
input |
---|
100 20130522 22134653 24822300 257... |
correct output |
---|
Maija |
user output |
---|
4.5178029219613248798e-06 |
Test 37
Verdict: WRONG ANSWER
input |
---|
100 5539595 6689687 9648745 204276... |
correct output |
---|
Maija |
user output |
---|
1.4948382487850328325e-05 |
Test 38
Verdict: WRONG ANSWER
input |
---|
100 1763266 2377495 6157974 156559... |
correct output |
---|
Maija |
user output |
---|
4.2061076889751607762e-05 |
Test 39
Verdict: WRONG ANSWER
input |
---|
100 44771411 58491553 63972354 689... |
correct output |
---|
Uolevi |
user output |
---|
1.7096485709654520844e-06 |
Test 40
Verdict: WRONG ANSWER
input |
---|
100 17083618 26735341 70798610 773... |
correct output |
---|
Uolevi |
user output |
---|
3.7403674783875021e-06 |
Test 41
Verdict: WRONG ANSWER
input |
---|
100 11934037 12239372 22850647 308... |
correct output |
---|
Maija |
user output |
---|
8.1703538384158933835e-06 |
Test 42
Verdict: WRONG ANSWER
input |
---|
100 8099342 11139167 14304400 4141... |
correct output |
---|
Uolevi |
user output |
---|
8.9773319674621988016e-06 |
Test 43
Verdict: WRONG ANSWER
input |
---|
200 5041735 10046682 14572439 2017... |
correct output |
---|
Maija |
user output |
---|
1.9907069816681767651e-05 |
Test 44
Verdict: WRONG ANSWER
input |
---|
200 122815 3081987 9672261 1252970... |
correct output |
---|
Uolevi |
user output |
---|
6.4893200393123011091e-05 |
Test 45
Verdict: WRONG ANSWER
input |
---|
200 5953276 13977260 27435118 2783... |
correct output |
---|
Uolevi |
user output |
---|
1.4308956118724270752e-05 |
Test 46
Verdict: WRONG ANSWER
input |
---|
200 20130522 22134653 22790965 248... |
correct output |
---|
Maija |
user output |
---|
9.0356058439226497595e-06 |
Test 47
Verdict: WRONG ANSWER
input |
---|
200 3142408 5539595 6689687 964874... |
correct output |
---|
Uolevi |
user output |
---|
3.6103722384037099523e-05 |
Test 48
Verdict: WRONG ANSWER
input |
---|
200 1763266 2377495 6157974 132815... |
correct output |
---|
Maija |
user output |
---|
8.4122153779503215524e-05 |
Test 49
Verdict: WRONG ANSWER
input |
---|
200 915343 26318970 39308104 44426... |
correct output |
---|
Maija |
user output |
---|
7.5990815750008457475e-06 |
Test 50
Verdict: WRONG ANSWER
input |
---|
200 1532100 17083618 26735341 4256... |
correct output |
---|
Maija |
user output |
---|
1.1707121992542796765e-05 |
Test 51
Verdict: WRONG ANSWER
input |
---|
200 8921055 9526546 11934037 12239... |
correct output |
---|
Uolevi |
user output |
---|
2.0993967803231097129e-05 |
Test 52
Verdict: WRONG ANSWER
input |
---|
200 4900392 7823022 8099342 874567... |
correct output |
---|
Uolevi |
user output |
---|
2.5565567884124575288e-05 |
Test 53
Verdict: WRONG ANSWER
input |
---|
1000 59432 2902554 4346620 5041735 ... |
correct output |
---|
Maija |
user output |
---|
0.00034452416733676615801 |
Test 54
Verdict: WRONG ANSWER
input |
---|
1000 122815 431669 1088001 3081987 ... |
correct output |
---|
Uolevi |
user output |
---|
0.0023165897944953193349 |
Test 55
Verdict: WRONG ANSWER
input |
---|
1000 132697 1654352 2021488 2665480... |
correct output |
---|
Maija |
user output |
---|
0.0006044662804530111927 |
Test 56
Verdict: WRONG ANSWER
input |
---|
10000 15821 289539 424626 514124 549... |
correct output |
---|
Maija |
user output |
---|
0.03453766159308417627 |
Test 57
Verdict: WRONG ANSWER
input |
---|
10000 2993 411720 417065 471376 8375... |
correct output |
---|
Uolevi |
user output |
---|
0.024288351306713300282 |
Test 58
Verdict: WRONG ANSWER
input |
---|
10000 68014 305895 411135 428373 484... |
correct output |
---|
Maija |
user output |
---|
0.032690956047009597785 |
Test 59
Verdict: WRONG ANSWER
input |
---|
100000 7176 18493 20082 35162 36875 4... |
correct output |
---|
Maija |
user output |
---|
12.920470969464313171 |
Test 60
Verdict: WRONG ANSWER
input |
---|
100000 3073 7000 8135 23450 35708 424... |
correct output |
---|
Maija |
user output |
---|
14.981496205986001513 |
Test 61
Verdict: WRONG ANSWER
input |
---|
100000 1190 7700 13172 20678 24336 30... |
correct output |
---|
Uolevi |
user output |
---|
15.858299282354153092 |
Test 62
Verdict: WRONG ANSWER
input |
---|
100000 6595 11761 30311 52174 56810 6... |
correct output |
---|
Uolevi |
user output |
---|
9.880768451557779386 |