# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
854442 | vjudge1 | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 512 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.
#ifndef Local
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define lim 100000
using namespace std;
const int mod=1000000007ll;
void solve(){
int n;
cin>>n;
string s;
cin>>s;
int maxi=0,mini=0,cur=0;
//cerr<<"what\n";
for(int i=0;i<n;i++){
if(s[i]=='+'){
maxi=max(maxi,cur);
mini=min(mini,cur);
cur++;
}
else if(s[i]=='-'){
cur--;
maxi=max(maxi,cur);
mini=min(mini,cur);
}
else {
maxi=max(maxi,cur);
mini=min(mini,cur);
}
}
int N=maxi-mini+1;
//cerr<<N<<"\n";
vector<string> ans(2*N+10);
cur=N;
for(int i=0;i<n;i++){
//cerr<<cur<<"\n";
for(int j=0;j<ans.size();j++){
if(cur==j){
if(s[i]=='+')ans[j].pb('/');
else if(s[i]=='-'){
if(0<=j)ans[j].pb('.');
ans[j+1].pb('\\');
j++;
}
else ans[j].pb('_');
}else if(0<=j){
ans[j].pb('.');
}
}
if(s[i]=='+')cur--;
else if(s[i]=='-')cur++;
}
string empt(n,'.');
for(int i=0;i<ans.size();i++){
if(ans[i]!=empt)cout<<ans[i]<<"\n";
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifdef Local
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |