Submission #677238

# Submission time Handle Problem Language Result Execution time Memory
677238 2023-01-02T15:59:34 Z Alma Crtanje (COCI20_crtanje) C++17
50 / 50
1 ms 468 KB
#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 time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct