#include <algorithm>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <cmath>
#include <set>
#include <unordered_map>
# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define sz(x) ((int)(x).size())
# define deb(x) cerr << #x << " = " << x << endl;
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
const ll maxn = 2e2 + 25;
const ll inf = 3e9 + 0;
const ll mod = 1e9 + 7;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};
const ld eps = 1e-6;
using namespace std;
ll n;
char c[303][303];
void ma1n (/* SABR */)
{
for (ll i = 0; i <= 300; ++i)
{
for (ll j = 0; j <= 300; ++j)
{
c[i][j] = '.';
}
}
ll n;
cin >> n;
ll mx_x = -inf, mn_x = inf;
ll cur_lvl = 200;
for (ll i = 0; i < n; ++i)
{
char qwe;
cin >> qwe;
if (qwe == '+')
{
mx_x = max(mx_x, cur_lvl);
mn_x = min(mn_x, cur_lvl);
c[cur_lvl][i] = '/';
cur_lvl++;
}
if (qwe == '-')
{
cur_lvl--;
mx_x = max(mx_x, cur_lvl);
mn_x = min(mn_x, cur_lvl);
c[cur_lvl][i] = '\\';
}
if (qwe == '=')
{
c[cur_lvl][i] = '_';
mx_x = max(mx_x, cur_lvl);
mn_x = min(mn_x, cur_lvl);
}
}
for (ll j = mx_x; j >= mn_x; --j)
{
for (ll i = 0; i < n; ++i)
{
cout << c[j][i];
}
cout << nl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
// freopen("file.in", "r", stdin);
// freopen("file.out", "w", stdout);
int ttt = 1;
// cin >> ttt;
for (int test = 1; test <= ttt; ++test)
{
// cout << "Case " << test << ":" << ' ';
ma1n();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
408 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |