/*
* author: Araragi
*/
// 3
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
//using namespace __gnu_pbds;
//typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
char seq[1002][1002];
int main()
{
//ifstream cin("vacation.in");
//ofstream cout("vacation.out");
int n;
cin >> n;
string s;
cin >> s;
memset(seq, '.', sizeof(seq));
int row = -501, col = 501;
int now = 500;
for (int day = 0; day < n; day++)
{
char ch = s[day];
if (ch == '=')
{
row = max(row, now);
col = min(col, now);
seq[now][day] = '_';
}
else if (ch == '+')
{
seq[now][day] = '/';
row = max(row, now);
col = min(col, now);
now--;
}
else if (ch == '-')
{
now++;
seq[now][day] = '\\';
row = max(row, now);
col = min(col, now);
}
}
for (int i = col; i <= row; i++, cout << '\n')
for (int j = 0; j < n; j++)
cout << seq[i][j];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1260 KB |
Output is correct |
2 |
Correct |
1 ms |
1260 KB |
Output is correct |
3 |
Correct |
1 ms |
1260 KB |
Output is correct |
4 |
Correct |
1 ms |
1260 KB |
Output is correct |
5 |
Correct |
1 ms |
1260 KB |
Output is correct |