Source Code
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second

const long double PI = atan(1) * 4.0;

int n, p;
void rec(int dashes, int level){
    for(int i = 0; i < dashes; i++){
        cout << "-";
    }
    if(dashes == p){
        cout << level;
        if(level == n){
            return;
        }
    }
    cout << endl;
}

int main(){
    FAST
    int n, p; cin >> n >> p;
    for(int i = 0; i < n + 1; i++){
        for(int j = 0; j < p; j++){
            cout << "-";
        }
        cout << i << endl;
        if(i == n){
            break;
        }
        cout << "-\n--\n-\n";
        for(int j = 3; j <= p - 2; j++){
            for(int k = 0; k < j; k++){
                cout << "-";
            }
            cout << endl;
            cout << "-\n--\n-\n";
        }
        for(int j = 0; j < p - 1; j++){
            cout << "-";
        }
        cout << endl;
        cout << "-\n--\n-\n";
        for(int j = p - 2; j >= 3; j--){
            for(int k = 0; k < j; k++){
                cout << "-";
            }
            cout << endl;
            cout << "-\n--\n-\n";
        }
    }
    return 0;
}
Copy
Ruler Basilhijaz
GNU G++17
3 ms
752 KB
Wrong Answer