# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
513020 | KoD | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::pair;
using std::tuple;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
std::cin >> N;
vector<char> S(N);
for (auto& x : S) {
std::cin >> x;
}
int min = 1000, max = -1000, cur = 0;
for (const char c : S) {
if (c == '-') {
cur -= 1;
}
max = std::max(max, cur);
min = std::min(min, cur);
if (c == '+') {
cur += 1;
}
}
vector ans(max - min + 1, vector<char>(N, '.'));
cur = 0;
for (int i = 0; i < N; ++i) {
if (S[i] == '+') {
ans[cur - min][i] = '/';
cur += 1;
} else if (S[i] == '-') {
cur -= 1;
ans[cur - min][i] = '\\';
} else {
ans[cur - min][i] = '_';
}
}
std::reverse(ans.begin(), ans.end());
for (const auto& v : ans) {
for (int i = 0; i < N; ++i) {
std::cout << v[i];
}
std::cout << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |