Submission #934623

# Submission time Handle Problem Language Result Execution time Memory
934623 2024-02-27T17:32:57 Z pakapu Crtanje (COCI20_crtanje) C++17
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin >> n;

	string s;
	cin >> s;

	int curr = 0;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		if (s[i] == '-') {
			a[i] = curr - 1;
		}
		else {
			a[i] = curr;
		}
		switch (s[i]) {
		case '-':
			curr--;
			break;
		case '+':
			curr++;
			break;
		}
	}

	int mn = *min_element(a.begin(), a.end());
	int mx = *max_element(a.begin(), a.end());

	vector<vector<char>> mp(mx - mn + 1, vector<char>(n, '.'));

	for (int i = 0; i < n; i++) {
		switch (s[i]) {
		case '-':
			mp[mx - a[i]][i] = '\\';
			break;
		case '+':
			mp[mx - a[i]][i] = '/';
			break;
		case '=':
			mp[mx - a[i]][i] = '_';
			break;
		default:
			assert(false);
		}
	}

	for (auto &c : mp) {
		for (auto &e : c) {
			cout << e;
		}
		cout << '\n';
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct