# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
328120 | hhhhaura | Crtanje (COCI20_crtanje) | C++14 | 1 ms | 384 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>
//#pragma loop-opt(on)
//#pragma GCC optmize("Ofast")
#define print(x) cout << #x <<" = " << x << endl
#define pprint(x) cout << #x <<" = (" << x.first << " , " << x.second <<" )\n"
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define ceil(a, b) ((a + b - 1) / b)
#define all(x) x.begin(), x.end()
#define MAXN 1000005
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)
#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
string s;
vector<int> a, b;
int mx, mn, n;
vector<vector<char>> mp;
void solve() {
mx = -INF, mn = INF;
rep(i, 1, n) {
if(s[i-1] == '+') a[i] = a[i-1] + 1, b[i] = a[i-1];
else if(s[i-1] == '-') a[i] = a[i-1] - 1, b[i] = a[i];
else a[i] = a[i-1], b[i] = a[i-1];
mx = max(b[i], mx), mn = min(b[i], mn);
}
rep(i, 1, n) b[i] = mx - b[i] + 1;
// pprint(pii(mx,mn));
// rep(i, 1, n) print(b[i]);
rep(i, 1, mx - mn + 1) {
rep(j, 1, n) {
if(s[j-1] == '+' && b[j] == i) cout << "/";
else if(s[j-1] == '-' && b[j] == i) cout << "\\";
else if(s[j-1] == '=' && b[j] == i) cout << "_";
else cout << '.';
}
cout << "\n";
}
return;
}
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n >> s;
a.resize(n + 1), b.resize(n + 1);
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |