add solution for hw3:3637 & tests in runner
Some checks failed
Fast Reverse Tests / test (push) Failing after 16s
Reverse Tests / test (push) Successful in 5s
Sum Tests / test (push) Successful in 8s

This commit is contained in:
2026-01-30 23:04:13 +05:00
parent 26ce449302
commit 8b7b78ee4d
2 changed files with 23 additions and 6 deletions

View File

@@ -30,15 +30,32 @@ public class ReverseMaxC {
lines[linesCount++] = line;
}
PrintWriter out = getPrintWriter(linesCount, lines);
out.flush();
}
private static PrintWriter getPrintWriter(int linesCount, int[][] lines) {
PrintWriter out = new PrintWriter(System.out);
for (int i = linesCount - 1; i >= 0; i--) {
for (int i = 0; i < linesCount; i++) {
int[] line = lines[i];
for (int j = line.length - 1; j >= 0; j--) {
if (j < line.length - 1) out.print(" ");
out.print(line[j]);
for (int j = 0; j < line.length; j++) {
if (j > 0) out.print(" ");
int maxRow = lines[i][j];
for (int k = i + 1; k < linesCount; k++) {
if (lines[k].length > j && lines[k][j] > maxRow) {
maxRow = lines[k][j];
}
}
out.print(maxRow);
}
out.println();
}
out.flush();
return out;
}
}