#include "vision.h"
#include "bits/stdc++.h"
using namespace std;
int nolsemua(vector<int> v){
return add_not(add_or(v));
}
int bersebelahan(vector<int> v){
vector<int> atau;
for(int i=1;i<v.size();i++){
atau.push_back(add_and({v[i-1],v[i]}));
}
return add_or(atau);
}
vector<int> baris(int h,int w){
vector<int> ret;
for(int i=0;i<h;i++){
vector<int> v;
for(int j=0;j<w;j++)v.push_back(i*w+j);
ret.push_back(add_xor(v));
}
return ret;
}
vector<int> kolom(int h,int w){
vector<int> ret;
for(int j=0;j<w;j++){
vector<int> v;
for(int i=0;i<h;i++)v.push_back(i*w+j);
ret.push_back(add_xor(v));
}
return ret;
}
void construct_network(int H, int W, int K) {
if(H==1)bersebelahan(kolom(H,W));
else if(W==1)bersebelahan(baris(H,W));
else{
int x=add_and({nolsemua(baris(H,W)),bersebelahan(kolom(H,W))});
int y=add_and({nolsemua(kolom(H,W)),bersebelahan(baris(H,W))});
add_or({x,y});
}
}
Compilation message
vision.cpp: In function 'int bersebelahan(std::vector<int>)':
vision.cpp:11:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1;i<v.size();i++){
~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
1984 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
504 KB |
Output is correct |
4 |
Correct |
4 ms |
504 KB |
Output is correct |
5 |
Correct |
3 ms |
380 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
11 ms |
1124 KB |
Output is correct |
8 |
Correct |
10 ms |
1144 KB |
Output is correct |
9 |
Correct |
20 ms |
2040 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |