# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1177076 | vuqar_fritl | Crtanje (COCI20_crtanje) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long z[8];
char a[101];
long long x[8];
int h[101][101];
int main()
{
ll b=0,c=0,t=0,l=0,m=0,n,s=0,d;
char f;
cin>>n;
for(int i=1;i<=n;i++){
cin>>f;
a[i]=f;
if(f=='='){
b++;
}
if(f=='-'){
c++;
s--;
}
if(f=='+'){
t++;
s++;
}
l=max(l,s);
m=min(m,s);
}
d=l-m;
t=l;
if(t==0){
t++;
}
for(int i=1;i<=n;i++){
h[i][t]++;
if(i==n){
break;
}
if(a[i+1]=='-'){
t++;
}
if(a[i]=='+'){
t--;
}
}
for(int i=1;i<=d;i++){
for(int j=1;j<=n;j++){
if(h[j][i]>0){
if(a[j]=='='){
cout<<"_";
}
if(a[j]=='-'){
cout<<char(92);
}
if(a[j]=='+'){
cout<<"/";
}
}
else{
cout<<".";
}
}
cout<<endl;
}
}#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long z[8];
char a[101];
long long x[8];
int h[101][101];
int main()
{
ll b=0,c=0,t=0,l=0,m=0,n,s=0,d;
char f;
cin>>n;
for(int i=1;i<=n;i++){
cin>>f;
a[i]=f;
if(f=='='){
b++;
}
if(f=='-'){
c++;
s--;
}
if(f=='+'){
t++;
s++;
}
l=max(l,s);
m=min(m,s);
}
d=l-m;
t=l;
if(t==0){
t++;
}
for(int i=1;i<=n;i++){
h[i][t]++;
if(i==n){
break;
}
if(a[i+1]=='-'){
t++;
}
if(a[i]=='+'){
t--;
}
}
for(int i=1;i<=d;i++){
for(int j=1;j<=n;j++){
if(h[j][i]>0){
if(a[j]=='='){
cout<<"_";
}
if(a[j]=='-'){
cout<<char(92);
}
if(a[j]=='+'){
cout<<"/";
}
}
else{
cout<<".";
}
}
cout<<endl;
}
if(d==0){
for(int i=1;i<=n;i++){
cout<<"_";
}
}
}