Submission #423873

# Submission time Handle Problem Language Result Execution time Memory
423873 2021-06-11T13:37:21 Z aymanrs Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> 
//#include "vision.h"
int add_or(vector<int> a);
int add_xor(vector<int> a);
int add_not(int a);
int add_and(vector<int> a);
using namespace std;
void construct_network(int H, int W, int K){
    vector<int> ow, xw, ad, oc, xc;
    int f = -1, l = -1;
    for(int i = 0;i < H;i++){
        vector<int> o;
        for(int j = 0;j < W;j++){
            o.push_back(i * W + j);
        }
        ow.push_back(add_or(o));
        xw.push_back(add_xor(o));
    }
    for(int j = 0;j < W;j++){
        vector<int> o;
        for(int i = 0;i < H;i++){
            o.push_back(i * W + j);
        }
        oc.push_back(add_or(o));
        xc.push_back(add_xor(o));
    }
    if(H == 1) goto noH;
    for(int i = 0;i < H-1;i++){
        ad.push_back(add_and({ow[i], ow[i+1]}));
    }
    f = add_and({add_not(add_or(xc)), add_or(ad)});
    ad.clear();
    noH:
    if(W == 1) goto noW;
    for(int i = 0;i < W-1;i++){
        ad.push_back(add_and({oc[i], oc[i+1]}));
    }
    l = add_and({add_not(add_or(xw)), add_or(ad)});
    noW:
    if(l == -1) add_or({f});
    else if(f == -1) add_or({l});
    else add_or({f, l});
}

Compilation message

vision.cpp:3:12: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    3 | int add_or(vector<int> a);
      |            ^~~~~~
      |            std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
vision.cpp:3:19: error: expected primary-expression before 'int'
    3 | int add_or(vector<int> a);
      |                   ^~~
vision.cpp:4:13: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    4 | int add_xor(vector<int> a);
      |             ^~~~~~
      |             std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
vision.cpp:4:20: error: expected primary-expression before 'int'
    4 | int add_xor(vector<int> a);
      |                    ^~~
vision.cpp:6:13: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    6 | int add_and(vector<int> a);
      |             ^~~~~~
      |             std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
vision.cpp:6:20: error: expected primary-expression before 'int'
    6 | int add_and(vector<int> a);
      |                    ^~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:16:30: error: 'add_or' cannot be used as a function
   16 |         ow.push_back(add_or(o));
      |                              ^
vision.cpp:17:31: error: 'add_xor' cannot be used as a function
   17 |         xw.push_back(add_xor(o));
      |                               ^
vision.cpp:24:30: error: 'add_or' cannot be used as a function
   24 |         oc.push_back(add_or(o));
      |                              ^
vision.cpp:25:31: error: 'add_xor' cannot be used as a function
   25 |         xc.push_back(add_xor(o));
      |                               ^
vision.cpp:29:46: error: 'add_and' cannot be used as a function
   29 |         ad.push_back(add_and({ow[i], ow[i+1]}));
      |                                              ^
vision.cpp:31:35: error: 'add_or' cannot be used as a function
   31 |     f = add_and({add_not(add_or(xc)), add_or(ad)});
      |                                   ^
vision.cpp:31:48: error: 'add_or' cannot be used as a function
   31 |     f = add_and({add_not(add_or(xc)), add_or(ad)});
      |                                                ^
vision.cpp:31:50: error: 'add_and' cannot be used as a function
   31 |     f = add_and({add_not(add_or(xc)), add_or(ad)});
      |                                                  ^
vision.cpp:36:46: error: 'add_and' cannot be used as a function
   36 |         ad.push_back(add_and({oc[i], oc[i+1]}));
      |                                              ^
vision.cpp:38:35: error: 'add_or' cannot be used as a function
   38 |     l = add_and({add_not(add_or(xw)), add_or(ad)});
      |                                   ^
vision.cpp:38:48: error: 'add_or' cannot be used as a function
   38 |     l = add_and({add_not(add_or(xw)), add_or(ad)});
      |                                                ^
vision.cpp:38:50: error: 'add_and' cannot be used as a function
   38 |     l = add_and({add_not(add_or(xw)), add_or(ad)});
      |                                                  ^
vision.cpp:40:27: error: 'add_or' cannot be used as a function
   40 |     if(l == -1) add_or({f});
      |                           ^
vision.cpp:41:32: error: 'add_or' cannot be used as a function
   41 |     else if(f == -1) add_or({l});
      |                                ^
vision.cpp:42:23: error: 'add_or' cannot be used as a function
   42 |     else add_or({f, l});
      |                       ^