Submission #445891

#TimeUsernameProblemLanguageResultExecution timeMemory
445891JasiekstrzCrtanje (COCI20_crtanje)C++17
50 / 50
1 ms460 KiB
#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 timeMemoryGrader output
Fetching results...