| Task: | Monikulmio |
| Sender: | aatukaj |
| Submission time: | 2025-10-27 04:13:34 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 100 |
| 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 | 10 | details |
| #8 | ACCEPTED | 0.01 s | 10 | details |
| #9 | ACCEPTED | 0.01 s | 10 | details |
| #10 | ACCEPTED | 0.04 s | 10 | details |
Code
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) begin(v), end(v)
char g[102][102];
#define Y imag()
#define X real()
using pt = complex<int>;
int cross(pt a, pt b) {
return (conj(a)*b).Y;
}
int sgn(int x) {
if (x>0) return 1;
if (x<0) return -1;
return 0;
}
void solve() {
int n, m, k;
cin >> n >> m >> k;
vector<array<int, 2>> pts(k);
for (int i=0; i<k; i++) {
int y, x;
cin >> y >> x;
pts[i] = {y, x};
}
pts.push_back(pts[0]);
memset(g, '.', sizeof g);
for (int i=0; i<k; i++) {
auto [ay, ax] = pts[i];
auto [by, bx] = pts[i+1];
if (ay>by || (ay==by && ax>bx)) {
swap(ay, by);
swap(ax, bx);
}
if (ay==by) {
for (int j=ax; j<=bx; j++) g[ay][j] = '=';
} else if (ax==bx) {
for (int j=ay; j<=by; j++) g[j][ax] = '|';
} else {
if (ax<bx) {
for (int j=ax; j<=bx; j++) g[ay+j-ax][j] = '\\';
} else {
for (int j=bx; j<=ax; j++) g[ay+ax-j][j] = '/';
}
}
}
for (int i=1; i<=n; i++) {
for (int j=1; j<=m; j++) if (g[i][j]=='.') {
pt a = {i, j};
pt b = {i+m*n, j+m*n+1};
int cnt = 0;
for (int z=0; z<k; z++) {
pt c = {pts[z][0], pts[z][1]};
pt d = {pts[z+1][0], pts[z+1][1]};
if (sgn(cross(c-a, c-b)) != sgn(cross(d-a, d-b)) && sgn(cross(a-c, a-d)) != sgn(cross(b-c, b-d))) {
cnt++;
}
}
if (cnt%2) g[i][j] = '#';
}
}
for (auto [x, y]: pts) g[x][y] = '*';
for (int i=1; i<=n; i++) {
for (int j=1; j<=m; j++) {
cout << g[i][j];
}
cout << '\n';
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int tc=1;
// cin >> tc;
while (tc--) solve();
}
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 |
|---|
| *=====*===*==*................... |
Test 10 (public)
Verdict: ACCEPTED
| input |
|---|
| 100 100 1000 10 1 4 7 1 4 1 9 ... |
| correct output |
|---|
| ...*====*........................ |
| user output |
|---|
| ...*====*........................ |
