# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934623 | pakapu | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 348 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 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 |
---|---|---|---|---|
Fetching results... |