| Task: | Monikulmio |
| Sender: | Verlet |
| Submission time: | 2025-10-27 14:38:11 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 94 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 94 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | 10 | details |
| #2 | ACCEPTED | 0.01 s | 10 | details |
| #3 | ACCEPTED | 0.01 s | 10 | details |
| #4 | ACCEPTED | 0.01 s | 10 | details |
| #5 | ACCEPTED | 0.01 s | 10 | details |
| #6 | ACCEPTED | 0.01 s | 10 | details |
| #7 | ACCEPTED | 0.01 s | 10 | details |
| #8 | ACCEPTED | 0.01 s | 10 | details |
| #9 | ACCEPTED | 0.01 s | 7 | details |
| #10 | ACCEPTED | 0.01 s | 7 | details |
Code
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define S 102
char c[S][S];
int v[S][S];
int N, M;
struct point
{
int x;
int y;
};
void debug()
{
for (int j = 1; j < N + 1; j++)
{
for (int i = 1; i < M + 1; i++)
cout << c[j][i];
cout << endl;
}
}
void draw(int x1, int y1, int x2, int y2)
{
int dx = x2 - x1;
int dy = y2 - y1;
// Pick symbol
char s = '.';
if (dx * dy < 0) s = '/';
else s = '\\';
if (dx == 0) s = '=';
if (dy == 0) s = '|';
// Scale direction
int m = max(abs(dx), abs(dy));
dx /= m;
dy /= m;
for (int i = 1; i < m; i++)
{
x1 += dx; y1 += dy; c[x1][y1] = s;
}
}
void clearVisited()
{
for (int j = 0; j < S; j++)
for (int i = 0; i < S; i++)
v[i][j] = 0;
}
void bfs(point p, char s)
{
queue<point> q; q.push(p);
while (q.size())
{
point n = q.front(); q.pop();
if (v[n.x][n.y] == 1)
continue;
if (c[n.x][n.y] == '*' || c[n.x][n.y] == '=' || c[n.x][n.y] == '|' || c[n.x][n.y] == '/' || c[n.x][n.y] == '\\')
continue;
v[n.x][n.y] = 1; c[n.x][n.y] = s;
if (n.x > 0) q.push({n.x-1,n.y});
if (n.x < S - 1) q.push({n.x+1,n.y});
if (n.y > 0) q.push({n.x,n.y-1});
if (n.y < S - 1) q.push({n.x,n.y+1});
}
}
int main()
{
int k; cin >> N >> M >> k;
for (int j = 0; j < S; j++)
for (int i = 0; i < S; i++)
c[i][j] = '.';
vector<point> p(k);
for (int i = 0; i < k; i++)
{
int x, y; cin >> x >> y; p[i] = {x, y}; c[x][y] = '*';
}
for (int i = 0; i < k - 1; i++)
{
draw(p[i].x, p[i].y, p[i+1].x, p[i+1].y);
}
draw(p[k-1].x, p[k-1].y, p[0].x, p[0].y);
clearVisited();
bfs({0,0}, 'X');
for (int j = 0; j < S; j++)
for (int i = 0; i < S; i++)
if (c[i][j] == '.')
{
bfs({i, j}, '#');
break;
}
clearVisited();
bfs({0,0}, '.');
debug();
}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 |
|---|
| ................................. |
Test 8 (public)
Verdict: ACCEPTED
| input |
|---|
| 40 60 192 11 3 11 5 10 6 11 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
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 3, col 9: 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 4, col 29: expected '.', got '#'
