Submission #1177097

#TimeUsernameProblemLanguageResultExecution timeMemory
1177097mdael.aliCrtanje (COCI20_crtanje)C++20
10 / 50
1 ms1344 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n; cin>>n; string s; cin>>s; ll cem=0; ll maks=0,mini=0; for(ll i=0; i<n; i++) { if(s[i]=='+') { cem++; } if(s[i]=='-') cem--; maks=max(maks,cem); mini=min(mini,cem); } maks+=5; mini+=5; ll c=5; ll d=maks-mini; ll b=maks; vector<vector<char>>v(1001,vector<char>(1001,'.')); for(ll i=0; i<n-1; i++) { if(s[i]=='+' and s[i+1]=='-') { v[c][i]='/'; } if(s[i]=='+' and s[i+1]!='-') { v[c][i]='/'; c--; } else if(s[i]=='-' and s[i+1]!='-') { v[c][i]='\\'; } else if(s[i]=='-' and s[i+1]=='-') { v[c][i]='\\'; c++; } else if(s[i]=='=' and s[i+1]=='-') { v[c][i]='_'; c++; } else if(s[i]=='=' and s[i+1]!='-') { v[c][i]='_'; } } if(s[n-1]=='-') { v[c][n-1]='\\'; } if(s[n-1]=='+') { v[c][n-1]='/'; } if(s[n-1]=='=') { v[c][n-1]='_'; } int minii = 1e18, maxi = -1e18; for(int i = 0; i <= 1000; i++) { for(int j = 0; j <= 1000; j++) { if(v[i][j] != '.') { minii = min(minii, i); maxi = max(maxi, i); } } } for(ll i=minii; i<=maxi; i++) { for(ll j=0; j<n; j++) { cout<<v[i][j]; } cout<<endl; } }

Compilation message (stderr)

crtanje.cpp: In function 'int main()':
crtanje.cpp:70:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   70 |         int minii = 1e18, maxi = -1e18;
      |                     ^~~~
crtanje.cpp:70:34: warning: overflow in conversion from 'double' to 'int' changes value from '-1.0e+18' to '-2147483648' [-Woverflow]
   70 |         int minii = 1e18, maxi = -1e18;
      |                                  ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...