Submission #301099

# Submission time Handle Problem Language Result Execution time Memory
301099 2020-09-17T16:26:18 Z dantoh000 Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "vision.h"
vector<int> rdiag[405];
vector<int> ldiag[405];
int rdiagxor[405];
int ldiagxor[405];
int rdiagor[405];
int ldiagor[405];
int h,w;
int test(int dist){
    //printf("test dist %d\n",dist);
    vector<int> retl;
    for (int i = 0; i < h+w-1; i++){
        vector<int> X;
        vector<int> O;
        for (int j = 0; j <= dist; j++){
            if (i+j > h+w-2) continue;
            X.push_back(ldiagxor[i+j]);
            O.push_back(ldiagor[i+j]);
        }
        //printf("adding range [%d-%d]\n",i,i+dist);
        retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
    }
    //printf("ldiag done\n");
    vector<int> retr;
    for (int i = 0; i < h+w-1; i++){
        vector<int> X;
        vector<int> O;
        for (int j = 0; j <= dist; j++){
            if (i+j > h+w-2) continue;
            X.push_back(rdiagxor[i+j]);
            O.push_back(rdiagor[i+j]);
        }
        //printf("adding range [%d-%d]\n",i,i+dist);
        retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
    }
    //printf("rdiag done\n");
    //printf("test dist %d: retl %d, retr %d\n",dist,retl.size(),retr.size());
    return add_and({add_or(retl), add_or(retr)});
}
void construct_network(int H, int W, int K) {
    h = H, w = W;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            ldiag[i+j].push_back(i*W+j);
            rdiag[H-1-i+j].push_back(i*W+j);
        }
    }
    for (int i = 0; i < H+W; i++){
        if (ldiag[i].size()) ldiagxor[i] = add_xor(ldiag[i]);
        if (ldiag[i].size()) ldiagor[i] = add_or(ldiag[i]);
        if (rdiag[i].size()) rdiagxor[i] = add_xor(rdiag[i]);
        if (rdiag[i].size()) rdiagor[i] = add_or(rdiag[i]);
    }
    //printf("start test\n");
    add_and({test(K), add_not(test(K-1))});
}

Compilation message

vision.cpp:3:1: error: 'vector' does not name a type
    3 | vector<int> rdiag[405];
      | ^~~~~~
vision.cpp:4:1: error: 'vector' does not name a type
    4 | vector<int> ldiag[405];
      | ^~~~~~
vision.cpp: In function 'int test(int)':
vision.cpp:12:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   12 |     vector<int> retl;
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
vision.cpp:12:12: error: expected primary-expression before 'int'
   12 |     vector<int> retl;
      |            ^~~
vision.cpp:14:16: error: expected primary-expression before 'int'
   14 |         vector<int> X;
      |                ^~~
vision.cpp:15:16: error: expected primary-expression before 'int'
   15 |         vector<int> O;
      |                ^~~
vision.cpp:18:13: error: 'X' was not declared in this scope
   18 |             X.push_back(ldiagxor[i+j]);
      |             ^
vision.cpp:19:13: error: 'O' was not declared in this scope
   19 |             O.push_back(ldiagor[i+j]);
      |             ^
vision.cpp:22:9: error: 'retl' was not declared in this scope
   22 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |         ^~~~
vision.cpp:22:40: error: 'O' was not declared in this scope
   22 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                        ^
vision.cpp:22:60: error: 'X' was not declared in this scope
   22 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                                            ^
vision.cpp:22:64: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   22 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                                                ^
      |                                                                |
      |                                                                <brace-enclosed initializer list>
vision.cpp:25:12: error: expected primary-expression before 'int'
   25 |     vector<int> retr;
      |            ^~~
vision.cpp:27:16: error: expected primary-expression before 'int'
   27 |         vector<int> X;
      |                ^~~
vision.cpp:28:16: error: expected primary-expression before 'int'
   28 |         vector<int> O;
      |                ^~~
vision.cpp:31:13: error: 'X' was not declared in this scope
   31 |             X.push_back(rdiagxor[i+j]);
      |             ^
vision.cpp:32:13: error: 'O' was not declared in this scope
   32 |             O.push_back(rdiagor[i+j]);
      |             ^
vision.cpp:35:9: error: 'retr' was not declared in this scope
   35 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |         ^~~~
vision.cpp:35:40: error: 'O' was not declared in this scope
   35 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                        ^
vision.cpp:35:60: error: 'X' was not declared in this scope
   35 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                                            ^
vision.cpp:35:64: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   35 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                                                ^
      |                                                                |
      |                                                                <brace-enclosed initializer list>
vision.cpp:39:28: error: 'retl' was not declared in this scope
   39 |     return add_and({add_or(retl), add_or(retr)});
      |                            ^~~~
vision.cpp:39:42: error: 'retr' was not declared in this scope
   39 |     return add_and({add_or(retl), add_or(retr)});
      |                                          ^~~~
vision.cpp:39:48: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   39 |     return add_and({add_or(retl), add_or(retr)});
      |                                                ^
      |                                                |
      |                                                <brace-enclosed initializer list>
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:45:13: error: 'ldiag' was not declared in this scope; did you mean 'ldiagor'?
   45 |             ldiag[i+j].push_back(i*W+j);
      |             ^~~~~
      |             ldiagor
vision.cpp:46:13: error: 'rdiag' was not declared in this scope; did you mean 'rdiagor'?
   46 |             rdiag[H-1-i+j].push_back(i*W+j);
      |             ^~~~~
      |             rdiagor
vision.cpp:50:13: error: 'ldiag' was not declared in this scope; did you mean 'ldiagor'?
   50 |         if (ldiag[i].size()) ldiagxor[i] = add_xor(ldiag[i]);
      |             ^~~~~
      |             ldiagor
vision.cpp:51:13: error: 'ldiag' was not declared in this scope; did you mean 'ldiagor'?
   51 |         if (ldiag[i].size()) ldiagor[i] = add_or(ldiag[i]);
      |             ^~~~~
      |             ldiagor
vision.cpp:52:13: error: 'rdiag' was not declared in this scope; did you mean 'rdiagor'?
   52 |         if (rdiag[i].size()) rdiagxor[i] = add_xor(rdiag[i]);
      |             ^~~~~
      |             rdiagor
vision.cpp:53:13: error: 'rdiag' was not declared in this scope; did you mean 'rdiagor'?
   53 |         if (rdiag[i].size()) rdiagor[i] = add_or(rdiag[i]);
      |             ^~~~~
      |             rdiagor