Submission #701118

# Submission time Handle Problem Language Result Execution time Memory
701118 2023-02-20T06:44:03 Z Chal1shkan Crtanje (COCI20_crtanje) C++14
40 / 50
1 ms 356 KB
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <cmath>
#include <set>
#include <unordered_map>


# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define sz(x) ((int)(x).size())
# define deb(x) cerr << #x  << " = " << x << endl; 

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;

const ll maxn = 2e2 + 25;
const ll inf = 3e9 + 0;
const ll mod = 1e9 + 7;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};
const ld eps = 1e-6;

using namespace std;

ll n;
char c[203][203];

void ma1n (/* SABR */) 
{
    for (ll i = 0; i <= 200; ++i)
    {
        for (ll j = 0; j <= 200; ++j)
        {
            c[i][j] = '.';
        }
    }
    ll n;
    cin >> n;
    ll mx_x = -inf, mn_x = inf;
    ll cur_lvl = 100;
    for (ll i = 0; i < n; ++i)
    {
        char qwe;
        cin >> qwe;
        if (qwe == '+')
        {
            mx_x = max(mx_x, cur_lvl);
            mn_x = min(mn_x, cur_lvl);
            c[cur_lvl][i] = '/';
            cur_lvl++;
        }
        if (qwe == '-')
        {
            cur_lvl--;
            mx_x = max(mx_x, cur_lvl);
            mn_x = min(mn_x, cur_lvl);
            c[cur_lvl][i] = '\\';
        }
        if (qwe == '=')
        {
            c[cur_lvl][i] = '_';
        }
    }
    for (ll j = mx_x; j >= mn_x; --j)
    {
        for (ll i = 0; i < n; ++i)
        {
            cout << c[j][i];
        }
        cout << nl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//  freopen("file.in", "r", stdin);
//  freopen("file.out", "w", stdout);
    int ttt = 1;
//  cin >> ttt;
    for (int test = 1; test <= ttt; ++test)
    {
//      cout << "Case " << test << ":" << ' ';
        ma1n();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 0 ms 356 KB Output isn't correct
5 Correct 1 ms 340 KB Output is correct