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

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:62:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for (int i = 0; i < pisteet.size(); i++)
      |                     ~~^~~~~~~~~~~~~~~~
input/code.cpp:65:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |         if(i == pisteet.size()-1){ continue;}
      |            ~~^~~~~~~~~~~~~~~~~~~

Code

#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <optional>

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned int uint;

using namespace std;


bool OnkoMuuKuinPiste(map<pair<int,int>,char> piirros,pair<int,int> kohta){
    if(piirros[kohta] == 47 
            || piirros[kohta] == 92 
            || piirros[kohta] == 124 
            || piirros[kohta] == 61 
            || piirros[kohta] == 42){
                return true;
            }
    return false;
            
}

int main(){

    int n = 0;
    int m = 0;
    int k = 0;

    cin >> n;
    cin >> m;
    cin >> k;

    vector<pair<int,int>> pisteet;

    map<pair<int,int>,char> piirros;

    for (int i = 0; i < k; i++)
    {
        int x,y = 0;
        cin >> y >> x;
        pisteet.push_back(make_pair(x,y));
    }

    pisteet.push_back(pisteet[0]); // Tämä, jotta viimeisen pisteen saa kivasti yhistettyä ensimmäiseen

    for (int y = 1; y <= n + 1; y++)
    {
        for (int x = 1; x <= m + 1; x++)
        {
            piirros[make_pair(x,y)] = 46; // .

        }

    }
    
    for (int i = 0; i < pisteet.size(); i++)
    {
        piirros[pisteet[i]] = 42; //*
        if(i == pisteet.size()-1){ continue;}

        //= eli jos y ovat samat 
        if(pisteet[i].second == pisteet[i+1].second){
            int ero = 1;
            if(signbit(pisteet[i].first - pisteet[i+1].first)){
                ero = -1;
            }
            auto mato = pisteet[i+1];
            for (int j = 0; j < m; j++)
            {
                mato.first += ero;
                if(mato==pisteet[i]) break;
                piirros[mato] = 61; //=
            }
        }

        //| eli jos x ovat samat

                //= eli jos y ovat samat 
        else if(pisteet[i].first == pisteet[i+1].first){
            int ero = 1;
            if(signbit(pisteet[i].second - pisteet[i+1].second)){
                ero = -1;
            }
            auto mato = pisteet[i+1];
            for (int j = 0; j < m; j++)
            {
                mato.second += ero;
                if(mato==pisteet[i]) break;
                piirros[mato] = 124; //|
            }
        }
        else{
            int yEro = 1;
            if(signbit(pisteet[i].second - pisteet[i+1].second)){
                yEro = -1;
            }
            int xEro = 1;
            if(signbit(pisteet[i].first - pisteet[i+1].first)){
                xEro = -1;
            }

            auto mato = pisteet[i+1];
            for (int j = 0; j < m; j++)
            {
                mato.second += yEro;
                mato.first += xEro;
                if(mato==pisteet[i]) break;
                if(signbit(yEro * xEro)){
                    piirros[mato] = 47; // "/"
                }
                else{
                    piirros[mato] = 92; // "\"
                }

            }


        }
        
    }
    /*
    auto varitysTolppa = make_pair(0,0);

    //47 /, 92 \, 124 |, 61 =, 42 *, 46 .
    
    //Täyttö
    for (int y = 0; y < n + 1; y++)
    {
        for (int x = 0; x < m + 1; x++)
        {
            if(OnkoMuuKuinPiste(piirros, make_pair(x,y)))
            {
                if(varitysTolppa == make_pair(0,0) && !OnkoMuuKuinPiste(piirros, make_pair(x+1,y))){
                    varitysTolppa = make_pair(x,y);
                }
                else{
                    auto pensseli = varitysTolppa;
                    for (int i = 1; i < x-varitysTolppa.first; i++)
                    {
                        pensseli.first += 1;
                        piirros[pensseli] = 35; //#
                    }
                    
                }

            }
        }
        varitysTolppa = make_pair(0,0);
    }
    */
    

  //  piirros[make_pair(1,1)] = 43;



  for (int y = 1; y < n + 1; y++)
    {
        for (int x = 1; x < m + 1; x++)
        {
            cout << piirros[make_pair(x,y)];
        }
        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: 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 '.'