#include <bits/stdc++.h>
using namespace std;
#define f1 first
#define s2 second
#define INF 99999999
#define ll long long
#define pb push_back
#define fri(a) freopen(a,"r",stdin)
#define fro(a) freopen(a,"w",stdout)
const int N=1000;
int n,a,mn,mx;
string s;
char ans[N][N];
void solve(){
cin>>n>>s;
for(int i=0;i<n;i++){
if(s[i]=='+' && i>0 && s[i-1]!='=')a++;
else if(i==0 && s[i]=='+')a++;
else if(s[i]=='-')a--;
else if(s[i]=='=' && i>0 && s[i-1]=='+')a++;
mn=min(a,mn);
mx=max(a,mx);
}
a=-mn;
for(int i=0;i<1000;i++){
for(int j=0;j<1000;j++){
ans[i][j]='.';
}
}
for(int i=0;i<n;i++){
if(s[i]=='+'){
ans[a][i]='/';
a++;
}
else if(s[i]=='=')ans[a][i]='_';
else{
a--;
ans[a][i]='\\';
//cout<<a<<endl;
}
}
for(int i=-mn+mx-1;i>=0;i--){
for(int j=0;j<n;j++){
cout<<ans[i][j];
}
cout<<endl;
}
}
int main(){
//fri("in.txt");
//fro("out.txt");
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1260 KB |
Output is correct |
2 |
Correct |
2 ms |
1260 KB |
Output is correct |
3 |
Incorrect |
2 ms |
1260 KB |
Output isn't correct |
4 |
Runtime error |
3 ms |
2412 KB |
Execution killed with signal 11 |
5 |
Correct |
3 ms |
1260 KB |
Output is correct |