#include<iostream>
#include<vector>
#include "vision.h"
using namespace std;
static int diag[405];
static vector<int> v, w;
static void solve(int &r1, int &r2, int nr, int k){
int i, x, aux, j, y;
for(i = 1; i <= nr - k; i++){
v.push_back(diag[i]);
v.push_back(diag[i + k]);
x = add_and(v);
w.push_back(x);
v.clear();
}
r2 = add_or(w);
w.clear();
for(i = 1; i <= k; i++){
v.push_back(diag[i]);
}
aux = add_xor(v);
v.clear();
for(i = 1; i <= nr - k; i++){
for(j = i; j <= i + k; j++){
v.push_back(diag[j]);
}
y = add_xor(v);
y = add_not(y);
x = add_or(v);
v.clear();
v.push_back(x);
v.push_back(y);
w.push_back( add_and(v) );
v.clear();
}
r1 = add_or(w);
w.clear();
v.push_back(r1);
v.push_back(aux);
r1 = add_or(v);
v.clear();
}
void construct_network(int n, int m, int k) {
int i, j, ii, jj, nr, r1, r2, r3, r4;
nr = 0;
for(i = n - 1; i > 0; i--){
ii = i;
jj = 0;
while(ii < n && jj < m){
v.push_back(ii * m + jj);
ii++;
jj++;
}
diag[++nr] = add_or(v);
v.clear();
}
for(j = 0; j < m; j++){
ii = 0;
jj = j;
while(ii < n && jj < m){
v.push_back(ii * m + jj);
ii++;
jj++;
}
diag[++nr] = add_or(v);
v.clear();
}
solve(r1, r2, nr, k);
nr = 0;
for(i = n - 1; i > 0; i--){
ii = i;
jj = m - 1;
while(ii < n && jj >= 0){
v.push_back(ii * m + jj);
ii++;
jj--;
}
diag[++nr] = add_or(v);
v.clear();
}
for(j = m - 1; j >= 0; j--){
ii = 0;
jj = j;
while(ii < n && jj >= 0){
v.push_back(ii * m + jj);
ii++;
jj--;
}
diag[++nr] = add_or(v);
v.clear();
}
solve(r3, r4, nr, k);
v.push_back(r1);
v.push_back(r3);
r1 = add_and(v);
v.clear();
v.push_back(r2);
v.push_back(r4);
r2 = add_or(v);
v.clear();
v.push_back(r1);
v.push_back(r2);
add_and(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
0 ms |
256 KB |
Output is correct |
7 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
0 ms |
256 KB |
Output is correct |
7 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
0 ms |
256 KB |
Output is correct |
7 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
0 ms |
256 KB |
Output is correct |
7 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Correct |
6 ms |
768 KB |
Output is correct |
3 |
Correct |
6 ms |
768 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
640 KB |
Output is correct |
6 |
Correct |
5 ms |
768 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
512 KB |
Output is correct |
10 |
Correct |
5 ms |
640 KB |
Output is correct |
11 |
Correct |
6 ms |
768 KB |
Output is correct |
12 |
Correct |
6 ms |
768 KB |
Output is correct |
13 |
Correct |
4 ms |
640 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
512 KB |
Output is correct |
16 |
Correct |
5 ms |
640 KB |
Output is correct |
17 |
Correct |
7 ms |
768 KB |
Output is correct |
18 |
Correct |
7 ms |
768 KB |
Output is correct |
19 |
Correct |
4 ms |
640 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
0 ms |
256 KB |
Output is correct |
22 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
3 ms |
512 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
5 ms |
768 KB |
Output is correct |
10 |
Correct |
6 ms |
768 KB |
Output is correct |
11 |
Correct |
5 ms |
640 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
512 KB |
Output is correct |
14 |
Correct |
5 ms |
768 KB |
Output is correct |
15 |
Correct |
5 ms |
640 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
512 KB |
Output is correct |
18 |
Correct |
6 ms |
768 KB |
Output is correct |
19 |
Correct |
1 ms |
512 KB |
Output is correct |
20 |
Correct |
12 ms |
1024 KB |
Output is correct |
21 |
Incorrect |
15 ms |
1664 KB |
on inputs (0, 0), (199, 99), expected 0, but computed 1 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
1532 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
4 ms |
640 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
8 ms |
1024 KB |
Output is correct |
8 |
Correct |
7 ms |
1024 KB |
Output is correct |
9 |
Correct |
13 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
0 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
0 ms |
256 KB |
Output is correct |
7 |
Incorrect |
0 ms |
256 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |