-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOV-Trivial.cpp
44 lines (42 loc) · 1.14 KB
/
OV-Trivial.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <vector>
#include <iostream>
using namespace std;
void printVector(vector<bool> input)
{
for (int i = 0; i < input.size(); i++)
{
std::cout << input.at(i) << ' ';
}
std::cout << std::endl;
}
//Implementation of OV: Note all boolean vectors should be of the same length.
bool trivialOV(std::vector<std::vector<bool>> A, std::vector<std::vector<bool>> B)
{
for (int i = 0; i < A.size(); i++)
{
for (int j = 0; j < B.size(); j++)
{
bool orthogonal = true;
for (int k = 0; k < A[i].size(); k++)
{
if (A[i][k] == 1 && B[j][k] == 1)
{
orthogonal = false;
}
}
if (orthogonal)
{
printVector(A[i]);
printVector(B[j]);
return true;
}
}
}
return false;
}
int main(int argc, char *argv[])
{
std::vector<std::vector<bool>> A = {{1, 1, 1}, {1, 1, 0}, {1, 0, 1}, {0, 0, 1}};
std::vector<std::vector<bool>> B = {{0, 1, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 1}};
std::cout << trivialOV(A, B) << std::endl;
}