# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
854430 | vjudge1 | 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.
//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define ONLINE_JUDGE
void solve() {
int n;
cin >> n;
string s;
cin >> s;
int val = 0, mx = 0, mn = 0;
for(char &ch : s) {
if(ch == '+') {
val++;
} else if(ch == '-') {
val--;
}
mx = max(mx, val);
mn = min(mn, val);
}
vector <vector <char>> tablo(mx - mn +1, vector <char> (n, '.'));
val = 0;
for(int i = 0; i < n; i++) {
cerr << i << " " << val << "\n";
char ch = s[i];
if(ch == '+') {
assert(val - mn >= 0);
tablo[val - mn][i] = '/';
val++;
} else if(ch == '-') {
assert(val - mn >= 0);
val--;
tablo[val - mn][i] = '\\';
} else {
assert(val - mn >= 0);
tablo[val - mn][i] = '_';
}
}
for(int i = mx - mn -1; i >= 0; i--) {
for(int j = 0; j < n; j++) {
cout << tablo[i][j];
}
cout << "\n";
}
return;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1; //cin >> t;
for(int i = 1; i <= t; i++) {
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |