Submission #1177051

#TimeUsernameProblemLanguageResultExecution timeMemory
1177051fritlCrtanje (COCI20_crtanje)C++20
40 / 50
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long void _() { ll n; cin >> n; string s; cin >> s; ll mn = 0, mx = 0, h = 0; for (char c : s) { h += (c == '+'); h -= (c == '-'); mn = min(mn, h); mx = max(mx, h); } ll row = mx - mn; vector<vector<char>> ans(row, vector<char>(n, '.')); ll i = mx - 1; h = 0; for (ll j = 0; j < n; j++) { if (s[j] == '+') {ans[i][j] = '/'; h++; i--;} else if (s[j] == '-') { h--; i++; ans[i][j] = '\\'; } else ans[i][j] = '_'; } for (ll i = 0; i < row; i++) { for (ll j = 0; j < n; j++) cout << ans[i][j]; cout << endl; } } int main() { ll t = 1; //cin >> t; while(t--) _(); }
#Verdict Execution timeMemoryGrader output
Fetching results...