/**
.@@
.@@@@
:--:::::::-----==: %%@@@%
:*++*+==--========----------:-==: @%@@@@.
.:. ..-=+=+*+==---=----------------------:*@%@@@@ .:..
.::::-----==+++====+***#+----=------:--------:-=%%@@@#+%@@@@@@@@@@@@@@@@@@@@@@@
:+%@@@@@@@@@@@@@@%::::=*=+++++=++==*%*=-:=*#+##=-----------------:::-@%@@@@@@@@@@@@@@@@@@@@@@@@@@@*
%%%%%%%%%%%%@@@@@@= .:=%@@@@@%#+=+++%@@@%+-==--++-=*=-------------:-----:*@@@@@@@@@@@@@@@@@@@@@@@@@@%
.@%%%%%%%%%@@@@%- .-+%@@@%@%%%####%#*#%%%%==----+=:-++-::------=----:::-:=@@@@@@@@@@@@@@@@@@@@@@@@%
%%%%%%%%@%@@+ .::*%@@@@%#**#####******+*%+===---+=..:==---------:---::::-@@@@@@@@@@@@@@@@@@@@@@@
%%%@%@%@@@: .:.%%%%%#=+*+*+*#*+=+***+*#+##=--=-:-+. ==--------::::--::-@@@@@@@@@@@@@@@@@@@@@
.#%%%@%@% . -@%%%*==+*++++**+++=+*++=++=+#--=----=: +---:-::::::::--:-%@@@@@@@@@@@@@@@@@@=
:@%%%@= . =%%%#---======+=========++=====*+--=-=--=. --::::::::::::--=@@@@@@@@@@@@@@@@@@@:
@%@# . -%%*+---========-:===++======-==-==--=-----: :-::::::::::::-=@@@@@@@@@@@@@@@@@@@=
@#. . .#*=+.-=-==-==-=-::===+=-==-=--=--==+=:------= .-:::::::-:--:--#@@@@@@@@@@@@@@@@@@#
- #+=-.:----=------.:-=-*===----==--==-+=-:::-::-: :-::::::::::::==+@@@@@@@@@@@@@@@@@@
. -==:..-=--==--:--:.-===+====----=====--=--::::::-- ::::::::::--:=%*=*@@@@@@@@@@@@@@@@.
.+: . .==-. :----==-::--:.---==-===---:------:----::::::-+ -:::------=--+#+#@@@@@@@@@@@@@@@@.
. . - ::--. .::---:-:.-=-: :--==--==:=--:-::::::--=-:::-:::*. :::-==-==--:--**@@@@@@@%@@@@@@@@@=
:.: :::.. .--:::::: --::.:-:---:--:--:::::::::--:==:::::::+. -:-=-=------:*+@@@@@@@@+ #@@@@@@
#-. -::.. .=+:::::-:.--:-:.::::::::::+:::::::::::::=-:::::::=. :=-=---------=%@@@@@@@@@ :@@@@
=@-. :=.. -=::::-:=.:::::-.::::::::::%.::::::::::::-=:::::::-+- *%+=-------::%@@@@@@@@@: :.
#@*. +-.. :-:::::::-..::::::.:::::::::%:-==:..::::::--+:::-:-==== :*%*+--------@@@@@@@@@@@
.@@# :=: .::::::::-:.::::::-.::::::.::#.:-=-.:..::-.::-+:-=--===-= -#++*+===-:#@@@@@@@@@@@@
*@@*. . --. .:::::::::-..::::.:::.::..:..-+:: :.......=-.::==--==-====- .**++++++=*@@@@@@@@@@@@@@:
=@@@==. .: .=-. ::::::.:::= .::::...::.-.....+::. - :....:*::--==--=======- -*++=+=++@@@@@@@@@@@@@@@@@@%-
+@@@@::- . .:- :=-. .::::::.::=- .::......=.=.....+ :. : ... - -:-==+---==-=--*: . .*++++=+%@@@@@@@@@@@@@@@
:@@@@%.=.. : :--.-=:..:.::.:....- ......... --: ::.:. . :::.- ----=#+====-==-*. :*++=++@@@@@@@@@@@@@.
+*#-- :.:: :-::==..::.:..:...:: .:....... . :: :. :. -::. ..:#=-=+-==-===-=+.+ .. -+=++%#=-+=%@@@@#
. ...::.--::==: ::........-:..=- : . . . .:. :-*- .:=-+====-==--=-+# :. +++++==+++++*@@*
:.::.::-.-==-.=-:...--.: :.::-. : .: :+--:. ::.==+===---=-=+--%. +@@=. :=*+++++++*++*
.::::::::==---=-:.. =- . ..: :..: .:... : -. .+. -*=:.+@@@@@@@@*====---=+*:**. . =@@**%+:-+*%*++***+=
. ...::::::-+=--+-=:--.+:. .. :.-.:::::. .: :.*. :-:+#@@%#++=%:-@##+===-==-=+--==+ .. .###*+++**#@%#+*+++*=
..::::::::.*+--:=-----:=:-....::=:--=:....:..=. :. ..+@@@*+==---#-=@*+*====-===+:-=*@% :: *#*+*#+*++#%%%%##*+++-
.::.:::::::%=--:-------: . : -:-+#+-....= ..: -*#::%+-:=+---:+**-+==-===-=-+-=@@@@ -# =***#%#+*+#%==*+
:.:::::::::-+=:---=-----. . :. ::=..:..: . : -=--:..:--+#-:-+=======-%==#@@@@:.@= :#***%%#*+=#-==
:-::-::::.:--*:---=-=---: . ..-+*#%#=-+:...:. :+-....-+=::::#=======-*%-+@@@%@@-%%- .#++*%%#*+#*+-
. =-:::=:::::-:+.:--=-=--:- .=**+-:::+++%-..:. . ::..--:....:=#-=====-#@+=@@@%*%@%%@%- -*+#%:*%++*=
=:::---:------::-:==-=--+. ....: :.:. . ......::*=-====-*@#-%@@%#*%%%%%%@*. +**- .*#**=
+:::. :---=--=:=:-:==-==-:@. .....:. ..:. ...::...--:*=====-+@@-*@%%*##%%*###+#*= +- ::-:**
::-: .:---.#:=.:-==-==-:%% .... ..: : := ==-+==-*@@=*@%#**#%#****##*++**- .: .
.-- .:--:=:=-.-==-==-:%@+ .... .: :: :=--===#@@**%%**#*##***++**+=+*- ::
:. :----=.- -=-====-%@@: ... . . . :---==-@@@#%%%#*#*******+++***+# :
. -:--: .:-+--==-:%@@@ . #%:-===@@@#%##*##**+++#*+*+*+****-
::-: *:%==----*+%@% . . #@%--+=*@%@%%##**#**+++%#*==+*++*+=
-=:-. #:+#+---:#%++%#. . .:. .:+ ..#@@@--**%%%%%###*+#++*++*--+*==+++-+.
. =:: -==%@--=-=%**%%+ =@+ .....:.:.:. .*:@@%--%%@%%%####**#++*+++--: .+*-==
:---+**%%---:@**%%#+ . :@%%%::.:::::..:.: .-::%%%-:@%%%%%###**#*+++=*+-:: :==:-=
. :=-+*##*#:-:**+*%**@: =@#*:.:::::::::: .:...:@%%-+%%%%%###**+%*==+=%=:-. .. :.
. +*=+**%**-:=***##*+%%. . .*%.:::::::::.. :. ....@%%=%%%#*#####+#%+===+:-:-. .
.+-++**#+** +*-*++++%%%. .. --:.::.::: =: . .%%#+%%####*+@*++%+=-+. .:-
--++=**#*+*-++==+++%%%#@+.. .:::. :=. . .%%%#*#*##*#+#=++#===: .-
. . =-=+****+**+#:+==++#%%#%%%@%=. .. :-: . %#%###%*##.:*+==#++- :
. :-=+=++***++#-:+++*++*#%%%%@@%=.. .. :---. #@@%@@@@= := .+-+-
. . :.-===++**+==*+::+#++++*#%%%%%%%%-. .*=:-:. *%%%##*==+**#*+==*+=
: -::====++*=+=+*==*=-=#**##%#%%%%%*+-:%#--:-. .. .%#*=-==-*#*++==++-=#*:
:*::**=====+**==+=++*##*+++**##%%%%%%. :::.:. .. .:=--===+@#*+++=+*+=-=+=*#=
#-=+==*=-++++#++==-++++*++++*#%%%%%%=- .:.... . . -=--=+@#*#%@@%+==+=====+*+
..*++==+**+:=*++%++++#++++++*+**#%%%%#-=. .:........ .@-=+++#%%@@%@=======++*@+
.+-.-+*==*++#+-:=++*%+=**++++++*++**%%%%--=-.::.......... .: ==++*%@@%@+========+*#@@+
-:--.=-*+*+++++=:.:-+*#+++*****=+*##%+#%==---::........... : .+%@@@%@#+======++*#%%@@#%=
+::-:==--=*==**=#=:::-+#**+*+**++**%=.-++-:::--... .. .... :. ..-@@@*++====++++*#%@@@%*=+.
=---.=--:*+=+#*+=:-:--=++=**+++++*#+:=-.--:.:::.......... + ..*%-+=-====+++*###@@@#+=+#*
=----==-*+===@%:..-=---++##=+++***#-. .:=::...:.......... := :*:==-=====+++*%#%@@*++++##@*
.+=-=*=+#*---==%:.:-=%+#+-:--+++*+*%:.. -::............. :. .--==-=======+*#*%@%+++==+##@#%+
-:=##*+=-::-===+:.--+*#---::+*++++#+ ....- .:......... .. . :+. . =============+**#*++++===*%%#%###.
:--*#@*+-::::-==-:-=#=.---:-+*==+#-......-: .......... :. +============+*##**++====*%%%#**+=+
.:---%=@*+-::--:-:.-*=:=:--=#++*@%-... . .-:.... ...... .:. .=-===========+**+++===-===*#***+++=-:
..:-==+*#+*=:-::--.=+=::-=+*+%@+#@%.... ..-:. ......... .- .+============++========--===++**++==--
.:----++%**-:: .+=+=++++++*%#+@@@%......-:. . =. . .+-===-===-==++==--===------==+++====--:
..:--=*#%*+= .=%##-:-+++*##+@@@@@.... -:. . ..- -+==-======++*=======------==++======+*#*
.::=-=#+#- .::=#-:-:=++=+##*@@@@@@.. .::. . -: . .=+==-==+-==++=:=---=----========+**+=----:=
.::--=+#=.:::-*=:::::++=+*#*%.#@@@@:..::. . . .+ .=#*++++*+=====--=-=---=--=+**##*+=====-------:-
..::-=*+::::=:.::::--===**+*. -@@@@:.:: ... . -.. . . .-%@@@*+*#*#*+====--=-:----*##*+==--==---======----:
..:-:+:-:--:::--:::-+#*+++: @@@@+:- .. . +. .. -@@@@@@@*@%*###*======*+-=-=%#=-=======-====-=======-:-+
..:=::::::::::-:**++=-++. .@@@@#= . . :+ :#@@@@@@@@@%##%%%%#+++==#@%%@=**+==========-------=====-=+==
. .:::::::--+==----+#++. .@@@@@ .. ..:::+#%@%@@@@@@@#@%%%%%%@%*=+#@@@%@#%@=============------=====++++=+
.... ..::=-:----+*=+**=++@@@@@:.-*@@%%%%%@@@@*:. .@@%%@%%@%**%@@@@@##@@*========--------=====+++*#*+==
. ...::=:--==++=+++=+++%@@@@@@@%%@%@@#- :%#%%%%@%#@@@@@@@%#@*@@+--===-----------======*##**=--
...:.--:--=*+===++=++=#@@@@@%%%#*++=. :%%%@@%%@@@@@@@@+@@#+*@@+===-----------====+++*##**+=-:
....:+=:-==#++===+++===%@@%#*+==+++++++*##@@@%@@@@@@@@@**%##+=-%@#=-------------====+++*##*++=-:.
..:-+#===+# .-:=+=*+*+#*+==+++++++++**%@@@@@@@@@@@*-@@#+=+==+@@=--------------===+++*##*+=-:.
..:=%+==+% =#*-##*#+=%+++=++*+#%@@@@@@@@@@:%@#*=+=-+=#@@+-=-------------====+*#*++=-:.
.=*===* .--#:..-#@@-. .:=**@@@@@@@@*@@@%+%+@@=--#@%=--:----------------=+++==-:.
=::-- :*-##==-. -@@@@@@@@@@@@@@@@@@@@@%+=::::::::::::::::::--====-:..
... *%=-..... %@@@@@@@@@@@@@@@@@@@@@*-::..:.............:::--:.. .-:
:: ==. ..... +@%@@@@@@@@@@@@@@@@@@@@*.:. . ... .... . =@*-:
::..:---::... :#*#@@@@@@@@@%%@@@@@@@@@@+ . :* ##+%+:
...::::*-:::@@@@@@%##%%%%@@@@@@@# -+. *+ = -:
.. .#@@%%%%##*+*#%@@@%%%= . : ::
@@@%%%######%%%%#####%= = #
@@@@@%@@%%%###*##*- . . =
:@@%%%%###******+=- .
*@###***+**+++:
-*- =*++*:
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using ull=unsigned long long;
#define speed ios_base::sync_with_stdio(false);cin.tie();cout.tie()
#define endl "\n"
#define int ll
#define ff first
#define ss second
#define fori for(ll i=0; i<n; i++)
#define forj for(ll j=0; j<n; j++)
#define fors for(ll i=0; i<s.size(); i++)
#define forv for(ll i=0; i<v.size(); i++)
#define pb push_back
#define sorta sort(a,a+n)
#define sortv sort(v.begin(), v.end())
#define sorts sort(s.begin(), s.end())
const int sz = 2e5 + 5;
const int oo =1e18+7;
void solve(){
int n;
cin>>n;
string s;
cin>>s;
int p=0,m=0,cnt=0;
fors
{
if(s[i]=='+')
cnt++;
if(s[i]=='-')
cnt--;
p=max(p,cnt);
m=min(m,cnt);
}
int k=p-m;
cnt=k+m;
char ans[k][n];
for(int i=0;i<=k;i++)
{
for(int j=0;j<n;j++)
{
ans[i][j]='.';
}
}
for(int i=0;i<n;i++)
{
if(s[i]=='+')
{
ans[cnt][i]='/';
cnt--;
}
else if(s[i]=='-')
{
cnt++;
ans[cnt][i]=char(92);
}
else
ans[cnt][i]='_';
}
for(int i=1;i<=k;i++)
{
int b=0;
for(int j=0;j<n;j++)
{
if(ans[i][j]!='.')
cout<<ans[i][j];
else
cout<<'.';
}
cout<<endl;
}
}
signed main()
{
speed;
ll t=1; //cin >> t;
while(t--) solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |