Submission details
Task:Monikulmio
Sender:Pinval
Submission time:2025-11-02 19:41:03 +0200
Language:C++ (C++17)
Status:READY
Result:14
Feedback
groupverdictscore
#114
Test results
testverdicttimescore
#1ACCEPTED0.00 s7details
#2ACCEPTED0.00 s7details
#30.00 s0details
#40.00 s0details
#50.00 s0details
#60.00 s0details
#70.00 s0details
#80.00 s0details
#90.00 s0details
#100.00 s0details

Code

#include <iostream>
#include <vector>
#include <utility>
#include <string>
using namespace std;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<pair<int, int>> luvut;
    vector<string> tuloste(n, string(m, '.'));
    for(int i=0; i<k; i+=1){
        int x, y;
        cin >> y >> x;
        luvut.push_back({y, x}); 
    }

    for (int i=0; i<k-1; i+=1){
        pair ko = luvut[i];
        pair se = luvut[i+1];

        while(ko.first!=se.first or ko.second!=se.second){

            if (ko.first<se.first and ko.second<se.second){
                tuloste[ko.first][ko.second]='\\';
                ko.first+=1;
                ko.second+=1;
            }
            else if (ko.first>se.first and ko.second>se.second){
                tuloste[ko.first-1][ko.second]='\\';
                ko.first-=1;
                ko.second-=1;
            }
            else if (ko.first>se.first and ko.second<se.second){
                tuloste[ko.first-1][ko.second-1]='/';
                ko.first-=1;
                ko.second+=1;
            }
            else if (ko.first<se.first and ko.second>se.second){
                tuloste[ko.first-1][ko.second-1]='/';
                ko.first+=1;
                ko.second-=1;
            }
            else if (ko.first<se.first){
                tuloste[ko.first-1][ko.second-1]='|';
                ko.first+=1;
            }
            else if (ko.first>se.first){
                tuloste[ko.first+1][ko.second-1]='|';
                ko.first-=1;
            }
            else if (ko.second<se.second){
                tuloste[ko.first-1][ko.second-1]='=';
                ko.second+=1;
            }
            else if (ko.second>se.second){
                tuloste[ko.first-1][ko.second-1]='=';
                ko.second-=1;
            }
        }
    }
    pair ko = luvut[k-1];
    pair se = luvut[0];
    while(ko.first!=se.first or ko.second!=se.second){
            if (ko.first<se.first and ko.second<se.second){
                tuloste[ko.first][ko.second]='\\';
                ko.first+=1;
                ko.second+=1;
            }
            else if (ko.first>se.first and ko.second>se.second){
                tuloste[ko.first-1][ko.second]='\\';
                ko.first-=1;
                ko.second-=1;
            }
            else if (ko.first>se.first and ko.second<se.second){
                tuloste[ko.first-1][ko.second-1]='/';
                ko.first-=1;
                ko.second+=1;
            }
            else if (ko.first<se.first and ko.second>se.second){
                tuloste[ko.first-1][ko.second-1]='/';
                ko.first+=1;
                ko.second-=1;
            }
            else if (ko.first<se.first){
                tuloste[ko.first-1][ko.second-1]='|';
                ko.first+=1;
            }
            else if (ko.first>se.first){
                tuloste[ko.first-1][ko.second-1]='|';
                ko.first-=1;
            }
            else if (ko.second<se.second){
                tuloste[ko.first-1][ko.second-1]='=';
                ko.second+=1;
            }
            else if (ko.second>se.second){
                tuloste[ko.first-1][ko.second-1]='=';
                ko.second-=1;
            }

    }
    for (auto i : luvut){
        tuloste[i.first-1][i.second-1]='*';
    }
     for (auto i : tuloste){
        cout << i << endl;
    }

    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:

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

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

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

Feedback: Incorrect character on row 4, col 31: 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 4, col 27: 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 4, col 21: expected '\', got '.'

Test 6 (public)

Verdict:

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

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

user output
(empty)

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 4, col 29: 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)