Submission details
Task:Train schedule
Sender:aalto26ew_009
Submission time:2026-09-30 17:37:54 +0300
Language:Java
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.09 sdetails
#2ACCEPTED0.09 sdetails
#3ACCEPTED0.09 sdetails
#4ACCEPTED0.09 sdetails
#5ACCEPTED0.09 sdetails
#6ACCEPTED0.09 sdetails
#7ACCEPTED0.09 sdetails
#8ACCEPTED0.09 sdetails
#9ACCEPTED0.09 sdetails
#10ACCEPTED0.09 sdetails
#11ACCEPTED0.09 sdetails
#12ACCEPTED0.09 sdetails
#130.09 sdetails
#14ACCEPTED0.09 sdetails
#15ACCEPTED0.09 sdetails
#16ACCEPTED0.09 sdetails
#170.09 sdetails
#180.09 sdetails
#19ACCEPTED0.09 sdetails
#20ACCEPTED0.09 sdetails
#21ACCEPTED0.09 sdetails
#22ACCEPTED0.09 sdetails
#23ACCEPTED0.09 sdetails
#24ACCEPTED0.09 sdetails
#25ACCEPTED0.09 sdetails
#260.09 sdetails
#27ACCEPTED0.09 sdetails
#28ACCEPTED0.09 sdetails
#29ACCEPTED0.09 sdetails
#300.09 sdetails
#310.09 sdetails
#320.09 sdetails
#330.09 sdetails
#340.09 sdetails
#350.09 sdetails
#360.09 sdetails
#370.09 sdetails
#38ACCEPTED0.09 sdetails
#390.09 sdetails
#400.09 sdetails
#410.09 sdetails
#420.10 sdetails
#430.09 sdetails
#440.10 sdetails
#450.09 sdetails
#460.09 sdetails
#470.09 sdetails
#48ACCEPTED0.10 sdetails
#490.09 sdetails
#500.10 sdetails
#510.11 sdetails
#520.11 sdetails
#530.11 sdetails
#540.11 sdetails
#550.11 sdetails
#560.11 sdetails
#570.11 sdetails
#580.11 sdetails
#590.11 sdetails
#600.11 sdetails
#61--details
#62--details
#63--details
#64--details
#65--details
#661.67 sdetails
#67--details
#681.71 sdetails
#69--details
#701.70 sdetails
#711.53 sdetails
#72--details

Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class trains {
    public static void main(String[] args) {
        FastScanner input = new FastScanner(System.in);
        int n = input.nextInt();

        int[] inputs = new int[n];
        for (int i = 0; i < n; i++){
            inputs[i] = input.nextInt();
        }
        int[] schedule = new int[n];
        Arrays.fill(schedule, 1);

        int j;
        int step;
        int increase;
        for (int i = 0; i < n; i++){
            increase = 1;
            step = inputs[i];
            j = i+step;
            if (step > 0){
                while(j < n){
                    schedule[j] += 1;
                    if(inputs[j] == step){
                        increase += 1;
                        inputs[j] = 0;
                    }
                    j += step;
                }
            }
        }
        String output = "";

        for(int i = 0; i < n; i++) {
            output = (output + schedule[i] + " ");
        }
        System.out.println(output);
    }

    static class FastScanner { //static class fastScanner
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
    	 return Double.parseDouble(next());
	 }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}
}

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:

input
5
1 1 5 3 5 

correct output
1 2 3 3 3 

user output
1 2 2 2 2 

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:

input
5
2 5 1 1 3 

correct output
1 1 2 2 4 

user output
1 1 2 2 3 

Test 18

Verdict:

input
5
2 4 2 3 5 

correct output
1 1 2 1 3 

user output
1 1 2 1 2 

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:

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 3 

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:

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 3 

Test 31

Verdict:

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 ...

Test 32

Verdict:

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 3 3 3 5 2 ...

Test 33

Verdict:

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 ...

Test 34

Verdict:

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 3 4 ...

Test 35

Verdict:

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 ...

Test 36

Verdict:

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 ...

Test 37

Verdict:

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 3 ...

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 ...

Test 39

Verdict:

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 ...

Test 40

Verdict:

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 ...

Test 41

Verdict:

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 ...

Test 42

Verdict:

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 3 3 3 5 2 ...

Test 43

Verdict:

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 ...

Test 44

Verdict:

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 3 4 ...

Test 45

Verdict:

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 ...

Test 46

Verdict:

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 ...

Test 47

Verdict:

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 2 ...

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 ...

Test 49

Verdict:

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 ...

Test 50

Verdict:

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 ...

Test 51

Verdict:

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 ...

Test 52

Verdict:

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 3 3 3 5 2 ...

Test 53

Verdict:

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 ...

Test 54

Verdict:

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 3 4 ...

Test 55

Verdict:

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 ...

Test 56

Verdict:

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 ...

Test 57

Verdict:

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 2 ...

Test 58

Verdict:

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 ...

Test 59

Verdict:

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 ...

Test 60

Verdict:

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 ...

Test 61

Verdict:

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
(empty)

Test 62

Verdict:

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
(empty)

Test 63

Verdict:

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
(empty)

Test 64

Verdict:

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
(empty)

Test 65

Verdict:

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
(empty)

Test 66

Verdict:

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 ...

Test 67

Verdict:

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
(empty)

Test 68

Verdict:

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 ...

Test 69

Verdict:

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
(empty)

Test 70

Verdict:

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 ...

Test 71

Verdict:

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 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

Test 72

Verdict:

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
(empty)