// AM+DG
/*
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
#define L(i, varmn, varmx) for(ll i = varmn; i < varmx; i++)
#define LR(i, varmx, varmn) for(ll i = varmx; i > varmn; i--)
#define LI(i, varmn, varmx) for(int i = varmn; i < varmx; i++)
#define LIR(i, varmx, varmn) for(int i = varmx; i > varmn; i--)
#define pb push_back
#include "vision.h"
int cellnum(int r, int c, int W) {
return r * W + c;
}
void construct_network(int h, int w, int k) {
// Falsy/truthy values, may help!
// int falsy = add_xor({0, 0});
// int truthy = add_not(falsy);
// Row/col stuff
vi row_has;
LI(i, 0, h) {
vi all_in_row;
LI(j, 0, w) {
all_in_row.pb(cellnum(i, j, w));
}
row_has.pb(add_or(all_in_row));
}
vi col_has;
LI(i, 0, w) {
vi all_in_col;
LI(j, 0, h) all_in_col.pb(cellnum(j, i, w));
col_has.pb(add_or(all_in_col));
}
// int row_is_same = add_xor(row_has);
// int col_is_same = add_xor(col_has);
// r + c = k
// r = k - c
// 0 <= r <= w - 1;
// 0 <= k - c <= w - 1;
// k >= c >= k - w + 1;
// k >= r >= k - h + 1;
// Iterate through rows
vi sep_by_row;
LI(i, 0, max(k - h + 1, 0)) sep_by_row.pb(-1);
LI(i, max(k - h + 1, 0), min(w - 1, k)) {
vi to_or;
LI(j, 0, w - i) {
to_or.pb(add_and({row_has[j], row_has[j + i]}));
}
sep_by_row.pb(add_or(to_or));
}
// Iterate through columns
vi sep_by_col;
LI(i, 0, max(k - w + 1, 0)) sep_by_row.pb(-1);
LI(i, max(k - w + 1, 0), min(h - 1, k)) {
vi to_or;
LI(j, 0, h - i) {
to_or.pb(add_and({col_has[j], col_has[j + i]}));
}
sep_by_col.pb(add_or(to_or));
}
// ORing the possible separations
vi final_to_or;
LI(i, max(k - h + 1, 0), min(w - 1, k)) {
final_to_or.pb(add_and({sep_by_row[i], sep_by_col[k - i]}));
}
add_or(final_to_or);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
1116 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |