답안 #328120

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
328120 2020-11-15T12:14:54 Z hhhhaura Crtanje (COCI20_crtanje) C++14
50 / 50
1 ms 384 KB
#include <bits/stdc++.h>
//#pragma loop-opt(on)
//#pragma GCC optmize("Ofast")

#define print(x) cout << #x <<" = " << x << endl
#define pprint(x) cout << #x <<" = (" << x.first << " , " << x.second <<" )\n"
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define ceil(a, b) ((a + b - 1) / b)
#define all(x) x.begin(), x.end()

#define MAXN 1000005
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)

#define int long long int 
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())

using namespace std;
string s;
vector<int> a, b;
int mx, mn, n;
vector<vector<char>> mp;
void solve() {
	mx = -INF, mn = INF;
	rep(i, 1, n) {
		if(s[i-1] == '+') a[i] = a[i-1] + 1, b[i] = a[i-1];
		else if(s[i-1] == '-') a[i] = a[i-1] - 1, b[i] = a[i];
		else a[i] = a[i-1], b[i] = a[i-1];
		mx = max(b[i], mx), mn = min(b[i], mn);
	}
	rep(i, 1, n) b[i] = mx - b[i] + 1;
//	pprint(pii(mx,mn));
//	rep(i, 1, n) print(b[i]);
	rep(i, 1, mx - mn + 1) {
		rep(j, 1, n) {
			if(s[j-1] == '+' && b[j] == i) cout << "/";
			else if(s[j-1] == '-' && b[j] == i) cout << "\\";
			else if(s[j-1] == '=' && b[j] == i) cout << "_";
			else cout << '.';
		}
		cout << "\n";
	}
	return;
}
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> s;
	a.resize(n + 1), b.resize(n + 1);
	solve();
	return 0;
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct