Submission #861130

#TimeUsernameProblemLanguageResultExecution timeMemory
861130vjudge1Crtanje (COCI20_crtanje)C++14
50 / 50
1 ms348 KiB
#include<cstdio> const int maxn=105; char s[maxn],out[maxn<<1][maxn]; int n,max=maxn-1,min=maxn,now=maxn; int max_(int a,int b){ return a>b?a:b; } int min_(int a,int b){ return a<b?a:b; } int main(){ scanf("%d\n%s",&n,s+1); for(int i=1;i<=n;i++){ if(s[i]=='+')out[now][i]='/',max=max_(max,now),min=min_(min,now++); else if(s[i]=='-')max=max_(max,--now),min=min_(min,now),out[now][i]='\\'; else out[now][i]='_',max=max_(max,now),min=min_(min,now); } for(int i=max;i>=min;i--){ for(int j=1;j<=n;j++)putchar(out[i][j]?out[i][j]:'.'); putchar('\n'); } return 0; }

Compilation message (stderr)

crtanje.cpp: In function 'int main()':
crtanje.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d\n%s",&n,s+1);
      |  ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...