제출 #677238

#제출 시각아이디문제언어결과실행 시간메모리
677238AlmaCrtanje (COCI20_crtanje)C++17
50 / 50
1 ms468 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    string s;
    cin >> n >> s;
    vector<vector<char>> m(n, vector<char>(200, '.'));

    int h = 100;
    for (int i = 0; i < n; i++) {
        if (s[i] == '+') {
            m[i][h] = '/';
            h++;
        }
        else if (s[i] == '-') {
            h--;
            m[i][h] = '\\';
        }
        else if (s[i] == '=') {
            m[i][h] = '_';
        }
    }

    int lo = -1, hi = -1;
    for (int j = 0; j < 200; j++) {
        for (int i = 0; i < n; i++) {
            if (m[i][j] != '.') {
                if (lo == -1) lo = j;
                hi = j;
            }
        }
    }

    for (int j = hi; j >= lo; j--) {
        for (int i = 0; i < n; i++) {
            cout << m[i][j];
        }
        cout << '\n';
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...