Submission

Status:
[PPPPPPP][PPPPPPPPPPP][PPPPPPPPPPPPPPPPPPPPP]

Score: 100

User: Monasm

Problemset: ป้ายไฟ

Language: cpp

Time: 0.092 second

Submitted On: 2024-10-03 18:40:39

#include <bits/stdc++.h>

using namespace std;

int main(){
    int n;cin >> n;
    int x = (n-1)*2-1,y = (n*4)+3;
    vector<vector<char>> adj(x,vector<char>(y,' '));
    for(int i=0;i<x;i++){
        for(int j=0;j<4;j++){
            adj[i][y-1] = '#';adj[i][0+(j*(n+1))] = '#';adj[i][n-1] = '#';
        }
    }
    for(int i=0;i<n;i++){
        adj[x-1][0+i] = '#';adj[x-1][n+1+i] = '#';adj[0][n+1+i] = '#';adj[ceil(x/2)][n+1+i] = '#';adj[ceil(x/2)][3*(n+1)+i] = '#';adj[0][3*(n+1)+i] = '#';
    }
    int px1 = 0,py1 =n*3+1,px2 = x-1,py2 = n*3+1;
    while(!(px1==px2 && py1 == py2)){
        adj[px1++][py1--] = '#';adj[px2--][py2--] = '#';
    }
    adj[px1][py1] = '#';
    for(int i=0;i<x;i++){
        for(int j=0;j<y;j++){
            cout<<adj[i][j];
        }
        cout<<endl;
    }
    return 0;
}