Submission #513020

# Submission time Handle Problem Language Result Execution time Memory
513020 2022-01-17T01:04:03 Z KoD Crtanje (COCI20_crtanje) C++17
50 / 50
1 ms 332 KB
#include <bits/stdc++.h>

using std::vector;
using std::array;
using std::pair;
using std::tuple;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N;
    std::cin >> N;
    vector<char> S(N);
    for (auto& x : S) {
        std::cin >> x;
    }
    int min = 1000, max = -1000, cur = 0;
    for (const char c : S) {
        if (c == '-') {
            cur -= 1;
        }
        max = std::max(max, cur);
        min = std::min(min, cur);
        if (c == '+') {
            cur += 1;
        }
    }
    vector ans(max - min + 1, vector<char>(N, '.'));
    cur = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == '+') {
            ans[cur - min][i] = '/';
            cur += 1;
        } else if (S[i] == '-') {
            cur -= 1;
            ans[cur - min][i] = '\\';
        } else {
            ans[cur - min][i] = '_';
        }
    }
    std::reverse(ans.begin(), ans.end());
    for (const auto& v : ans) {
        for (int i = 0; i < N; ++i) {
            std::cout << v[i];
        }
        std::cout << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct