Submission details
Task:Monikulmio
Sender:Pinval
Submission time:2025-11-08 12:53:13 +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.00 s7details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#10ACCEPTED0.00 s7details

Code

// Toinen osatehtävä puuttuu
// Ratkaisuna voisi olla for-loop, joka käy jokaisen rivin läpi ja pitää laskuria eteentulleista merkeistä
// Sisämerkki tulisi, jos käsiteltävä merkki on . ja laskurin luku on pariton

#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-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 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-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 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(int i=0; i<n; i++){
        int laskuri=0;
        for(int e=0; e<m; e++){
            if(tuloste[i][e]=='=' or tuloste[i][e]=='|' or tuloste[i][e]=='*' or tuloste[i][e]=='/' or tuloste[i][e]=='\\'){
                laskuri+=1;
            }
            else if (tuloste[i][e]=='.' and laskuri%2==0){
                continue;
            }
            else if (tuloste[i][e]=='.' and laskuri%2==1){
                tuloste[i][e]='#';
            }

        }
    }
        

    }
    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 2, col 6: 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 5, col 31: 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 3, col 31: 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 6, col 13: 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 3, col 21: 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 2, col 25: 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 6, col 15: 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 2, col 31: 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 39: expected '.', got '#'