Submission #677242

#TimeUsernameProblemLanguageResultExecution timeMemory
677242PRC141Crtanje (COCI20_crtanje)C++14
50 / 50
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; int main () { ios::sync_with_stdio(false); cin.tie(NULL); int n, mx = 0, mn = 0, cur = 0; string s; cin >> n >> s; for(char x: s) { if (x == '+') { cur++; } else if (x == '-'){ cur--; } else { mx = max(mx, cur+1); } mx = max(mx, cur); mn = min(mn, cur); } char a[mx-mn][n], y = '.'; cur = mx; for(int i = 0;i<n;i++) { if (s[i] == '+') { cur--; } if (s[i] == '+') { y = '/'; } else if (s[i] == '-'){ y='\\'; } else { y='_'; cur--; } for(int j = 0;j < mx-mn;j++) { if (j == cur) { a[j][i] = y; } else { a[j][i] = '.'; } } if (s[i] == '-') { cur++; } else if (s[i] == '=') { cur++; } } for(int i = 0;i < mx-mn;i++) { for(int j = 0; j< n;j++) { cout << a[i][j]; } cout << endl; } if (mx-mn == 0) { for(int i = 0;i<n;i++){ cout<<'-'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...