Submission #1177062

#TimeUsernameProblemLanguageResultExecution timeMemory
1177062theagentbaraCrtanje (COCI20_crtanje)C++20
0 / 50
14 ms1352 KiB
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define endl '\n'
#define all(v) v.begin(), v.end()

const long long sz = 2e5 + 5;
const long long inf = 1e18;
const long long mod = 1e9 + 9;

bool isbound(int i, int j, int m, int n) {
    return i >= 0 and j >= 0 and i < m and j < n;
}

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int m = 0;
    int cur = 1;
    for (int i = 0; i < s.size() - 1; i++) {
        if (s[i] == '+' or s[i] == '-') {
            if (s[i] == s[i + 1]) {
                cur++;
            } else {
                m = max(m, cur);
                cur = 1;
            }
        }
    }
    m = max(m, cur);
    for (int k = 0; k < m; k++) {
        char a[m][n];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                a[i][j] = '.';
            }
        }
        a[k][0] = s[0];
        int l = 1;
        bool ok = 1;
        int i = k, j = 0;
        while (l < s.size() and isbound(i, j, m, n)) {
            cout << l << " " << i << " " << j << endl; 
            if (s[l - 1] == '+') {
                if (isbound(i - 1, j + 1, m, n)) {
                    i--;
                    j++;
                    a[i][j] = '/';
                } else {
                    ok = 0;
                    break;
                }
            } else if (s[l - 1] == '-') {
                if (isbound(i + 1, j + 1, m, n)) {
                    i++;
                    j++;
                    a[i][j] = '\\';
                } else {
                    ok = 0;
                    break;
                }
            } else if (s[l - 1] == '=') {
                if (isbound(i, j + 1, m, n)) {
                    j++;
                    a[i][j] = '-';
                } else {
                    ok = 0;
                    break;
                }
            }
            l++;
        }
        cout << ok << " " << k << endl;
            for (int i = 0; i < m; i++) {
                for (int j = 0; j < n; j++) {
                    cout << a[i][j];
              }
                cout << endl;
            }
            
    }
    
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(0);
    int T = 1;
    // cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...