# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445891 | Jasiekstrz | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 460 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.
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int N=1000;
int tab[N+10];
char ans[N+10][2*N+10];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
char c;
cin>>c;
if(c=='+')
tab[i]=tab[i-1]+1;
if(c=='-')
tab[i]=tab[i-1]-1;
if(c=='=')
tab[i]=tab[i-1];
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=2*N;j++)
ans[i][j]='.';
}
for(int i=1,j=N;i<=n;i++)
{
if(tab[i]<tab[i-1])
{
j--;
ans[i][j]='\\';
}
if(tab[i]==tab[i-1])
ans[i][j]='_';
if(tab[i]>tab[i-1])
{
ans[i][j]='/';
j++;
}
}
for(int j=2*N;j>=1;j--)
{
bool ok=false;
for(int i=1;i<=n;i++)
ok=(ok || ans[i][j]!='.');
if(!ok)
continue;
for(int i=1;i<=n;i++)
cout<<ans[i][j];
cout<<"\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |