Submission #332549

#TimeUsernameProblemLanguageResultExecution timeMemory
332549moratoCrtanje (COCI20_crtanje)C++17
50 / 50
1 ms364 KiB
/** * author: morato * created: 02.12.2020 16:45:53 **/ #include <bits/stdc++.h> using namespace std; char m[205][205]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; string s; cin >> s; int cur = 100, prev = 100; int menor = 201, maior = 0; for (int i = 0; i <= 200; i++) { for (int j = 0; j <= 200; j++) { m[i][j] = '.'; } } char prevc = '.'; for (int i = 0; i < n; i++) { if ((s[i] == '=' && prevc == '-') || (s[i] == '-' && prevc == '+') || (s[i] == '+' && prevc == '-')) cur = prev; if (s[i] == '-' && prevc == '=') cur++; menor = min(menor, cur); maior = max(maior, cur); m[cur][i] = (s[i] == '+' ? '/' : s[i] == '-' ? '\\' : '_'); prev = cur; prevc = s[i]; if (s[i] == '-') cur++; if (s[i] == '+') cur--; } for (int i = menor; i <= maior; i++) { for (int j = 0; j < n; j++) { cout << m[i][j]; } cout << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...