Submission #857266

# Submission time Handle Problem Language Result Execution time Memory
857266 2023-10-05T18:04:25 Z SalihSahin Crtanje (COCI20_crtanje) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#define int long long 
using namespace std;

const int mod = 998244353;

int32_t main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    string s;
    cin>>s;

    int vl = 0, mx = 0, mn = 0;
    for(auto itr: s){
        if(itr == '+') vl++;
        else if(itr == '-') vl--;
        mx = max(mx, vl);
        mn = min(mn, vl);
    }

    vector<vector<char> > a(mx - mn, vector<char>(n, '.'));
    int i = mx;
    for(int j = 0; j < n; j++){
        if(s[j] == '+'){
            a[i][j] = '/';
            i--;
        }
        else if(s[j] == '-'){
            a[i][j] = '\';
            i++; 
        }
        else{
            a[i][j] = '_';
        }
    }

    for(int j = 0; j < mx - mn; j++){
        for(int k = 0; k < n; k++){
            cout<<a[j][k];
        }
        cout<<endl;
    }
    return 0;
}

Compilation message

crtanje.cpp:31:23: warning: missing terminating ' character
   31 |             a[i][j] = '\';
      |                       ^
crtanje.cpp:31:23: error: missing terminating ' character
   31 |             a[i][j] = '\';
      |                       ^~~~
crtanje.cpp: In function 'int32_t main()':
crtanje.cpp:32:14: warning: operation on 'i' may be undefined [-Wsequence-point]
   32 |             i++;
      |             ~^~