Task: | Train schedule |
Sender: | aalto2024f_005 |
Submission time: | 2024-10-02 17:30:05 +0300 |
Language: | C++ (C++11) |
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.01 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.00 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.04 s | details |
#62 | ACCEPTED | 0.04 s | details |
#63 | ACCEPTED | 0.04 s | details |
#64 | ACCEPTED | 0.04 s | details |
#65 | ACCEPTED | 0.05 s | details |
#66 | ACCEPTED | 0.06 s | details |
#67 | ACCEPTED | 0.05 s | details |
#68 | ACCEPTED | 0.05 s | details |
#69 | ACCEPTED | 0.05 s | details |
#70 | ACCEPTED | 0.05 s | details |
#71 | ACCEPTED | 0.03 s | details |
#72 | ACCEPTED | 0.12 s | details |
Code
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <unordered_map> using namespace std; int main() { int n; cin >> n; vector<int> nums(n); vector<int> res(n); for (int i = 0; i < n; i++) cin >> nums[i]; for (int i = 0; i < n; i++) { if (nums[i] == 0) continue; int a = 0; int add = nums[i]; int idx = i; while (idx < n) { if (nums[idx] == add) { a++; nums[idx] = 0; } res[idx] += a; idx += add; } } for (int i = 0; i < n; i++) cout << res[i] << " "; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: ACCEPTED
input |
---|
2 2 2 |
correct output |
---|
1 1 |
user output |
---|
1 1 |
Test 3
Verdict: ACCEPTED
input |
---|
2 2 1 |
correct output |
---|
1 1 |
user output |
---|
1 1 |
Test 4
Verdict: ACCEPTED
input |
---|
3 2 2 3 |
correct output |
---|
1 1 2 |
user output |
---|
1 1 2 |
Test 5
Verdict: ACCEPTED
input |
---|
3 3 2 1 |
correct output |
---|
1 1 1 |
user output |
---|
1 1 1 |
Test 6
Verdict: ACCEPTED
input |
---|
3 1 2 1 |
correct output |
---|
1 2 2 |
user output |
---|
1 2 2 |
Test 7
Verdict: ACCEPTED
input |
---|
4 2 3 1 3 |
correct output |
---|
1 1 2 2 |
user output |
---|
1 1 2 2 |
Test 8
Verdict: ACCEPTED
input |
---|
4 2 3 1 1 |
correct output |
---|
1 1 2 2 |
user output |
---|
1 1 2 2 |
Test 9
Verdict: ACCEPTED
input |
---|
4 3 2 2 4 |
correct output |
---|
1 1 1 3 |
user output |
---|
1 1 1 3 |
Test 10
Verdict: ACCEPTED
input |
---|
4 2 1 3 3 |
correct output |
---|
1 1 3 2 |
user output |
---|
1 1 3 2 |
Test 11
Verdict: ACCEPTED
input |
---|
5 3 4 5 4 5 |
correct output |
---|
1 1 1 2 1 |
user output |
---|
1 1 1 2 1 |
Test 12
Verdict: ACCEPTED
input |
---|
5 5 4 5 1 1 |
correct output |
---|
1 1 1 1 2 |
user output |
---|
1 1 1 1 2 |
Test 13
Verdict: ACCEPTED
input |
---|
5 1 1 5 3 5 |
correct output |
---|
1 2 3 3 3 |
user output |
---|
1 2 3 3 3 |
Test 14
Verdict: ACCEPTED
input |
---|
5 1 4 5 2 1 |
correct output |
---|
1 2 2 2 2 |
user output |
---|
1 2 2 2 2 |
Test 15
Verdict: ACCEPTED
input |
---|
5 3 5 4 4 2 |
correct output |
---|
1 1 1 2 1 |
user output |
---|
1 1 1 2 1 |
Test 16
Verdict: ACCEPTED
input |
---|
5 1 5 5 2 2 |
correct output |
---|
1 2 2 2 2 |
user output |
---|
1 2 2 2 2 |
Test 17
Verdict: ACCEPTED
input |
---|
5 2 5 1 1 3 |
correct output |
---|
1 1 2 2 4 |
user output |
---|
1 1 2 2 4 |
Test 18
Verdict: ACCEPTED
input |
---|
5 2 4 2 3 5 |
correct output |
---|
1 1 2 1 3 |
user output |
---|
1 1 2 1 3 |
Test 19
Verdict: ACCEPTED
input |
---|
5 5 5 3 2 1 |
correct output |
---|
1 1 1 1 1 |
user output |
---|
1 1 1 1 1 |
Test 20
Verdict: ACCEPTED
input |
---|
5 2 3 3 3 1 |
correct output |
---|
1 1 2 1 3 |
user output |
---|
1 1 2 1 3 |
Test 21
Verdict: ACCEPTED
input |
---|
10 6 8 9 7 9 6 9 5 7 7 |
correct output |
---|
1 1 1 1 1 1 2 1 1 2 |
user output |
---|
1 1 1 1 1 1 2 1 1 2 |
Test 22
Verdict: ACCEPTED
input |
---|
10 10 8 10 1 2 4 10 2 3 1 |
correct output |
---|
1 1 1 1 2 2 3 2 3 5 |
user output |
---|
1 1 1 1 2 2 3 2 3 5 |
Test 23
Verdict: ACCEPTED
input |
---|
10 2 1 10 6 10 5 5 5 4 4 |
correct output |
---|
1 1 3 2 3 2 3 2 3 3 |
user output |
---|
1 1 3 2 3 2 3 2 3 3 |
Test 24
Verdict: ACCEPTED
input |
---|
10 1 8 9 3 2 6 6 9 5 9 |
correct output |
---|
1 2 2 2 2 2 4 2 3 4 |
user output |
---|
1 2 2 2 2 2 4 2 3 4 |
Test 25
Verdict: ACCEPTED
input |
---|
10 6 10 8 7 3 10 1 3 5 8 |
correct output |
---|
1 1 1 1 1 1 2 3 2 2 |
user output |
---|
1 1 1 1 1 1 2 3 2 2 |
Test 26
Verdict: ACCEPTED
input |
---|
10 1 9 9 3 4 10 10 5 1 7 |
correct output |
---|
1 2 2 2 2 2 3 2 3 4 |
user output |
---|
1 2 2 2 2 2 3 2 3 4 |
Test 27
Verdict: ACCEPTED
input |
---|
10 4 9 1 2 6 6 5 4 7 5 |
correct output |
---|
1 1 1 2 3 3 2 3 3 3 |
user output |
---|
1 1 1 2 3 3 2 3 3 3 |
Test 28
Verdict: ACCEPTED
input |
---|
10 3 8 4 5 10 8 5 10 4 6 |
correct output |
---|
1 1 1 2 1 1 3 1 2 3 |
user output |
---|
1 1 1 2 1 1 3 1 2 3 |
Test 29
Verdict: ACCEPTED
input |
---|
10 10 9 6 3 1 5 5 6 5 6 |
correct output |
---|
1 1 1 1 1 2 3 2 3 3 |
user output |
---|
1 1 1 1 1 2 3 2 3 3 |
Test 30
Verdict: ACCEPTED
input |
---|
10 4 6 5 5 1 2 4 2 1 3 |
correct output |
---|
1 1 1 1 2 2 2 5 4 5 |
user output |
---|
1 1 1 1 2 2 2 5 4 5 |
Test 31
Verdict: ACCEPTED
input |
---|
100 12 15 17 13 18 11 17 9 13 13 8... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... Truncated |
Test 32
Verdict: ACCEPTED
input |
---|
100 20 15 19 1 3 7 20 3 5 2 8 4 8 ... |
correct output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... |
user output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... Truncated |
Test 33
Verdict: ACCEPTED
input |
---|
100 4 1 19 11 19 9 10 9 7 7 4 5 14... |
correct output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... |
user output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... Truncated |
Test 34
Verdict: ACCEPTED
input |
---|
100 2 15 17 6 3 11 12 18 9 18 1 3 ... |
correct output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... |
user output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... Truncated |
Test 35
Verdict: ACCEPTED
input |
---|
100 11 98 15 14 5 98 1 6 9 16 20 1... |
correct output |
---|
1 1 1 1 1 1 1 2 2 3 2 3 2 3 3 ... |
user output |
---|
1 1 1 1 1 1 1 2 2 3 2 3 2 3 3 ... Truncated |
Test 36
Verdict: ACCEPTED
input |
---|
100 6 88 84 21 37 92 98 49 9 62 40... |
correct output |
---|
1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 ... |
user output |
---|
1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 ... Truncated |
Test 37
Verdict: ACCEPTED
input |
---|
100 7 83 5 11 12 53 9 7 63 9 15 52... |
correct output |
---|
1 1 1 1 1 1 1 3 1 1 1 1 2 1 4 ... |
user output |
---|
1 1 1 1 1 1 1 3 1 1 1 1 2 1 4 ... Truncated |
Test 38
Verdict: ACCEPTED
input |
---|
100 23 78 32 44 98 73 46 98 31 54 ... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Truncated |
Test 39
Verdict: ACCEPTED
input |
---|
100 97 87 54 5 2 9 9 53 10 12 55 1... |
correct output |
---|
1 1 1 1 1 1 2 1 3 1 2 1 2 2 3 ... |
user output |
---|
1 1 1 1 1 1 2 1 3 1 2 1 2 2 3 ... Truncated |
Test 40
Verdict: ACCEPTED
input |
---|
100 37 51 50 50 1 14 32 15 2 22 88... |
correct output |
---|
1 1 1 1 1 2 2 2 2 2 3 2 3 2 3 ... |
user output |
---|
1 1 1 1 1 2 2 2 2 2 3 2 3 2 3 ... Truncated |
Test 41
Verdict: ACCEPTED
input |
---|
200 12 15 17 13 18 11 17 9 13 13 8... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... Truncated |
Test 42
Verdict: ACCEPTED
input |
---|
200 20 15 19 1 3 7 20 3 5 2 8 4 8 ... |
correct output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... |
user output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... Truncated |
Test 43
Verdict: ACCEPTED
input |
---|
200 4 1 19 11 19 9 10 9 7 7 4 5 14... |
correct output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... |
user output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... Truncated |
Test 44
Verdict: ACCEPTED
input |
---|
200 2 15 17 6 3 11 12 18 9 18 1 3 ... |
correct output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... |
user output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... Truncated |
Test 45
Verdict: ACCEPTED
input |
---|
200 11 195 15 14 5 196 2 6 9 16 40... |
correct output |
---|
1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 ... |
user output |
---|
1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 ... Truncated |
Test 46
Verdict: ACCEPTED
input |
---|
200 12 175 167 42 73 184 196 98 18... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... Truncated |
Test 47
Verdict: ACCEPTED
input |
---|
200 7 165 9 22 12 106 9 7 125 9 15... |
correct output |
---|
1 1 1 1 1 1 1 2 1 1 1 2 1 1 3 ... |
user output |
---|
1 1 1 1 1 1 1 2 1 1 1 2 1 1 3 ... Truncated |
Test 48
Verdict: ACCEPTED
input |
---|
200 46 156 64 88 196 145 92 196 62... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Truncated |
Test 49
Verdict: ACCEPTED
input |
---|
200 194 174 107 5 3 9 9 105 10 12 ... |
correct output |
---|
1 1 1 1 1 1 1 2 2 1 2 1 1 3 2 ... |
user output |
---|
1 1 1 1 1 1 1 2 2 1 2 1 1 3 2 ... Truncated |
Test 50
Verdict: ACCEPTED
input |
---|
200 73 101 100 100 2 27 64 29 3 44... |
correct output |
---|
1 1 1 1 1 1 2 1 2 1 2 2 2 1 3 ... |
user output |
---|
1 1 1 1 1 1 2 1 2 1 2 2 2 1 3 ... Truncated |
Test 51
Verdict: ACCEPTED
input |
---|
1000 12 15 17 13 18 11 17 9 13 13 8... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... Truncated |
Test 52
Verdict: ACCEPTED
input |
---|
1000 20 15 19 1 3 7 20 3 5 2 8 4 8 ... |
correct output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... |
user output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... Truncated |
Test 53
Verdict: ACCEPTED
input |
---|
1000 4 1 19 11 19 9 10 9 7 7 4 5 14... |
correct output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... |
user output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... Truncated |
Test 54
Verdict: ACCEPTED
input |
---|
1000 2 15 17 6 3 11 12 18 9 18 1 3 ... |
correct output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... |
user output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... Truncated |
Test 55
Verdict: ACCEPTED
input |
---|
1000 11 973 15 14 5 977 7 6 9 16 19... |
correct output |
---|
1 1 1 1 1 1 1 1 1 2 1 2 1 3 2 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 2 1 2 1 3 2 ... Truncated |
Test 56
Verdict: ACCEPTED
input |
---|
1000 56 871 832 207 364 919 980 489... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Truncated |
Test 57
Verdict: ACCEPTED
input |
---|
1000 7 822 42 108 12 530 9 7 623 9 ... |
correct output |
---|
1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 ... |
user output |
---|
1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 ... Truncated |
Test 58
Verdict: ACCEPTED
input |
---|
1000 228 780 319 439 979 724 456 97... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Truncated |
Test 59
Verdict: ACCEPTED
input |
---|
1000 969 870 531 5 12 9 9 523 10 12... |
correct output |
---|
1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 ... |
user output |
---|
1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 ... Truncated |
Test 60
Verdict: ACCEPTED
input |
---|
1000 365 502 500 496 8 134 317 143 ... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... Truncated |
Test 61
Verdict: ACCEPTED
input |
---|
100000 12 15 17 13 18 11 17 9 13 13 8... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... Truncated |
Test 62
Verdict: ACCEPTED
input |
---|
100000 20 15 19 1 3 7 20 3 5 2 8 4 8 ... |
correct output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... |
user output |
---|
1 1 1 1 2 2 2 3 2 2 4 3 3 6 2 ... Truncated |
Test 63
Verdict: ACCEPTED
input |
---|
100000 4 1 19 11 19 9 10 9 7 7 4 5 14... |
correct output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... |
user output |
---|
1 1 2 2 3 2 2 2 3 2 2 2 3 2 5 ... Truncated |
Test 64
Verdict: ACCEPTED
input |
---|
100000 2 15 17 6 3 11 12 18 9 18 1 3 ... |
correct output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... |
user output |
---|
1 1 2 1 2 1 2 2 2 2 3 2 3 4 5 ... Truncated |
Test 65
Verdict: ACCEPTED
input |
---|
100000 11 97270 15 14 5 97629 624 6 9... |
correct output |
---|
1 1 1 1 1 1 1 1 1 2 1 2 1 2 2 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 2 1 2 1 2 2 ... Truncated |
Test 66
Verdict: ACCEPTED
input |
---|
100000 5519 87075 83135 20673 36375 9... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Truncated |
Test 67
Verdict: ACCEPTED
input |
---|
100000 7 82125 4170 10766 12 52983 9 ... |
correct output |
---|
1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 ... |
user output |
---|
1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 ... Truncated |
Test 68
Verdict: ACCEPTED
input |
---|
100000 22735 77994 31898 43842 97824 ... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Truncated |
Test 69
Verdict: ACCEPTED
input |
---|
100000 96856 86921 53087 5 1140 9 9 5... |
correct output |
---|
1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 ... |
user output |
---|
1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 ... Truncated |
Test 70
Verdict: ACCEPTED
input |
---|
100000 36447 50189 49914 49579 755 13... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Truncated |
Test 71
Verdict: ACCEPTED
input |
---|
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 72
Verdict: ACCEPTED
input |
---|
100000 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... |
correct output |
---|
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... |
user output |
---|
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... Truncated |