Submission details
Task:Monikulmio
Sender:manttila
Submission time:2025-11-03 01:57:40 +0200
Language:C++ (C++11)
Status:READY
Result:28
Feedback
groupverdictscore
#128
Test results
testverdicttimescore
#1ACCEPTED0.00 s7details
#2ACCEPTED0.00 s7details
#30.00 s0details
#4ACCEPTED0.00 s7details
#5ACCEPTED0.00 s7details
#60.00 s0details
#70.00 s0details
#80.00 s0details
#90.00 s0details
#100.00 s0details

Code

#include<bits/stdc++.h>
using namespace std;
 
#define debug(x) cout << #x << " = " << x << "\n";
 
typedef long long ll;
#define fi first
#define se second

typedef vector<ll> vi;
typedef pair<ll,ll> pi;
 
const ll M = 1000000007;

int n,m;
vector<pi> node(1001); 
char g[101][101];
void add(int x1, int y1, int x2, int y2){
    if(x1 == x2){ // same x -> |
        int dv = abs(y1-y2)/(y1-y2);
        while(y2 != y1){
            y2+=dv;
            g[y2][x1] = '|';
            if(y2+dv == y1) break;
        } 
    }
    
    else if(y1 == y2){ // same y -> =
        int dv = abs(x1-x2)/(x1-x2);
        while(x2 != x1){
            x2+=dv;
            g[y1][x2] = '=';
            if(x2+dv == x1) break;
        } 
    }

    else if((x2 > x1 && y2 < y1) || (x2 < x1 && y2 > y1)){ // -> /
        int dv = abs(x1-x2)/(x1-x2);
        while(x2 != x1){
            x2+=dv; y2-=dv;
            g[y2][x2] = '/';
            if(x2+dv == x1) break;
        }
    }

    else{
        int dvx = abs(x1-x2)/(x1-x2);
        int dvy = abs(y1-y2)/(y1-y2);
        while(x2 != x1){
            x2+=dvx; y2+=dvy;
            g[y2][x2] = '\\';
            if(x2+dvx == x1) break;
        }
    }
}


void solve(){
    int k; cin >> n >> m >> k;
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++) g[i][j] = '.';
    }

    for(int i=0,a,b; i<k; i++){
        cin >> a >> b; a--; b--;
        node[i] = {a,b};
        g[a][b] = '*';
    }

    for(int i=1; i<k; i++){
        add(node[i].se, node[i].fi, node[i-1].se, node[i-1].fi);
    }
    add(node[k-1].se, node[k-1].fi, node[0].se, node[0].fi);

    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++) cout << g[i][j];
        cout << "\n";
    }


}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
 
    solve();
    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 14, col 2: 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:

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

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

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

Feedback: Incorrect character on row 2, col 12: 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 7, col 14: expected '*', got '|'

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
*=====*===*==*...................

Feedback: Incorrect character on row 2, col 14: expected '*', got '|'

Test 10 (public)

Verdict:

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

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

user output
...*====*........................

Feedback: Incorrect character on row 2, col 8: expected '*', got '/'