# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
332549 | morato | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* 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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |