Submission #1177076

#TimeUsernameProblemLanguageResultExecution timeMemory
1177076vuqar_fritlCrtanje (COCI20_crtanje)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long z[8];
char a[101];
long long x[8];
int h[101][101];
int main()
{
    ll b=0,c=0,t=0,l=0,m=0,n,s=0,d;
    char f;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>f;
        a[i]=f;
        if(f=='='){
            b++;
        }
        if(f=='-'){
            c++;
            s--;
            
        }
        if(f=='+'){
            t++;
            s++;
        }
        l=max(l,s);
        m=min(m,s);
    }
    d=l-m;
    t=l;
    if(t==0){
        t++;
    }
    for(int i=1;i<=n;i++){
        h[i][t]++;
        if(i==n){
            break;
        }
        if(a[i+1]=='-'){
            t++;
        }
        if(a[i]=='+'){
            t--;
        }
    }
    for(int i=1;i<=d;i++){
        for(int j=1;j<=n;j++){
            if(h[j][i]>0){
                if(a[j]=='='){
                    cout<<"_";
                }
                if(a[j]=='-'){
                    cout<<char(92);
                }
                if(a[j]=='+'){
                    cout<<"/";
                }
            }
            else{
                cout<<".";
            }
        }
        cout<<endl;
    }
}#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long z[8];
char a[101];
long long x[8];
int h[101][101];
int main()
{
    ll b=0,c=0,t=0,l=0,m=0,n,s=0,d;
    char f;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>f;
        a[i]=f;
        if(f=='='){
            b++;
        }
        if(f=='-'){
            c++;
            s--;
            
        }
        if(f=='+'){
            t++;
            s++;
        }
        l=max(l,s);
        m=min(m,s);
    }
    d=l-m;
    t=l;
    if(t==0){
        t++;
    }
    for(int i=1;i<=n;i++){
        h[i][t]++;
        if(i==n){
            break;
        }
        if(a[i+1]=='-'){
            t++;
        }
        if(a[i]=='+'){
            t--;
        }
    }
    for(int i=1;i<=d;i++){
        for(int j=1;j<=n;j++){
            if(h[j][i]>0){
                if(a[j]=='='){
                    cout<<"_";
                }
                if(a[j]=='-'){
                    cout<<char(92);
                }
                if(a[j]=='+'){
                    cout<<"/";
                }
            }
            else{
                cout<<".";
            }
        }
        cout<<endl;
    }
    if(d==0){
        for(int i=1;i<=n;i++){
            cout<<"_";
        }
    }
}

Compilation message (stderr)

crtanje.cpp:67:2: error: stray '#' in program
   67 | }#include <bits/stdc++.h>
      |  ^
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:12: error: 'bits' was not declared in this scope
   67 | }#include <bits/stdc++.h>
      |            ^~~~
crtanje.cpp:67:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
   67 | }#include <bits/stdc++.h>
      |                 ^~~~
      |                 std
crtanje.cpp:67:3: error: 'include' does not name a type
   67 | }#include <bits/stdc++.h>
      |   ^~~~~~~
crtanje.cpp:70:11: error: redefinition of 'long long int z [8]'
   70 | long long z[8];
      |           ^
crtanje.cpp:4:11: note: 'long long int z [8]' previously declared here
    4 | long long z[8];
      |           ^
crtanje.cpp:71:6: error: redefinition of 'char a [101]'
   71 | char a[101];
      |      ^
crtanje.cpp:5:6: note: 'char a [101]' previously declared here
    5 | char a[101];
      |      ^
crtanje.cpp:72:11: error: redefinition of 'long long int x [8]'
   72 | long long x[8];
      |           ^
crtanje.cpp:6:11: note: 'long long int x [8]' previously declared here
    6 | long long x[8];
      |           ^
crtanje.cpp:73:5: error: redefinition of 'int h [101][101]'
   73 | int h[101][101];
      |     ^
crtanje.cpp:7:5: note: 'int h [101][101]' previously declared here
    7 | int h[101][101];
      |     ^
crtanje.cpp:74:5: error: redefinition of 'int main()'
   74 | int main()
      |     ^~~~
crtanje.cpp:8:5: note: 'int main()' previously defined here
    8 | int main()
      |     ^~~~