| Task: | Monikulmio |
| Sender: | Tmotomaster |
| Submission time: | 2025-10-31 19:50:10 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 91 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 91 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | 10 | details |
| #2 | ACCEPTED | 0.00 s | 10 | details |
| #3 | ACCEPTED | 0.00 s | 10 | details |
| #4 | ACCEPTED | 0.00 s | 10 | details |
| #5 | ACCEPTED | 0.00 s | 10 | details |
| #6 | ACCEPTED | 0.00 s | 10 | details |
| #7 | ACCEPTED | 0.00 s | 7 | details |
| #8 | ACCEPTED | 0.00 s | 7 | details |
| #9 | ACCEPTED | 0.00 s | 10 | 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;
for (int j = 0; j < m; j++) {
if (art[i][j] == '*') {
break;
} else if (art[i][j] == '|' || art[i][j] == '/' || art[i][j] == '\\') {
inside = !inside;
} else if (art[i][j] != '=') {
art[i][j] = inside ? '#' : '.';
}
}
}
for (int j = 0; j < m; j++) {
bool inside = false;
for (int i = 0; i < n; i++) {
if (art[i][j] == '*') {
break;
} else if (art[i][j] == '=' || art[i][j] == '/' || art[i][j] == '\\') {
inside = !inside;
} else if (art[i][j] != '|') {
art[i][j] = inside ? '#' : '.';
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (art[i][j] == 0) {
art[i][j] = '.';
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (art[i][j] == '|' || art[i][j] == '/' || art[i][j] == '=' || art[i][j] == '\\' || art[i][j] == '*' || art[i][j] == '#') continue; // I hate this line so much, but oh well :D
if (art[i-1][j] == '#' || art[i+1][j] == '#' || art[i][j-1] == '#' || art[i][j+1] == '#') {
art[i][j] = '#';
}
}
}
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 |
|---|
| ................................. |
Test 4 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 14 5 12 5 25 8 28 13 28 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
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 |
|---|
| ................................. |
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 10, col 67: 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 3, col 30: expected '#', got '.'
Test 9 (public)
Verdict: ACCEPTED
| input |
|---|
| 50 100 142 1 1 1 7 1 11 1 14 ... |
| correct output |
|---|
| *=====*===*==*................... |
| user output |
|---|
| *=====*===*==*................... |
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 4, col 49: expected '#', got '.'
