//#include <GOD>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define len length
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define frei freopen("input.txt","r",stdin)
#define freo freopen("output.txt","w",stdout)
const ll inf=1e18;
const ll mod=1e9+7;
const ll maxn=500+10,maxl=2e6+10;
char mat[maxn][maxn];
ll n;
string s;
ll mx=-inf,mn=inf;
int main(){
FAST_IO;
for(int i=0;i<maxn;i++){
for(int j=0;j<maxn;j++){
mat[i][j]='.';
}
}
cin>>n>>s;
ll stock=250;
ll pre=250;
ll st=0;
for(int i=0;i<s.len();i++){
if(s[i]=='+'){
stock++;
mat[stock-1][i]='/';
pre=stock-1;
st=1;
}else if(s[i]=='-'){
stock--;
mat[stock][i]=(char)92;
pre=stock;
st=-1;
}else{
if(st==1){
mat[pre+1][i]='_';
pre++;
}else if(st==-1){
mat[pre][i]='_';
}else{
mat[pre][i]='_';
}
st=0;
}
}
for(int i=0;i<maxn;i++){
for(int j=0;j<maxn;j++){
if(mat[i][j]=='/'||mat[i][j]=='_'||mat[i][j]==(char)92){
mn=min(mn,i*1ll);
mx=max(mx,i*1ll);
}
}
}
for(int i=mx;i>=mn;i--){
for(int j=0;j<s.len();j++){
cout<<mat[i][j];
}cout<<endl;
}
}
Compilation message
crtanje.cpp: In function 'int main()':
crtanje.cpp:32:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for(int i=0;i<s.len();i++){
| ~^~~~~~~~
crtanje.cpp:64:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
64 | for(int j=0;j<s.len();j++){
| ~^~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
620 KB |
Output is correct |
2 |
Correct |
1 ms |
620 KB |
Output is correct |
3 |
Correct |
1 ms |
620 KB |
Output is correct |
4 |
Correct |
1 ms |
620 KB |
Output is correct |
5 |
Correct |
2 ms |
620 KB |
Output is correct |