#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void construct_network(int H, int W, int K) {
vector<int> ROW, COL; ROW.clear(), COL.clear();
for(int i = 0; i < H; i++)
{
vector<int> rows; rows.clear();
for(int j = 0; j < W; j++) rows.pb(i*W+j);
ROW.pb(add_xor(rows));
}
for(int i = 0; i < W; i++)
{
vector<int> cols; cols.clear();
for(int j = 0; j < H; j++) cols.pb(j*W+i);
COL.pb(add_xor(cols));
}
int x = add_or(ROW), y = add_or(COL);
vector<int> t; t.clear(), t.pb(x), t.pb(add_not(y));
int option1f = add_and(t);
t.clear(), t.pb(y), t.pb(add_not(x));
int option2f = add_and(t);
vector<int> row_pair, col_pair; row_pair.clear(), col_pair.clear();
for(int i = H*W; i < H*W+H-1; i++)
{
t.clear(); t.pb(i), t.pb(i+1);
row_pair.pb(add_and(t));
}
for(int i = H*W+H; i < H*W+H+W-1; i++)
{
t.clear(); t.pb(i), t.pb(i+1);
col_pair.pb(add_and(t));
}
int option1s=-1, option2s=-1;
if(!row_pair.empty()) option1s = add_or(row_pair);
if(!col_pair.empty()) option2s = add_or(col_pair);
t.clear(), t.pb(option1f); if(option1s!=-1) t.pb(option1s);
int option1 = add_and(t);
t.clear(), t.pb(option2f); if(option2s!=-1) t.pb(option2s);
int option2 = add_and(t);
t.clear(), t.pb(option1), t.pb(option2);
add_or(t);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1100 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
5 ms |
696 KB |
Output is correct |
8 |
Correct |
7 ms |
664 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |