| Task: | Ruudukko |
| Sender: | TapaniS |
| Submission time: | 2025-11-29 11:24:51 +0200 |
| Language: | Java |
| Status: | READY |
| Result: | 16 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 16 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.08 s | 1, 2, 3 | details |
| #2 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #3 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #4 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #5 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
import java.util.*;
import java.io.*;
public class ruudut {
public static void main(String[] args) throws IOException {
// Scanner input = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] parts = br.readLine().split(" ");
int n = Integer.parseInt(parts[0]); // ruudukon koko
int m = Integer.parseInt(parts[1]); // operaatioiden maara
int[] y1 = new int[m]; // alkuarvot
int[] y2 = new int[m];
int[] x1 = new int[m];
int[] x2 = new int[m];
char[][] taulu = new char[n][n];
for (int i = 0; i < n; i++) {
for (int i2 = 0; i2 < n; i2++) {
taulu[i][i2] = '.';
}
}
for (int i = 0; i < m; i++) {
String[] parts2 = br.readLine().split(" ");
y1[i] = Integer.parseInt(parts2[0]);
x1[i] = Integer.parseInt(parts2[1]);
y2[i] = Integer.parseInt(parts2[2]);
x2[i] = Integer.parseInt(parts2[3]);
}
// input.close();
StringBuilder sb = new StringBuilder();
for (int i2 = 0; i2 < m; i2++) {
for (int i = (y1[i2]-1); i < y2[i2]; i++) {
for (int j = (x1[i2]-1); j < x2[i2]; j++) {
taulu[i][j] = (taulu[i][j] == '.') ? '#' : '.';
}
}
} // i2
// tulostus
// sb.append(x[t-1]).append('\n');
// System.out.println(dy + " " + dx);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
sb.append(taulu[i][j]);
}
sb.append('\n');
}
System.out.print(sb.toString());
} // main
}Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 10 100 6 7 8 9 2 6 7 10 7 5 9 6 6 1 6 2 ... |
| correct output |
|---|
| ..##..##.. ##....##.# ..####..## ##.##..... ####....## ... |
| user output |
|---|
| ..##..##.. ##....##.# ..####..## ##.##..... ####....## ... |
Test 2
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 100000 133 109 167 178 204 337 481 477 242 476 445 485 452 198 460 321 ... |
| correct output |
|---|
| .##....####.####..##....#.##.#... |
| user output |
|---|
| (empty) |
Test 3
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 100000 33 7 485 482 50 38 456 459 34 20 479 493 13 6 479 485 ... |
| correct output |
|---|
| .....#.####.#.#...####.##....#... |
| user output |
|---|
| (empty) |
Test 4
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 100000 126 95 1489 1619 1473 29 1697 78 1290 1031 1588 1047 1209 1794 1546 1818 ... |
| correct output |
|---|
| ..........................####... |
| user output |
|---|
| (empty) |
Test 5
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 100000 55 51 1842 1905 47 60 1997 1890 117 45 1920 1840 48 175 1987 1852 ... |
| correct output |
|---|
| #.#...#...###.#...#####..####.... |
| user output |
|---|
| (empty) |
