Submission #654853

# Submission time Handle Problem Language Result Execution time Memory
654853 2022-11-01T19:07:14 Z benjaminkleyn Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void construct_network(int h, int w, int k)
{
    vector<int> rd1(h + w - 1), rd2(h + w - 1);
    vector<int> ld1(h + w - 1), ld2(h + w - 1);
    for (int d = 0; d <= h + w - 2; d++)
    {
        // right-diagonal of (i, j) = i + j
        vector<int> idxR;
        for (int i = 0; i < h; i++)
            if (0 <= d - i && d - i < w)
                idxR.push_back(i * w + d - i);
        rd1[d] = add_or(idxR);
        rd2[d] = add_xor({add_xor(idxR), rd1[d]});

        // left-diagonal of (i, j) = i - j + (w - 1)
        vector<int> idxL;
        for (int i = 0; i < h; i++)
            if (0 <= i - d + w - 1 && i - d + w - 1 < w)
                idxL.push_back(i * w + i - d + w - 1);
        ld1[d] = add_or(idxL);
        ld2[d] = add_xor({add_xor(idxL), rd1[d]});
    }
    vector<int> A, B, C, D;
    for (int d = 0; d + k + 1 <= h + w - 2; d++)
    {
        vector<int> idxR1, idxR2, idxL1, idxL2;
        for (int i = d; i <= d + k + 1; i++)
        {
            idxR1.push_back(rd1[i]);
            idxR2.push_back(rd2[i]);
            idxL1.push_back(ld1[i]);
            idxL2.push_back(ld2[i]);
        }
        A.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
        B.push_back(add_or({add_xor({add_or(idxL1), add_xor(idxL1)}),add_or(idxL2)}));
    }
    for (int d = 0; d + k <= h + w - 2; d++)
    {
        vector<int> idxR1, idxR2, idxL1, idxL2;
        for (int i = d; i <= d + k; i++)
        {
            idxR1.push_back(rd1[i]);
            idxR2.push_back(rd2[i]);
            idxL1.push_back(ld1[i]);
            idxL2.push_back(ld2[i]);
        }
        C.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
        D.push_back(add_or({add_xor({add_or(idxL1), add_xor(idxL1)}),add_or(idxL2)}));
    }
    int x = add_and({add_or(A), add_or(B)});
    int y = add_and({add_or(C), add_or(D)});

    add_and({x, add_not(y)});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:16:18: error: 'add_or' was not declared in this scope
   16 |         rd1[d] = add_or(idxR);
      |                  ^~~~~~
vision.cpp:17:27: error: 'add_xor' was not declared in this scope
   17 |         rd2[d] = add_xor({add_xor(idxR), rd1[d]});
      |                           ^~~~~~~
vision.cpp:17:18: error: 'add_xor' was not declared in this scope
   17 |         rd2[d] = add_xor({add_xor(idxR), rd1[d]});
      |                  ^~~~~~~
vision.cpp:38:38: error: 'add_or' was not declared in this scope
   38 |         A.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                                      ^~~~~~
vision.cpp:38:53: error: 'add_xor' was not declared in this scope
   38 |         A.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                                                     ^~~~~~~
vision.cpp:38:29: error: 'add_xor' was not declared in this scope
   38 |         A.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                             ^~~~~~~
vision.cpp:38:21: error: 'add_or' was not declared in this scope
   38 |         A.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                     ^~~~~~
vision.cpp:51:38: error: 'add_or' was not declared in this scope
   51 |         C.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                                      ^~~~~~
vision.cpp:51:53: error: 'add_xor' was not declared in this scope
   51 |         C.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                                                     ^~~~~~~
vision.cpp:51:29: error: 'add_xor' was not declared in this scope
   51 |         C.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                             ^~~~~~~
vision.cpp:51:21: error: 'add_or' was not declared in this scope
   51 |         C.push_back(add_or({add_xor({add_or(idxR1), add_xor(idxR1)}),add_or(idxR2)}));
      |                     ^~~~~~
vision.cpp:54:22: error: 'add_or' was not declared in this scope
   54 |     int x = add_and({add_or(A), add_or(B)});
      |                      ^~~~~~
vision.cpp:54:13: error: 'add_and' was not declared in this scope
   54 |     int x = add_and({add_or(A), add_or(B)});
      |             ^~~~~~~
vision.cpp:57:17: error: 'add_not' was not declared in this scope
   57 |     add_and({x, add_not(y)});
      |                 ^~~~~~~