This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void construct_network(int h, int w, int k)
{
auto gv = [&] (int x, int y)
{
return x * w + y;
};
auto fa = [] (int a, int b, int x)
{
return make_pair (add_xor ({ a, b, x }),
add_or ({ add_and ({ a, b }),
add_and ({ b, x }),
add_and ({ x, a }) }));
};
int nl = add_and ({ gv (0, 0), add_not (gv (0, 0)) });
int ob = add_not (nl);
vector < vector < int > > a;
a.push_back ({ nl });
for (int i = 0; i < h; ++i)
{
vector < int > xa (w + 1);
for (int j = 0; j < w; ++j) xa[j] = gv (i, j);
xa[w] = a.back ()[0];
a.push_back ({ add_xor (xa) });
}
for (int j = 0; j < w; ++j)
{
vector < int > xa (h + 1);
for (int i = 0; i < h; ++i) xa[i] = gv (i, j);
xa[h] = a.back ()[0];
a.push_back ({ add_xor (xa) });
}
while (a.size () != 512) a.push_back ({ nl });
while (a.size () > 1)
{
vector < vector < int > > a2;
for (int i = 0; i < a.size (); i += 2)
{
vector < int > bs (a[i].size () + 1, nl);
for (int j = 0; j < a[i].size (); ++j)
tie (bs[j], bs[j + 1]) = fa (a[i][j], a[i + 1][j], bs[j]);
a2.push_back (bs);
}
swap (a, a2);
}
vector < int > ans (9);
for (int i = 0; i < 9; ++i) ans[i] = add_xor ({ a[0][i], ((k & (1 << i)) ? ob : nl) });
add_not (add_or (ans));
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:41:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for (int i = 0; i < a.size (); i += 2)
| ~~^~~~~~~~~~~
vision.cpp:44:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for (int j = 0; j < a[i].size (); ++j)
| ~~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |