Submission #872032

# Submission time Handle Problem Language Result Execution time Memory
872032 2023-11-12T07:03:50 Z aeg Crtanje (COCI20_crtanje) C++17
50 / 50
0 ms 500 KB
#include<bits/stdc++.h>
using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int mini = 0, maxi=-1, cur = 0;
    for(int i=0; i<n; i++){
        if(s[i] == '-') cur--;
        mini = min(cur,mini);
        maxi = max(cur,maxi);
        if(s[i] == '+') cur++;
    }
    vector<string> ans(maxi-mini+1, string(n, '.'));
    cur = 0;
    for(int i=0; i<n; i++) {
        if(s[i] == '-') cur--;
        char c = '_';
        if(s[i] == '+') c = '/';
        else if(s[i] == '-') c = '\\';
        // cout << c << endl;
        // cout << cur - mini << endl;
        // cout << ans.size() << endl;
        // cout << maxi - mini + 1 << endl;
        // cout << maxi << ' ' << mini << endl;
        ans[cur - mini][i] = c;
        if(s[i] == '+') cur++;
    }
    for(int i=ans.size()-1; i>=0; i--) cout<<ans[i]<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 500 KB Output is correct
5 Correct 0 ms 348 KB Output is correct