Submission details
Task:Monikulmio
Sender:insertNameHere
Submission time:2025-11-09 21:36:50 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.00 s0details
#20.00 s0details
#30.00 s0details
#40.00 s0details
#50.00 s0details
#60.00 s0details
#70.00 s0details
#80.00 s0details
#90.00 s0details
#100.00 s0details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:35:25: warning: statement has no effect [-Wunused-value]
   35 |                 prevRow == rowsAndColumns[0].first;
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp:15:9: warning: 'iterator' may be used uninitialized [-Wmaybe-uninitialized]
   15 |     int iterator,x,y = 0;
      |         ^~~~~~~~

Code

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m, k;
    cin >> n>> m >>k;
    string lines[n];
    for (int i = 0; i < n; i++)
    {
        lines[i]= string(m,'.');
    }
    
    pair<int,int> rowsAndColumns[k];

    int iterator,x,y = 0;
    while(iterator<k){
        cin >> y >> x;
        rowsAndColumns[iterator]= make_pair(y,x);
        lines[y].replace(x,1,"*");
        if(y==rowsAndColumns[iterator-1].first){
            int prevCol = rowsAndColumns[iterator-1].second;
            if(x>prevCol){
                lines[y].replace(prevCol+1, x-prevCol-1, string(x-prevCol-1, '='));
            }else{
                lines[y].replace(x+1, prevCol-1, string(prevCol-1,'='));
            }
           
        }

        if(x==rowsAndColumns[iterator-1].second || ((iterator +1 == k)&&(x== rowsAndColumns[0].second))){//if in same column (second is x)
            int prevRow = 0;
            if(x==rowsAndColumns[iterator-1].second){
                prevRow = rowsAndColumns[iterator-1].first;
            }else{
                prevRow == rowsAndColumns[0].first;
            }
            //y is current row
            bool drawingFromBottomUp = prevRow<y;
            if(drawingFromBottomUp){
                for(int i = y-1; i>prevRow; i--){
                    lines[i].replace(x,1, "|");
                }
            }else{
                for(int i = prevRow+1; i<y; i++){
                    lines[i].replace(x,1, "|");
                }
            }
        }


        iterator++;
    }



    for (int i = 0; i < n; i++)
    {
        cout << lines[i]<<"\n";
    }
    return 0;
}

Test details

Test 1 (public)

Verdict:

input
8 9 5
5 2
2 5
5 8
7 8
...

correct output
.........
....*....
.../#\...
../###\..
.*#####*.
...

user output
.........
..|......
..|..*...
..|......
..|......
...

Feedback: Incorrect character on row 2, col 3: expected '.', got '|'

Test 2 (public)

Verdict:

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

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

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

Feedback: Incorrect character on row 2, col 11: expected '.', got '|'

Test 3 (public)

Verdict:

input
20 40 29
8 7
13 2
14 2
9 7
...

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

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

Feedback: Incorrect character on row 3, col 30: expected '*', got '.'

Test 4 (public)

Verdict:

input
20 40 14
5 12
5 25
8 28
13 28
...

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

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

Feedback: Incorrect character on row 2, col 13: expected '.', got '|'

Test 5 (public)

Verdict:

input
20 40 12
3 20
7 16
7 9
11 13
...

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

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

Feedback: Incorrect character on row 3, col 20: expected '*', got '.'

Test 6 (public)

Verdict:

input
9 35 33
2 3
2 8
4 8
4 5
...

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

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

Feedback: Incorrect character on row 2, col 3: expected '*', got '.'

Test 7 (public)

Verdict:

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

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

user output
(empty)

Test 8 (public)

Verdict:

input
40 60 192
11 3
11 5
10 6
11 7
...

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

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

Feedback: Incorrect character on row 2, col 30: expected '*', got '.'

Test 9 (public)

Verdict:

input
50 100 142
1 1
1 7
1 11
1 14
...

correct output
*=====*===*==*...................

user output
(empty)

Test 10 (public)

Verdict:

input
100 100 1000
10 1
4 7
1 4
1 9
...

correct output
...*====*........................

user output
(empty)

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::replace: __pos (which is 98) > this->size() (which is 93)