# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872032 | aeg | Crtanje (COCI20_crtanje) | C++17 | 0 ms | 500 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |