#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=1010;
int n,m,a[maxn],b[maxn];
int d[maxn][maxn],tot;
vector<int> A,B;
int solve(int k) {
for (int i=2;i<=n+m;i++) {
A.clear();
for (int j=1;j<=n;j++) {
if (1<=i-j&&i-j<=m) A.push_back(d[j][i-j]);
}
if (i>2) A.push_back(a[i-1]);
a[i]=add_or(A);
}
for (int i=n+m;i>=2;i--) {
A.clear();
for (int j=1;j<=n;j++) {
if (1<=i-j&&i-j<=m) A.push_back(d[j][i-j]);
}
if (i<n+m) A.push_back(b[i+1]);
b[i]=add_or(A);
}
B.clear();
for (int i=2,j=i+k;j<=n+m;i++,j++) {
A.clear();
A.push_back(a[i]);
A.push_back(b[j]);
B.push_back(add_and(A));
}
return add_or(B);
}
int query(int k) {
int t1=solve(k);
for (int i=1;i<=n;i++)
reverse(d[i]+1,d[i]+m+1);
int t2=solve(k);
for (int i=1;i<=n;i++)
reverse(d[i]+1,d[i]+m+1);
A.clear();
A.push_back(t1);
A.push_back(t2);
return add_or(A);
}
void construct_network(int N, int M, int K) {
n=N; m=M;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
d[i][j]=++tot;
if (K==n+m-2) {
query(K); return;
}
int t1=query(K+1);
int t2=add_not(t1);
int t3=query(K);
A.clear();
A.push_back(t2);
A.push_back(t3);
add_and(A);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
636 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
4576 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |