#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
#define mp make_pair
#define all(x) x.begin(),x.end()
void construct_network(int n, int m, int k) {
// std::vector<int> Ns;
// Ns = {0, 1};
// int a = add_and(Ns);
// Ns = {0, a};
// int b = add_or(Ns);
// Ns = {0, 1, b};
// int c = add_xor(Ns);
// add_not(c);
// vector<pair<int,int>> wtf = {{1,1},{1,-1},{-1,1},{-1,-1}};
// vector<int> checks;
// for(int i = 0; i < n; i++) {
// if(max(n,m) > 30 && min(n,m) != 1 && i != 0) continue;
// for(int j = 0; j < m; j++) {
// if(max(n,m) > 30 && min(n,m) != 1 && j != 0) continue;
// vector<int> valid_pos;
// for(int d1 = 0; d1 <= k; d1++) {
// for(auto X : wtf) {
// int ii = i+d1*X.fr;
// if(d1 == 0 && X.fr == -1) continue;
// int jj = j+(k-d1)*X.sc;
// if((k-d1) == 0 && X.sc == -1) continue;
// if(ii >= 0 && ii < n && jj >= 0 && jj < m && i*m+j < ii*m+jj) {
// valid_pos.pb(ii*m+jj);
// }
// }
// }
// if(valid_pos.size() == 0) continue;
// int or_valid_pos = add_or(valid_pos);
// checks.pb(add_and(vector<int>{i*m+j,or_valid_pos}));
// }
// }
// add_or(checks);
vector<int> checks;
for(int it = 0; it <= n+m-2; it++) {
int i,j;
if(it <= n-1) {
i = n-1-it;
j = 0;
}
else {
i = 0;
j = it-n+1;
}
vector<int> diag0,diag1;
int i0,j0,i1,j1;
i0 = i-i;
j0 = j-i;
i1 = i-i;
j1 = j+k-i;
while(i0 <= n-1 && j0 <= m-1) {
if(i0 >= 0 && i0 <= n-1 && j0 >= 0 && j0 <= m-1) diag0.pb(i0*m+j0);
i0++;
j0++;
}
while(i1 <= n-1 && j1 <= m-1) {
if(i1 >= 0 && i1 <= n-1 && j1 >= 0 && j1 <= m-1) diag1.pb(i1*m+j1);
i1++;
j1++;
}
if(diag0.size() && diag1.size()) checks.pb(add_and(vector<int>{add_or(diag0),add_or(diag1)}));
diag0.clear();
diag1.clear();
i0 = i-i;
j0 = j+i;
i1 = i-i;
j1 = j+k+i;
while(i0 <= n-1 && j0 <= m-1) {
if(i0 >= 0 && i0 <= n-1 && j0 >= 0 && j0 <= m-1) diag0.pb(i0*m+j0);
i0++;
j0--;
}
while(i1 <= n-1 && j1 <= m-1) {
if(i1 >= 0 && i1 <= n-1 && j1 >= 0 && j1 <= m-1) diag1.pb(i1*m+j1);
i1++;
j1--;
}
if(diag0.size() && diag1.size()) checks.pb(add_and(vector<int>{add_or(diag0),add_or(diag1)}));
}
add_or(checks);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
412 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
2004 KB |
on inputs (126, 120), (176, 169), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |