Submission details
Task:Monikulmio
Sender:whoissanttu
Submission time:2025-11-05 21:33:28 +0200
Language:C++ (C++20)
Status:READY
Result:63
Feedback
groupverdictscore
#163
Test results
testverdicttimescore
#1ACCEPTED0.00 s7details
#2ACCEPTED0.00 s7details
#3ACCEPTED0.00 s7details
#4ACCEPTED0.00 s7details
#5ACCEPTED0.00 s7details
#6ACCEPTED0.00 s7details
#70.00 s0details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#10ACCEPTED0.00 s7details

Compiler report

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

Code

#include <iostream>
#include <string>

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);
    char A[n][m] = {'.'};
    int B[2][r]={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++)
        {
            if (A[i][j] != '*' && A[i][j] != '=' && A[i][j] != '|' && A[i][j] != '/' && A[i][j] != '\\' && A[i][j] != '#')
            {
                A[i][j] = '.';
            }

            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 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:

input
30 100 69
6 10
6 14
7 14
7 18
...

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

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

Feedback: Incorrect character on row 1, col 97: 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 '.'