Submission #792337

# Submission time Handle Problem Language Result Execution time Memory
792337 2023-07-25T01:33:08 Z 1075508020060209tc Crtanje (COCI20_crtanje) C++14
30 / 50
1 ms 340 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
//#pragma GCC target("popcnt")
using namespace std;
#define int long long
int n;
string s;
int ar[200005];
int ps[200005];
int chmn;
int chmx;
string ans[500];
signed main()
{

    cin>>n>>s;
    for(int i=1;i<=300;i++){
        ans[i]="*";
        for(int j=1;j<=n;j++){
            ans[i]+=".";
        }
    }

    s="*"+s;
    chmn=0;
    chmx=0;
    for(int i=1;i<=n;i++){
        if(s[i]=='='){
            ps[i]=ps[i-1];
        }
        if(s[i]=='+'){
            ps[i]=ps[i-1]+1;
        }
        if(s[i]=='-'){
            ps[i]=ps[i-1]-1;
        }
        if(i==n){continue;}
        chmn=min(chmn,ps[i]);
        chmx=max(chmx,ps[i]);
    }
    int nwx=chmx+1;
    for(int i=1;i<=n;i++){
        if(s[i]=='='){
            ans[nwx][i]='_';
        }
        if(s[i]=='+'){
            ans[nwx--][i]='/';
        }
        if(s[i]=='-'){
            ans[nwx++][i]='a'-5;
        }
    }
    
    for(int i=1;i<=chmx-chmn+1;i++){
        for(int j=1;j<=n;j++){
            cout<<ans[i][j];
        }cout<<endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Incorrect 1 ms 340 KB Output isn't correct
5 Correct 1 ms 340 KB Output is correct