# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337377 | Jarif_Rahman | Crtanje (COCI20_crtanje) | C++17 | 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; str s;
cin >> n >> s;
ll cur = 0, mn = 0, mx = 0;
for(int i = 0; i < n; i++){
if(s[i] == '+') cur++;
if(s[i] == '-') cur--;
mn = min(mn, cur);
mx = max(mx, cur);
}
vector<str> v(mx-mn+1, str(n, '.'));
int c = abs(mx);
for(int i = 0; i < n; i++){
if(s[i] == '+'){
v[c][i] = '/';
c--;
}
if(s[i] == '-'){
c++;
v[c][i] = '\\';
}
if(s[i] == '='){
v[c][i] = '_';
}
}
if(v[0] == str(n, '.')) v.erase(v.begin());
for(str ss: v) cout << ss << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |