Submission #473760

#TimeUsernameProblemLanguageResultExecution timeMemory
473760MamdouhNCrtanje (COCI20_crtanje)C++17
30 / 50
1 ms332 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" char ar[300][300]; main() { for(int i=0;i<300;i++)for(int j=0;j<300;j++)ar[i][j]='.'; int n; string s; cin>>n>>s; int i = 101 , j=0,mx=0,mn=1e9; for(int o=0;o<n;o++) { char c; if(s[o]=='+')c='/'; if(s[o]=='-')c='\\'; if(s[o]=='=')c='_'; ar[i][j]=c; mx=max(mx,i); mn=min(mn,i); if(o==n-1)continue; j++; if(s[o]=='+'&&s[o+1]!=' -')i--; if(s[o]=='-'&&s[o+1]=='-')i++; } for(int i = mn;i<=mx;i++) { for(int j=0;j<n;j++)cout<<ar[i][j]; cout<<endl; } }

Compilation message (stderr)

crtanje.cpp:26:31: warning: multi-character character constant [-Wmultichar]
   26 |         if(s[o]=='+'&&s[o+1]!=' -')i--;
      |                               ^~~~
crtanje.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
crtanje.cpp: In function 'int main()':
crtanje.cpp:21:17: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |         ar[i][j]=c;
      |         ~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...