| Task: | Monikulmio |
| Sender: | Tmotomaster |
| Submission time: | 2025-10-27 19:07:13 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 79 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 79 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | 10 | details |
| #2 | ACCEPTED | 0.00 s | 10 | details |
| #3 | ACCEPTED | 0.00 s | 7 | details |
| #4 | ACCEPTED | 0.00 s | 7 | details |
| #5 | ACCEPTED | 0.00 s | 10 | details |
| #6 | ACCEPTED | 0.00 s | 7 | details |
| #7 | ACCEPTED | 0.00 s | 7 | details |
| #8 | ACCEPTED | 0.00 s | 7 | details |
| #9 | ACCEPTED | 0.00 s | 7 | details |
| #10 | ACCEPTED | 0.01 s | 7 | details |
Code
#include <iostream>
using namespace std;
char art[100][100] = {0};
void connect(int aY, int aX, int bY, int bX) {
if (aY == bY) {
int left = min(aX, bX);
for (int i = 1; i < abs(aX - bX); i++) {
art[bY][left + i] = '=';
}
} else if (aX == bX) {
int top = min(aY, bY);
for (int i = 1; i < abs(aY - bY); i++) {
art[top + i][bX] = '|';
}
} else {
int left;
int vert1;
int vert2;
if (aX < bX) {
left = aX;
vert1 = aY;
vert2 = bY;
} else {
left = bX;
vert1 = bY;
vert2 = aY;
}
if (vert1 > vert2) {
for (int i = 1; i < abs(aX - bX); i++) {
art[vert1 - i][left + i] = '/';
}
} else {
for (int i = 1; i < abs(aX - bX); i++) {
art[vert1 + i][left + i] = '\\';
}
}
}
}
int main() {
int n, m, k;
cin >> n >> m >> k;
int previous[2] = {-1, -1};
int first[2] = {-1, -1};
for (int _ = 0; _ < k; _++) {
int y, x;
cin >> y >> x;
--y;
--x;
art[y][x] = '*';
if (first[0] == -1) {
first[0] = y;
first[1] = x;
}
if (previous[0] != -1) {
connect(previous[0], previous[1], y, x);
}
previous[0] = y;
previous[1] = x;
}
connect(previous[0], previous[1], first[0], first[1]);
for (int i = 0; i < n; i++) {
bool inside = false;
bool maybe = false;
int maybeIdx;
for (int j = 0; j < m; j++) {
if (art[i][j] == '=') {
maybe = false;
} else if (art[i][j] == '|' || art[i][j] == '/' || art[i][j] == '\\') {
inside = !inside;
if (maybe) {
maybe = false;
for (int k = maybeIdx + 1; k < j; k++) {
art[i][k] = '#';
}
}
} else if (art[i][j] == '*') {
if (maybe) {
maybe = false;
for (int k = maybeIdx + 1; k < j; k++) {
art[i][k] = '#';
}
} else {
maybe = true;
maybeIdx = j;
}
} else {
art[i][j] = inside ? '#' : '.';
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << art[i][j];
}
cout << '\n';
}
return 0;
}Test details
Test 1 (public)
Verdict: ACCEPTED
| input |
|---|
| 8 9 5 5 2 2 5 5 8 7 8 ... |
| correct output |
|---|
| ......... ....*.... .../#\... ../###\.. .*#####*. ... |
| user output |
|---|
| ......... ....*.... .../#\... ../###\.. .*#####*. ... |
Test 2 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 4 5 10 5 30 15 30 15 10 |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Test 3 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 29 8 7 13 2 14 2 9 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 31: expected '.', got '#'
Test 4 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 14 5 12 5 25 8 28 13 28 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 16, col 29: expected '.', got '#'
Test 5 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 12 3 20 7 16 7 9 11 13 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Test 6 (public)
Verdict: ACCEPTED
| input |
|---|
| 9 35 33 2 3 2 8 4 8 4 5 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 2, col 9: expected '.', got '#'
Test 7 (public)
Verdict: ACCEPTED
| input |
|---|
| 30 100 69 6 10 6 14 7 14 7 18 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 7, col 19: expected '.', got '#'
Test 8 (public)
Verdict: ACCEPTED
| input |
|---|
| 40 60 192 11 3 11 5 10 6 11 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 25: expected '.', got '#'
Test 9 (public)
Verdict: ACCEPTED
| input |
|---|
| 50 100 142 1 1 1 7 1 11 1 14 ... |
| correct output |
|---|
| *=====*===*==*................... |
| user output |
|---|
| *=====*===*==*................... |
Feedback: Lines are drawn correctly. Incorrect fill character on row 2, col 15: expected '.', got '#'
Test 10 (public)
Verdict: ACCEPTED
| input |
|---|
| 100 100 1000 10 1 4 7 1 4 1 9 ... |
| correct output |
|---|
| ...*====*........................ |
| user output |
|---|
| ...*====*#####################... |
Feedback: Lines are drawn correctly. Incorrect fill character on row 1, col 10: expected '.', got '#'
