Submission details
Task:Monikulmio
Sender:whoissanttu
Submission time:2025-11-06 16:59:25 +0200
Language:C++ (C++20)
Status:READY
Result:73
Feedback
groupverdictscore
#1ACCEPTED73
Test results
testverdicttimescore
#1ACCEPTED0.00 s7details
#2ACCEPTED0.00 s10details
#3ACCEPTED0.00 s7details
#4ACCEPTED0.00 s7details
#5ACCEPTED0.00 s7details
#6ACCEPTED0.00 s7details
#7ACCEPTED0.00 s7details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#10ACCEPTED0.01 s7details

Compiler report

input/code.cpp: In function 'int strToNumP1(std::string)':
input/code.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int i = 0; i < size(a); i++)
      |                     ~~^~~~~~~~~
input/code.cpp: In function 'int strToNumP2(std::string)':
input/code.cpp:48:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for (int i = 0; i < size(a); i++)
      |                     ~~^~~~~~~~~
input/code.cpp: In function 'int strToNumP3(std::string)':
input/code.cpp:84:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   84 |     for (int i = 0; i < size(a); i++)
      |                     ~~^~~~~~~~...

Code

#include <iostream>
#include <string>
#include <vector>

int strToNumP1(std::string a)
{

    int s = 1;
    std::string f = "u";
    std::string d = "o";
    // std::string para;
    // std::getline(std::cin, para);

    for (int i = 0; i < size(a); i++)
    {
        if (isspace(a[i]))
        {

            if (s == 1)
            {
                a[i] = 'u';
                s++;
            }
            else
                a[i] = 'o';
        }
        continue;
    }
    int w = a.find(f);
    int e = a.find(d);

    std::string p1 = a.substr(0, w);
    std::string p2 = a.substr(w + 1, e - w - 1);
    std::string p3 = a.substr(e + 1, size(a) - 1);
    int P1 = std::stoll(p1);

    return P1;
}
int strToNumP2(std::string a)
{

    int s = 1;
    std::string f = "u";
    std::string d = "o";
    // std::string para;
    // std::getline(std::cin, para);

    for (int i = 0; i < size(a); i++)
    {
        if (isspace(a[i]))
        {

            if (s == 1)
            {
                a[i] = 'u';
                s++;
            }
            else
                a[i] = 'o';
        }
        continue;
    }
    int w = a.find(f);
    int e = a.find(d);

    std::string p1 = a.substr(0, w);
    std::string p2 = a.substr(w + 1, e - w - 1);
    std::string p3 = a.substr(e + 1, size(a) - 1);

    int P2 = std::stoll(p2);

    return P2;
}

int strToNumP3(std::string a)
{

    int s = 1;
    std::string f = "u";
    std::string d = "o";
    // std::string para;
    // std::getline(std::cin, para);

    for (int i = 0; i < size(a); i++)
    {
        if (isspace(a[i]))
        {

            if (s == 1)
            {
                a[i] = 'u';
                s++;
            }
            else
                a[i] = 'o';
        }
        continue;
    }
    int w = a.find(f);
    int e = a.find(d);

    std::string p1 = a.substr(0, w);
    std::string p2 = a.substr(w + 1, e - w - 1);
    std::string p3 = a.substr(e + 1, size(a) - 1);

    int P3 = std::stoll(p3);
    return P3;
}

int cornerCoord1(std::string a)
{

    std::string f = "u";

    // std::string para;
    // std::getline(std::cin, para);

    for (int i = 0; i < size(a); i++)
    {
        if (isspace(a[i]))
        {

            a[i] = 'u';
        }
        continue;
    }
    int w = a.find(f);

    std::string p1 = a.substr(0, w);
    std::string p2 = a.substr(w + 1, size(a) - 1);

    int P1 = std::stoll(p1);
    int P2 = std::stoll(p2);

    return P1;
}

int cornerCoord2(std::string a)
{

    std::string f = "u";

    // std::string para;
    // std::getline(std::cin, para);

    for (int i = 0; i < size(a); i++)
    {
        if (isspace(a[i]))
        {

            a[i] = 'u';
        }
        continue;
    }
    int w = a.find(f);

    std::string p1 = a.substr(0, w);
    std::string p2 = a.substr(w + 1, size(a) - 1);

    int P1 = std::stoll(p1);
    int P2 = std::stoll(p2);

    return P2;
}

int main()
{
    std::string para;
    std::getline(std::cin, para);

    int n = strToNumP1(para);
    int m = strToNumP2(para);
    int r = strToNumP3(para);
    int c = 0;
    std::vector<std::vector<char>> A(n, std::vector<char>(m, '.'));
    std::vector<std::vector<int>> B(2, std::vector<int>(r, 0));
    std::vector<std::vector<int>> C(n, std::vector<int>(m, 0));

    for (int i = 0; i < r; i++)
    {
        std::string crn;
        std::getline(std::cin, crn);
        int p = cornerCoord1(crn);
        int q = cornerCoord2(crn);
        A[p - 1][q - 1] = '*';
        B[0][i] = p;
        B[1][i] = q;
    }

    for (int R = 0; R < r; R++)
    {

        if (R + 1 < r && B[0][R] > B[0][R + 1] && B[1][R] > B[1][R + 1]) // B[0][j] korkeus ja B[1][j] on leveys
        {
            for (int u = 1; u < B[0][R] - B[0][R + 1] && u < B[1][R] - B[1][R + 1]; u++)
            {
                A[B[0][R] - u - 1][B[1][R] - u - 1] = '\\';
            }
        }
        else if (R + 1 < r && B[0][R] < B[0][R + 1] && B[1][R] > B[1][R + 1])
        {
            for (int u = 1; u < B[0][R + 1] - B[0][R] && u < B[1][R] - B[1][R + 1]; u++)
            {
                A[B[0][R] + u - 1][B[1][R] - u - 1] = '/';
            }
        }
        else if (R + 1 < r && B[0][R] < B[0][R + 1] && B[1][R] < B[1][R + 1])
        {
            for (int u = 1; u < B[0][R + 1] - B[0][R] && u < B[1][R + 1] - B[1][R]; u++)
            {
                A[B[0][R] + u - 1][B[1][R] + u - 1] = '\\';
            }
        }
        else if (R + 1 < r && B[0][R] > B[0][R + 1] && B[1][R] < B[1][R + 1])
        {
            for (int u = 1; u < B[0][R] - B[0][R + 1] && u < B[1][R + 1] - B[1][R]; u++)
            {
                A[B[0][R] - u - 1][B[1][R] + u - 1] = '/';
            }
        }
        else if (R + 1 < r && B[0][R] == B[0][R + 1] && B[1][R] < B[1][R + 1])
        {
            for (int u = 1; u < B[1][R + 1] - B[1][R]; u++)
            {
                A[B[0][R] - 1][B[1][R] + u - 1] = '=';
            }
        }
        else if (R + 1 < r && B[0][R] == B[0][R + 1] && B[1][R] > B[1][R + 1])
        {
            for (int u = 1; u < B[1][R] - B[1][R + 1]; u++)
            {
                A[B[0][R] - 1][B[1][R] - u - 1] = '=';
            }
        }
        else if (R + 1 < r && B[0][R] > B[0][R + 1] && B[1][R] == B[1][R + 1])
        {

            for (int u = 1; u < B[0][R] - B[0][R + 1]; u++)
            {
                A[B[0][R] - u - 1][B[1][R] - 1] = '|';
            }
        }
        else if (R + 1 < r && B[0][R] < B[0][R + 1] && B[1][R] == B[1][R + 1])
        {

            for (int u = 1; u < B[0][R + 1] - B[0][R]; u++)
            {
                A[B[0][R] + u - 1][B[1][R] - 1] = '|';
            }
        }

        else if (B[0][R] > B[0][0] && B[1][R] > B[1][0] && R + 1 >= r) // B[0][j] korkeus ja B[1][j] on leveys
        {
            for (int u = 1; u < B[0][R] - B[0][0] && u < B[1][R] - B[1][0]; u++)
            {
                A[B[0][R] - u - 1][B[1][R] - u - 1] = '\\';
            }
        }
        else if (B[0][R] < B[0][0] && B[1][R] > B[1][0] && R + 1 >= r)
        {
            for (int u = 1; u < B[0][0] - B[0][R] && u < B[1][R] - B[1][R + 1]; u++)
            {
                A[B[0][R] + u - 1][B[1][R] - u - 1] = '/';
            }
        }
        else if (B[0][R] < B[0][0] && B[1][R] < B[1][0] && R + 1 >= r)
        {
            for (int u = 1; u < B[0][0] - B[0][R] && u < B[1][0] - B[1][R]; u++)
            {
                A[B[0][R] + u - 1][B[1][R] + u - 1] = '\\';
            }
        }
        else if (B[0][R] > B[0][0] && B[1][R] < B[1][0] && R + 1 >= r)
        {
            for (int u = 1; u < B[0][R] - B[0][0] && u < B[1][0] - B[1][R]; u++)
            {
                A[B[0][R] - u - 1][B[1][R] + u - 1] = '/';
            }
        }
        else if (B[0][R] == B[0][0] && B[1][R] < B[1][0] && R + 1 >= r)
        {
            for (int u = 1; u < B[1][0] - B[1][R]; u++)
            {
                A[B[0][R] - 1][B[1][R] + u - 1] = '=';
            }
        }
        else if (B[0][R] == B[0][0] && B[1][R] > B[1][0] && R + 1 >= r)
        {
            for (int u = 1; u < B[1][R] - B[1][0]; u++)
            {
                A[B[0][R] - 1][B[1][R] - u - 1] = '=';
            }
        }
        else if (B[0][R] > B[0][0] && B[1][R] == B[1][0] && R + 1 >= r)
        {

            for (int u = 1; u < B[0][R] - B[0][0]; u++)
            {
                A[B[0][R] - u - 1][B[1][R] - 1] = '|';
            }
        }
        else if (B[0][R] < B[0][0] && B[1][R] == B[1][0] && R + 1 >= r)
        {

            for (int u = 1; u < B[0][0] - B[0][R]; u++)
            {
                A[B[0][R] + u - 1][B[1][R] - 1] = '|';
            }
        }
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            int p = 0;
            int v = 0;
            int a = 0;

            if ((j + 1) == m && A[i][j - 1] != '.')
            {
                c = 0;
            }
            if (A[i][j] == '.' && c % 2 == 1 && j != m - 1)
            {
                A[i][j] = '#';
            }

            if (A[i][j] == '*' || A[i][j] == '|' || A[i][j] == '/' || A[i][j] == '\\' && j != m - 1)
            {
                if (A[i][j] == '*')
                {
                    for (int l = j + 1; l < m; l++)
                    {
                        if (A[i][l] != '.' && A[i][l] != '=' && A[i][l] != '*')
                        {
                            v++;
                            p=1;
                        }
                        else if (A[i][l] == '*')
                        {
                            a++;
                        }
                    }
                    for (int l = j + 1; l < m; l++)
                    {
                        if (A[i][l] == '*' && v % 2 == 0 && a != 0)
                        {
                            p = 0;
                        }
                    }
                    if (v%2 ==1 && A[i][j + 1] != '.' )
                    {
                        v++;
                    }
                    
                    if ((p % 2) == 0 && p > 0 && v % 2 == 1 )
                    {
                        c++;
                    }
                }
                else if (A[i][j] == '|' || A[i][j] == '/' || A[i][j] == '\\')
                {
                    c++;
                }
            }

            std::cout << A[i][j];
        }
        std::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
.........
....*....
.../#\...
../###\..
.*.....*.
...

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

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 8, col 29: 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 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 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 2, col 15: 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 9: expected '.', got '#'