| Task: | Monikulmio |
| Sender: | Verlet |
| Submission time: | 2025-10-27 17:13:37 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 76 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 76 |
| 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 | 7 | 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>
#include<vector>
#include<queue>
using namespace std;
#define S 102
char c[S][S];
char e[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;
}
// for (int j = 1; j < N + 1; j++)
// {
// for (int i = 1; i < M + 1; i++)
// cout << e[j][i];
// cout << endl;
// }
}
point direction(point p1, point p2)
{
int dx = p2.x - p1.x;
int dy = p2.y - p1.y;
int m = max(abs(dx), abs(dy));
return {dx / m, dy / m};
}
void draw(point p1, point p2)
{
point d = direction(p1, p2);
char s = '.';
if (d.x * d.y < 0) s = '/';
else s = '\\';
if (d.x == 0) s = '=';
if (d.y == 0) s = '|';
p1.x += d.x; p1.y += d.y;
while (c[p1.x][p1.y] != '*')
{
c[p1.x][p1.y] = s; p1.x += d.x; p1.y += d.y;
}
}
void setEdgeType(point p1, point p2, point p3)
{
point d1 = direction(p1, p2);
point d2 = direction(p2, p3);
//cout << d1.x << " " << d1.y << " " << d2.x << " " << d2.y << endl;
int v = 1; // Default
if (d1.x == 0 && d2.x == 0) v = 0; // Horizontal
if (d1.x * d2.x == -1) v = 2; // Spike
e[p2.x][p2.y] = v;
}
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] = '*';
}
setEdgeType(p[k-1], p[0], p[1]);
for (int i = 1; i < k - 1; i++)
setEdgeType(p[i-1], p[i], p[i+1]);
setEdgeType(p[k-2], p[k-1], p[0]);
for (int i = 0; i < k - 1; i++)
{
draw(p[i], p[i+1]);
}
draw(p[k-1], p[0]);
for (int j = 0; j < S; j++)
{
int k = 0;
for (int i = 0; i < S; i++)
{
if (c[j][i] != '.' && c[j][i] != '=')
k += c[j][i] == '*' ? e[j][i] : 1;
if (k % 2 == 1) e[j][i] = '#';
}
}
for (int j = 0; j < S; j++)
for (int i = 0; i < S; i++)
if (c[j][i] == '.' && e[j][i] == '#') c[j][i] = '#';
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 |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 8, col 26: 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 26: expected '#', got '.'
Test 5 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 12 3 20 7 16 7 9 11 13 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 7, col 17: expected '#', got '.'
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 4, 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 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 |
|---|
| *=====*===*==*................... |
Feedback: Lines are drawn correctly. Incorrect fill character on row 5, col 83: 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 2, col 92: expected '.', got '#'
