Submission details
Task:Monikulmio
Sender:PMak
Submission time:2025-10-27 17:03:46 +0200
Language:C++ (C++17)
Status:READY
Result:70
Feedback
groupverdictscore
#1ACCEPTED70
Test results
testverdicttimescore
#1ACCEPTED0.01 s7details
#2ACCEPTED0.01 s7details
#3ACCEPTED0.01 s7details
#4ACCEPTED0.01 s7details
#5ACCEPTED0.01 s7details
#6ACCEPTED0.01 s7details
#7ACCEPTED0.01 s7details
#8ACCEPTED0.01 s7details
#9ACCEPTED0.01 s7details
#10ACCEPTED0.01 s7details

Compiler report

input/code.cpp:22:19: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   22 | void print(vector<auto> v) {
      |                   ^~~~

Code

#include <bits/stdc++.h>

#define F0R(n) for (int i=0; i<n; i++)
#define FOR(from, to) for (int i = from; i < to; i++)
#define R0F(n) for (int i = n; i>=0; --i)
#define ROF(from, to) for (int i = from; i >= to; --i)

#define ll long long
#define mod (int) (1e9 + 7)
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define pii pair<int, int>
#define pci pair<char, int>
#define pll pair<ll, ll>
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;

void print(vector<auto> v) {
	for (auto it = v.begin(); it != v.end(); ++it)
		cout << *it;
	cout << "\n";
}

vector<vi> adj(int(1e5+1), vi());
vi vis(int(1e5+1));

void soln() {
    int n, m, k;
    cin >> n >> m >> k;
    vector <vector<char>> grid (n, vector<char>(m, '.'));

    int first = 0;
    pii prev = {0, 0};
    pii initial = {0, 0};
    int a, b;
    int down, left;

    F0R (k) {
        cin >> a >> b;
        --a; --b;
        grid[a][b] = '*';
        if (first == 0) {
            initial = {a, b};
            prev = {a, b};
            first = 1;
            continue;
        }

        if (a > prev.first) down = 1;
        else if (a < prev.first) down = -1;
        else down = 0;

        if (b > prev.second) left = 1;
        else if (b < prev.second) left = -1;
        else left = 0;

        // a = vertical, first index, b = horizontal, second index

        if (down == 0 && left == 0) {

        }
        else if (down == 0 && left != 0) {
            for (int j = min(b, prev.second)+1; j<max(b, prev.second); ++j)
                grid[a][j] = '=';
        }
        else if (down != 0 && left == 0) {
            for (int j = min(a, prev.first)+1; j<max(a, prev.first); ++j)
                grid[j][b] = '|';
        }
        else if (down == left) {
            int y = min(a, prev.first)+1, x = min(b, prev.second)+1;
            for ( ; y < max(a, prev.first) && x < max(b, prev.second); ++y, ++x) {
                grid[y][x] = '\\';
            }
        }
        else if (down == -1 && left == 1) {
            int y, x;
            for (y=a+1, x=b-1; y<prev.first && x>prev.second; ++y, --x) {
                grid[y][x] = '/';
            }
        }
        else if (down==1 && left==-1) {
            int y, x;
            for (y=a-1, x=b+1; y>prev.first && x<prev.second; --y, ++x) {
                grid[y][x] = '/';
            }
        }/*
        else if (down == -1 && left == 1) {
            int y = a+1, x = prev.second+1;
            for ( ; y < prev.first && x < b; ++y, ++x) {
                grid[y][x] = '/';
            }
        }*/
        prev = {a, b};
    }

    a = initial.first; b = initial.second;
    if (a > prev.first) down = 1;
        else if (a < prev.first) down = -1;
        else down = 0;

        if (b > prev.second) left = 1;
        else if (b < prev.second) left = -1;
        else left = 0;

        // a = vertical, first index, b = horizontal, second index

        if (down == 0 && left == 0) {

        }
        else if (down == 0 && left != 0) {
            for (int j = min(b, prev.second)+1; j<max(b, prev.second); ++j)
                grid[a][j] = '=';
        }
        else if (down != 0 && left == 0) {
            for (int j = min(a, prev.first)+1; j<max(a, prev.first); ++j)
                grid[j][b] = '|';
        }
        else if (down == left) {
            int y = min(a, prev.first)+1, x = min(b, prev.second)+1;
            for ( ; y < max(a, prev.first) && x < max(b, prev.second); ++y, ++x) {
                grid[y][x] = '\\';
            }
        }
        else if (down == -1 && left == 1) {
            int y, x;
            for (y=a+1, x=b-1; y<prev.first && x>prev.second; ++y, --x) {
                grid[y][x] = '/';
            }
        }
        else if (down==1 && left==-1) {
            int y, x;
            for (y=a-1, x=b+1; y>prev.first && x<prev.second; --y, ++x) {
                grid[y][x] = '/';
            }
        }
    for (auto v : grid)
        print(v);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int tc=1;
    //cin >> tc;
    while (tc--) soln();
    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
.........
....*....
.../.\...
../...\..
.*.....*.
...

Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 5: expected '#', got '.'

Test 2 (public)

Verdict: ACCEPTED

input
20 40 4
5 10
5 30
15 30
15 10

correct output
.................................

user output
.................................

Feedback: Lines are drawn correctly. Incorrect fill character on row 6, col 11: expected '#', got '.'

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 4, col 30: 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 4, col 10: 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 4, col 20: 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 3, col 3: 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 10: 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 2, col 11: 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 6: expected '#', got '.'