Submission #374403

# Submission time Handle Problem Language Result Execution time Memory
374403 2021-03-07T09:12:52 Z Vimmer Crtanje (COCI20_crtanje) C++14
50 / 50
1 ms 364 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")

#define N 200001
#define NN 1005000
#define PB push_back
#define M ll(1e9 + 7)
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define pri(x) cout << x << endl
#define endl '\n'
#define _ << " " <<
#define F first
#define S second

using namespace std;
//using namespace __gnu_pbds;

//typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> oredered_set;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef short int si;


int main()
{
    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("1.in", "r", stdin);

    int n;

    cin >> n;

    string s;

    cin >> s;

    char a[300][n];

    for (int i = 0; i < n; i++)
        for (int j = 0; j < 300; j++)
            a[j][i] = '.';

    int y = 110;

    char c = char('a' - 5);

    for (int i = 0; i < n; i++)
    {
        if (s[i] == '-')
        {
            if (i != 0 && s[i - 1] != s[i])
                y++;

            a[y][i] = c;

            y++;
        }

        if (s[i] == '+')
        {
            if (i != 0 && s[i - 1] != '=' && s[i - 1] != s[i])
                y--;

            a[y][i] = '/';

            y--;
        }

        if (s[i] == '=')
        {
            if (i != 0 && s[i - 1] == '-')
                y--;

            a[y][i] = '_';
        }
    }

    int L = 0, R = 299;

    while (1)
    {
        bool gd = 1;

        for (int i = 0; i < n; i++)
            if (a[L][i] != '.')
                gd = 0;

        if (gd)
        {
            L++;

            continue;
        }

        break;
    }

    while (1)
    {
        bool gd = 1;

        for (int i = 0; i < n; i++)
            if (a[R][i] != '.')
                gd = 0;

        if (gd)
        {
            R--;

            continue;
        }

        break;
    }

    for (int i = L; i <= R; i++)
    {
        for (int j = 0; j < n; j++)
            cout << a[i][j];

        cout << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct