Submission #934623

#TimeUsernameProblemLanguageResultExecution timeMemory
934623pakapuCrtanje (COCI20_crtanje)C++17
50 / 50
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int curr = 0; vector<int> a(n); for (int i = 0; i < n; i++) { if (s[i] == '-') { a[i] = curr - 1; } else { a[i] = curr; } switch (s[i]) { case '-': curr--; break; case '+': curr++; break; } } int mn = *min_element(a.begin(), a.end()); int mx = *max_element(a.begin(), a.end()); vector<vector<char>> mp(mx - mn + 1, vector<char>(n, '.')); for (int i = 0; i < n; i++) { switch (s[i]) { case '-': mp[mx - a[i]][i] = '\\'; break; case '+': mp[mx - a[i]][i] = '/'; break; case '=': mp[mx - a[i]][i] = '_'; break; default: assert(false); } } for (auto &c : mp) { for (auto &e : c) { cout << e; } cout << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...