Submission #670550

# Submission time Handle Problem Language Result Execution time Memory
670550 2022-12-09T14:13:17 Z Payam Crtanje (COCI20_crtanje) C++17
40 / 50
1 ms 340 KB
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define forp(i,l,r) for (int i = (l); i < (r); i ++)
#define forp1(j,l,r) for (int j = (l); j < (r); j ++)
#define form(i,l,r) for (int i = (r); i >= (l); i --)
#define form1(j,l,r) for (int j = (r); j >= (l); j --)
#define minset(x) (*((x).begin()))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define setp cout << fixed << setprecision(15)
#define all(x) (x).begin(), (x).end()
#define IOS ios::sync_with_stdio(false)
typedef long long ll;

using namespace std;
const int MAX_N = 1e2 + 12, MOD = 1e9 + 7, inf = 1e9 + 19;
ll INF = 1e18 + 118;
short a[MAX_N], mt[MAX_N][MAX_N];

int main()
{
    IOS;
    cin.tie(0);
    int n, mx = 0, mn = 0, h = 0;
    cin >> n;
    char c;
    forp(i, 0, n) {
        cin >> c;
        if (c == '+')
            a[i] = 1;
        else if (c == '=')
            a[i] = 0;
        else
            a[i] = -1;
        h += a[i];
        mx = max(mx, h);
        mn = min(mn, h);
    }
    forp(i, 0, n) {
        forp(j, 0, n)
            mt[i][j] = -2;
    }
    h = abs(mn) - 1;
    mx += h + 1;
    mn = 0;
    forp(i, 0, n) {
        h += a[i];
        if (a[i] == 1)
            mt[mx - 1 - h][i] = a[i];
        else
            mt[mx - 2 - h][i] = a[i];
    }
    forp(i, 0, mx) {
        forp1(j, 0, n) {
            if (mt[i][j] == -2)
                cout << '.';
            else if (mt[i][j] == 1)
                cout << '/';
            else if (mt[i][j] == 0)
                cout << '_';
            else
                cout << '\\';
        }
        cout << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 340 KB Output isn't correct
5 Correct 1 ms 340 KB Output is correct