CSES - Datatähti 2021 alku - Results
Submission details
Task:Ratsun reitit
Sender:Zendium
Submission time:2020-10-02 14:56:26 +0300
Language:Java
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.22 s1, 2, 3details
#2ACCEPTED0.22 s1, 2, 3details
#3ACCEPTED0.23 s1, 2, 3details
#4ACCEPTED0.29 s1, 2, 3details
#5ACCEPTED0.41 s1, 2, 3details
#6ACCEPTED0.56 s1, 2, 3details
#7--1, 2, 3details
#8--2, 3details
#9--2, 3details
#10--2, 3details
#11--3details
#12--3details
#13--3details

Compiler report

Note: input/RatsuDataT.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Code

import java.util.ArrayList;
import java.util.Scanner;

public class RatsuDataT {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int rowColumn = Integer.parseInt(scanner.nextLine());
        ArrayList<ArrayList> yList = new ArrayList<ArrayList>(rowColumn);
        // List Fill
        for (int ii = 0; ii < rowColumn; ii++) {
            ArrayList<Integer> xList = new ArrayList<Integer>(rowColumn);
            for (int iii = 0; iii < rowColumn; iii++) {
                xList.add(0);
            }
            yList.add(xList);
        }
        // Integer comb
        ArrayList<Integer> thisPointsX = new ArrayList<Integer>();
        thisPointsX.add(0);
        ArrayList<Integer> thisPointsY = new ArrayList<Integer>();
        thisPointsY.add(0);
        ArrayList<Integer> nextPointsX = new ArrayList<Integer>();
        ArrayList<Integer> nextPointsY = new ArrayList<Integer>();
        ArrayList<Integer> roskisX = new ArrayList<Integer>();
        ArrayList<Integer> roskisY = new ArrayList<Integer>();
        int steps = 0;
        int testi = 0;
        boolean contin = true;
        while (contin) {
            for (int thisPointX = 0; thisPointX < thisPointsX.size(); thisPointX++) {
                int ycoord = 0;
                    for (ArrayList<Integer> y : yList) {
                        for (int x = 0; x < y.size(); x++) {
                            boolean trash = false;
                            for (int i = 0; i < roskisX.size(); i++){
                                if(roskisX.get(i) == x && roskisY.get(i) == ycoord){
                                    trash = true;
                                }
                            }
                            if ((((x == thisPointsX.get(thisPointX) + 2 || x == thisPointsX.get(thisPointX) - 2)
                                    && (ycoord == thisPointsY.get(thisPointX) + 1 || ycoord == thisPointsY.get(thisPointX) - 1))
                                    ||
                                    ((x == thisPointsX.get(thisPointX) + 1 || x == thisPointsX.get(thisPointX) - 1)
                                            && (ycoord == thisPointsY.get(thisPointX) + 2 || ycoord == thisPointsY.get(thisPointX) - 2)))
                                    && !trash
                            ) {
                                nextPointsX.add(x);
                                nextPointsY.add(ycoord);
                                y.set(x, steps + 1);
                            }
                            /*
                            if (y.indexOf(x) == thisPointsX.get(thisPointX) + 2 && yList.indexOf(y) == thisPointsY.get(thisPointX)){
                                nextPointsX.add(y.indexOf(x));
                                nextPointsY.add(yList.indexOf(y));
                                x = steps;
                                System.out.println("X: " + y.indexOf(x) + ", Y: " + yList.indexOf(y) + "paint");
                            }
                               */
                        }
                        ycoord++;
                    }

            }
            // juna
            roskisX.addAll(thisPointsX);
            roskisY.addAll(thisPointsY);
            thisPointsX.clear();
            thisPointsY.clear();
            thisPointsX.addAll(nextPointsX);
            thisPointsY.addAll(nextPointsY);
            nextPointsX.clear();
            nextPointsY.clear();
            steps++;
            //yList.get(1).set(0, 3);
            //yList.get(1).set(1, 4);
            //yList.get(0).set(1, 3);
            //yList.get(2).set(2, 4);
            //yList.get(4).set(4, 4);

            if (steps == rowColumn + 1){ contin = false; }
            /*
            int timesY = 0;
            w:
            for (ArrayList<Integer> y: yList){
                int timesX = 0;
                for (int x: y){
                    if (x == 0 && !(timesX == 0 && timesY == 0)){
                        contin = true;
                        break w;
                    } else {
                        contin = false;
                    }
                    timesX++;
                }
                timesY++;
            }
            */
        }
        String lol = "";
        for (ArrayList<Integer> y: yList){
            for (int x: y){
                    lol += (x + " ");
            }
            lol += ("\n");
        }
        System.out.print(lol);
    }
}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
4

correct output
0 3 2 5 
3 4 1 2 
2 1 4 3 
5 2 3 2 

user output
0 3 2 5 
3 4 1 2 
2 1 4 3 
5 2 3 2 

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
5

correct output
0 3 2 3 2 
3 4 1 2 3 
2 1 4 3 2 
3 2 3 2 3 
2 3 2 3 4 

user output
0 3 2 3 2 
3 4 1 2 3 
2 1 4 3 2 
3 2 3 2 3 
2 3 2 3 4 

Test 3

Group: 1, 2, 3

Verdict: ACCEPTED

input
6

correct output
0 3 2 3 2 3 
3 4 1 2 3 4 
2 1 4 3 2 3 
3 2 3 2 3 4 
2 3 2 3 4 3 
...

user output
0 3 2 3 2 3 
3 4 1 2 3 4 
2 1 4 3 2 3 
3 2 3 2 3 4 
2 3 2 3 4 3 
...

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
7

correct output
0 3 2 3 2 3 4 
3 4 1 2 3 4 3 
2 1 4 3 2 3 4 
3 2 3 2 3 4 3 
2 3 2 3 4 3 4 
...

user output
0 3 2 3 2 3 4 
3 4 1 2 3 4 3 
2 1 4 3 2 3 4 
3 2 3 2 3 4 3 
2 3 2 3 4 3 4 
...

Test 5

Group: 1, 2, 3

Verdict: ACCEPTED

input
8

correct output
0 3 2 3 2 3 4 5 
3 4 1 2 3 4 3 4 
2 1 4 3 2 3 4 5 
3 2 3 2 3 4 3 4 
2 3 2 3 4 3 4 5 
...

user output
0 3 2 3 2 3 4 5 
3 4 1 2 3 4 3 4 
2 1 4 3 2 3 4 5 
3 2 3 2 3 4 3 4 
2 3 2 3 4 3 4 5 
...

Test 6

Group: 1, 2, 3

Verdict: ACCEPTED

input
9

correct output
0 3 2 3 2 3 4 5 4 
3 4 1 2 3 4 3 4 5 
2 1 4 3 2 3 4 5 4 
3 2 3 2 3 4 3 4 5 
2 3 2 3 4 3 4 5 4 
...

user output
0 3 2 3 2 3 4 5 4 
3 4 1 2 3 4 3 4 5 
2 1 4 3 2 3 4 5 4 
3 2 3 2 3 4 3 4 5 
2 3 2 3 4 3 4 5 4 
...

Test 7

Group: 1, 2, 3

Verdict:

input
10

correct output
0 3 2 3 2 3 4 5 4 5 
3 4 1 2 3 4 3 4 5 6 
2 1 4 3 2 3 4 5 4 5 
3 2 3 2 3 4 3 4 5 6 
2 3 2 3 4 3 4 5 4 5 
...

user output
(empty)

Test 8

Group: 2, 3

Verdict:

input
25

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Test 9

Group: 2, 3

Verdict:

input
49

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Test 10

Group: 2, 3

Verdict:

input
50

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Test 11

Group: 3

Verdict:

input
75

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Test 12

Group: 3

Verdict:

input
99

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Test 13

Group: 3

Verdict:

input
100

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)