#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
const int N = 202;
int n, m, k;
vector<int> solv125()
{
vector<int> v;
for (int x1 = 0; x1 < n; ++x1)
{
for (int y1_ = 0; y1_ < m; ++y1_)
{
for (int x2 = 0; x2 < n; ++x2)
{
for (int y2 = 0; y2 < m; ++y2)
{
if (abs(x1 - x2) + abs(y1_ - y2) == k)
{
if (m_p(x1, y1_) < m_p(x2, y2))
{
v.push_back(add_and({x1 * m + y1_, x2 * m + y2}));
}
}
}
}
}
}
add_or(v);
}
void solv6()
{
vector<int> v;
for (int x1 = 0; x1 < 1; ++x1)
{
for (int y1_ = 0; y1_ < 1; ++y1_)
{
for (int x2 = 0; x2 < n; ++x2)
{
for (int y2 = 0; y2 < m; ++y2)
{
if (abs(x1 - x2) + abs(y1_ - y2) == k)
{
if (m_p(x1, y1_) < m_p(x2, y2))
{
v.push_back(add_and({x1 * m + y1_, x2 * m + y2}));
}
}
}
}
}
}
add_or(v);
}
void solv()
{
vector<int> t, s;
for (int i = 0; i < n; ++i)
{
vector<int> v;
for (int j = 0; j < m; ++j)
{
v.push_back(i * m + j);
}
t.push_back(add_or(v));
}
for (int j = 0; j < m; ++j)
{
vector<int> v;
for (int i = 0; i < n; ++i)
{
v.push_back(i * m + j);
}
s.push_back(add_or(v));
}
vector<int> tt, ss;
for (int d = 0; d < n; ++d)
{
vector<int> v;
for (int i = 0; i + d < n; ++i)
{
v.push_back(add_and({t[i], t[i + d]}));
}
tt.push_back(add_or(v));
}
for (int d = 0; d < m; ++d)
{
vector<int> v;
for (int i = 0; i + d < m; ++i)
{
v.push_back(add_and({s[i], s[i + d]}));
}
ss.push_back(add_or(v));
}
vector<int> v;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
if (i + j == k)
{
v.push_back(add_and({tt[i], ss[j]}));
}
}
}
add_or(v);
}
void construct_network(int H, int W, int K)
{
n = H;
m = W;
k = K;
solv();
return;
if (max(n, m) <= 10 || min(n, m) == 1)
solv125();
else
solv6();
}
Compilation message
vision.cpp: In function 'std::vector<int> solv125()':
vision.cpp:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
37 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1148 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1404 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |