Submission #471645

# Submission time Handle Problem Language Result Execution time Memory
471645 2021-09-10T06:30:14 Z abc864197532 Crtanje (COCI20_crtanje) C++17
50 / 50
2 ms 312 KB
/*
 *   ##   #####   ####      ####  #    #  ####
 *  #  #  #    # #    #    #    # #    # #    #
 * #    # #####  #         #    # #    # #    #
 * ###### #    # #         #    # # ## # #    #
 * #    # #    # #    #    #    # ##  ## #    #
 * #    # #####   ####      ####  #    #  ####
 */
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair <int, int>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define info() cout << __PRETTY_FUNCTION__ << ": " << __LINE__ << endl
void abc() {cout << endl;}
template <typename T, typename ...U> void abc(T a, U ...b) {
    cout << a << ' ', abc(b...);
}
template <typename T> void printv(T l, T r) {
    while (l != r) cout << *l << " \n"[++l == r];
}
template <typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a) {
    return o >> a.X >> a.Y;
}
template <typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a) {
    return o << '(' << a.X << ", " << a.Y << ')';
}
template <typename T> ostream& operator << (ostream& o, vector<T> a) {
    bool is = false;
    for (T i : a) {o << (is ? ' ' : '{'), is = true, o << i;}
    return o << '}';
}
template <typename T> struct vv : vector <vector <T>> {
    vv(int n, int m, T v) : vector <vector <T>> (n, vector <T>(m, v)) {}
    vv() {}
};
template <typename T> struct vvv : vector <vv <T>> {
    vvv(int n, int m, int k, T v) : vector <vv <T>> (n, vv <T>(m, k, v)) {}
    vvv() {}
};
#ifdef Doludu
#define test(args...) info(), abc("[" + string(#args) + "]", args)
#define owo freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#else
#define test(args...) void(0)
#define owo ios::sync_with_stdio(false); cin.tie(0)
#endif
const int mod = 998244353, N = 100001, logN = 20, K = 80000;

int chg[3][3] = {-1, 0, 0, -1, 0, 0, 0, 1, 1};

int main () {
    owo;
    int n;
    string s;
    cin >> n >> s;
    vector <int> b(n);
    for (int i = 0; i < n; ++i) {
        if (s[i] == '+') b[i] = 2;
        else if (s[i] == '=') b[i] = 1;
        else b[i] = 0;
    }
    vector <int> a(n, 0);
    for (int i = 1; i < n; ++i) {
        a[i] = a[i - 1] + chg[b[i - 1]][b[i]];
    }
    int mx = *max_element(all(a));
    for (int &i : a) {
        i = mx - i;
    }
    mx = *max_element(all(a));
    for (int i = 0; i <= mx; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i == a[j]) {
                if (s[j] == '+') cout << '/';
                else if (s[j] == '-') cout << '\\';
                else cout << '_';
            } else {
                cout << '.';
            }
        }
        cout << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct