#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
/*
* Subtask 1 - 2 - 5 - 6 : AC : 41
* Subtask 7 : Need smart way of doing it
* Subtask 3 4 6 8
*/
void construct_network(int nbLig, int nbCol, int K) {
int maxDeltaLig = min(nbLig - 1, K);
vector<int> avecDeltaLig(maxDeltaLig + 1);
for (int deltaLig = 0; deltaLig <= maxDeltaLig; ++deltaLig) {
vector<int> aDemander;
for (int lig = 0; lig + deltaLig < nbLig; ++lig) {
vector<int> cases1, cases2;
for (int col = 0; col < nbCol; ++col) {
int pos1 = col + nbCol * lig;
int pos2 = col + nbCol * (lig + deltaLig);
cases1.push_back(pos1);
cases2.push_back(pos2);
}
int l1 = add_or(cases1), l2 = add_or(cases2);
int x = add_and({l1, l2});
aDemander.push_back(x);
}
avecDeltaLig[deltaLig] = add_or(aDemander);
}
int maxDeltaCol = min(nbCol - 1, K);
vector<int> avecDeltaCol(maxDeltaCol + 1);
for (int deltaCol = 0; deltaCol <= maxDeltaCol; ++deltaCol) {
vector<int> aDemander;
for (int col = 0; col + deltaCol < nbCol; ++col) {
vector<int> cases1, cases2;
for (int lig = 0; lig < nbLig; ++lig) {
int pos1 = col + nbCol * lig;
int pos2 = col + deltaCol + nbCol * lig;
cases1.push_back(pos1);
cases2.push_back(pos2);
}
int l1 = add_or(cases1), l2 = add_or(cases2);
int x = add_and({l1, l2});
aDemander.push_back(x);
}
avecDeltaCol[deltaCol] = add_or(aDemander);
}
vector<int> q;
for (int dL = 0; dL <= maxDeltaLig; ++dL) {
int dC = K - dL;
if (dC >= 0 and dC <= maxDeltaCol)
q.push_back(add_and({avecDeltaCol[dC], avecDeltaLig[dL]}));
}
add_or(q);
/*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);*/
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
292 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
292 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
292 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
292 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Incorrect |
2 ms |
968 KB |
WA in grader: Too many instructions |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
44 ms |
3472 KB |
on inputs (57, 107), (59, 108), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
292 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |