# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
374296 | topovik | Crtanje (COCI20_crtanje) | C++14 | 2 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.
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N = 1e6 + 100;
const ll oo = 1e9 + 7;
int main()
{
int n;
cin >> n;
string s;
cin >> s;
int mx = 0, mn = 0, lv = 0;
for (int i = 0; i < n - 1; i++)
{
if (s[i] == '-') lv--;
if (s[i] == '+') lv++;
mx = max(mx, lv);
mn = min(mn, lv);
}
mx += (-mn);
char ans[mx + 1][n];
for (int i = 0; i <= mx; i++)
for (int j = 0; j < n; j++) ans[i][j] = '.';
lv = -mn;
for (int i = 0; i < n; i++)
{
if (s[i] == '-') ans[lv][i] = '\\';
if (s[i] == '+') ans[lv][i] = '/';
if (s[i] == '=') ans[lv][i] = '_';
if (s[i] == '-') lv--;
if (s[i] == '+') lv++;
}
for (int i = mx; i >= 0; i--)
{
for (int j = 0; j < n; j++) cout << ans[i][j] << " ";
cout << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |