Submission #792337

#TimeUsernameProblemLanguageResultExecution timeMemory
7923371075508020060209tcCrtanje (COCI20_crtanje)C++14
30 / 50
1 ms340 KiB
#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 timeMemoryGrader output
Fetching results...