Submission #496439

#TimeUsernameProblemLanguageResultExecution timeMemory
496439PLMLCrtanje (COCI20_crtanje)C++14
50 / 50
1 ms332 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n,cur,mx,mn;cin >> n; string s;cin >> s; cur = mx = mn = 0; for(int i = 0;i<n;i++){ if(s[i] == '+') cur++; else if(s[i] == '-') cur--; else mx = max(mx,cur + 1); mx = max(mx,cur); mn = min(mn,cur); } char a[mx - mn][n]; cur = mx; char c = '.'; for(int i = 0;i<n;i++){ if(s[i] == '+') cur--; if(s[i] == '+') c = '/'; else if(s[i] == '-') c = '\\'; else{c = '_';cur--;}; for(int j = 0;j<mx - mn;j++){ if(j == cur) a[j][i] = c; else a[j][i] = '.'; } if(s[i] == '-' or 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 << '-'; //} }
#Verdict Execution timeMemoryGrader output
Fetching results...