Submission #854430

#TimeUsernameProblemLanguageResultExecution timeMemory
854430vjudge1Crtanje (COCI20_crtanje)C++17
40 / 50
1 ms348 KiB
//author: Ahmet Alp Orakci #include <bits/stdc++.h> using namespace std; using i64 = long long; #define ONLINE_JUDGE void solve() { int n; cin >> n; string s; cin >> s; int val = 0, mx = 0, mn = 0; for(char &ch : s) { if(ch == '+') { val++; } else if(ch == '-') { val--; } mx = max(mx, val); mn = min(mn, val); } vector <vector <char>> tablo(mx - mn +1, vector <char> (n, '.')); val = 0; for(int i = 0; i < n; i++) { cerr << i << " " << val << "\n"; char ch = s[i]; if(ch == '+') { assert(val - mn >= 0); tablo[val - mn][i] = '/'; val++; } else if(ch == '-') { assert(val - mn >= 0); val--; tablo[val - mn][i] = '\\'; } else { assert(val - mn >= 0); tablo[val - mn][i] = '_'; } } for(int i = mx - mn -1; i >= 0; i--) { for(int j = 0; j < n; j++) { cout << tablo[i][j]; } cout << "\n"; } return; } signed main() { #ifndef ONLINE_JUDGE freopen(".in", "r", stdin); freopen(".out", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; //cin >> t; for(int i = 1; i <= t; i++) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...