Submission #337377

#TimeUsernameProblemLanguageResultExecution timeMemory
337377Jarif_RahmanCrtanje (COCI20_crtanje)C++17
50 / 50
1 ms384 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; str s; cin >> n >> s; ll cur = 0, mn = 0, mx = 0; for(int i = 0; i < n; i++){ if(s[i] == '+') cur++; if(s[i] == '-') cur--; mn = min(mn, cur); mx = max(mx, cur); } vector<str> v(mx-mn+1, str(n, '.')); int c = abs(mx); for(int i = 0; i < n; i++){ if(s[i] == '+'){ v[c][i] = '/'; c--; } if(s[i] == '-'){ c++; v[c][i] = '\\'; } if(s[i] == '='){ v[c][i] = '_'; } } if(v[0] == str(n, '.')) v.erase(v.begin()); for(str ss: v) cout << ss << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...