Submission details
Task:Maalaus
Sender:DataN29
Submission time:2025-11-04 10:16:43 +0200
Language:Java
Status:COMPILE ERROR

Compiler report

input/Maalin.java:3: error: class, interface, or enum expected
void main() {
^
input/Maalin.java:7: error: class, interface, or enum expected
        final String[] inp = scan.nextLine().split(" ");
              ^
input/Maalin.java:8: error: class, interface, or enum expected
        final long[] bleblob = {Long.parseLong(inp[0]), Long.parseLong(inp[1])};
              ^
input/Maalin.java:9: error: class, interface, or enum expected
        final int coms = Integer.parseInt(inp[3]);
              ^
input/Maalin.java:10: error: class, interface, or enum expected
        String[][] add = new String[coms][3];
        ^
input/Maalin.java:11: error: class, interface, or enum expected
        long[] coamuns = new long[Integer.parseInt(inp[2])];
        ^
input/Maalin.java:12: error: class, interface, or enum expected
        int[] temp = new int[2];
        ^
input/Maalin.java:13: error: class, interface, or enum expected
        HashSet<String> rowadds = new HashSet<>();
        ^
input/Ma...

Code

//import java.util.concurrent.TimeUnit;
//import java.util.Arrays;
void main() {
    //final long startTime;
    try (
            Scanner scan = new Scanner(System.in)) {
        final String[] inp = scan.nextLine().split(" ");
        final long[] bleblob = {Long.parseLong(inp[0]), Long.parseLong(inp[1])};
        final int coms = Integer.parseInt(inp[3]);
        String[][] add = new String[coms][3];
        long[] coamuns = new long[Integer.parseInt(inp[2])];
        int[] temp = new int[2];
        HashSet<String> rowadds = new HashSet<>();
        HashSet<String> coladds = new HashSet<>();
        for (int i = 0; i < coms; i++) {
            add[i] = scan.nextLine().split(" ");
        }
        //startTime = System.nanoTime();
        for (int i = coms - 1; i >= 0; i--) {
            if (add[i][0].equals("R") && !rowadds.contains(add[i][1])) {
                coamuns[Integer.parseInt(add[i][2]) - 1] += bleblob[1] - temp[1];
                rowadds.add(add[i][1]);
                temp[0] += 1;
            } else if (add[i][0].equals("C") && !coladds.contains(add[i][1])) {
                coamuns[Integer.parseInt(add[i][2]) - 1] += bleblob[0] - temp[0];
                coladds.add(add[i][1]);
                temp[1] += 1;
            }
        }
        for (int i = 0; i < Integer.parseInt(inp[2]); i++) {
            IO.println(coamuns[i]);
        }
        //Arrays.stream(coamuns).forEachOrdered(System.out::println);
        //final long duration = System.nanoTime() - startTime;
        //System.out.println(TimeUnit.NANOSECONDS.toMillis(duration));
    } catch (NumberFormatException e) {
        IO.println(e.getMessage());
    }
}