Submission #854442

#TimeUsernameProblemLanguageResultExecution timeMemory
854442vjudge1Crtanje (COCI20_crtanje)C++17
50 / 50
1 ms512 KiB
#ifndef Local #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #endif #include <bits/stdc++.h> #define int long long #define pb push_back #define lim 100000 using namespace std; const int mod=1000000007ll; void solve(){ int n; cin>>n; string s; cin>>s; int maxi=0,mini=0,cur=0; //cerr<<"what\n"; for(int i=0;i<n;i++){ if(s[i]=='+'){ maxi=max(maxi,cur); mini=min(mini,cur); cur++; } else if(s[i]=='-'){ cur--; maxi=max(maxi,cur); mini=min(mini,cur); } else { maxi=max(maxi,cur); mini=min(mini,cur); } } int N=maxi-mini+1; //cerr<<N<<"\n"; vector<string> ans(2*N+10); cur=N; for(int i=0;i<n;i++){ //cerr<<cur<<"\n"; for(int j=0;j<ans.size();j++){ if(cur==j){ if(s[i]=='+')ans[j].pb('/'); else if(s[i]=='-'){ if(0<=j)ans[j].pb('.'); ans[j+1].pb('\\'); j++; } else ans[j].pb('_'); }else if(0<=j){ ans[j].pb('.'); } } if(s[i]=='+')cur--; else if(s[i]=='-')cur++; } string empt(n,'.'); for(int i=0;i<ans.size();i++){ if(ans[i]!=empt)cout<<ans[i]<<"\n"; } } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #ifdef Local freopen("in","r",stdin); freopen("out","w",stdout); #endif solve(); }

Compilation message (stderr)

crtanje.cpp: In function 'void solve()':
crtanje.cpp:41:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int j=0;j<ans.size();j++){
      |                     ~^~~~~~~~~~~
crtanje.cpp:58:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |     for(int i=0;i<ans.size();i++){
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...