Submission #369574

# Submission time Handle Problem Language Result Execution time Memory
369574 2021-02-21T23:37:21 Z penguinhacker Crtanje (COCI20_crtanje) C++14
40 / 50
1 ms 492 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int n, mn = 0, mx = 0, dep[101];
string s;
vector<string> ans;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> s;
	for (int i = 0; i < n; ++i) {
		dep[i + 1] = dep[i] + (s[i] != '=' ? s[i] == '+' ? -1 : 1 : 0);
		mn = min(mn, dep[i + 1]);
		mx = max(mx, dep[i + 1]);
	}
	mx -= mn, dep[0] -= mn;
	ans.assign(mx, string(n, '.'));
	for (int i = 0; i < n; ++i) {
		dep[i + 1] -= mn;
		ans[max(dep[i], dep[i + 1]) - 1][i] = s[i] == '=' ? '_' : s[i] == '+' ? '/' : '\\';
	}
	for (string s : ans) cout << s << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 368 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Runtime error 1 ms 492 KB Execution killed with signal 11
5 Correct 1 ms 364 KB Output is correct