Submission #872032

#TimeUsernameProblemLanguageResultExecution timeMemory
872032aegCrtanje (COCI20_crtanje)C++17
50 / 50
0 ms500 KiB
#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 timeMemoryGrader output
Fetching results...