#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
/*
* Subtask 1 - 2 - 3 - 5 - 6 - 7 : AC = 66
* Subtask 4 8
*/
void construct_network(int nbLig, int nbCol, int K) {
int maxDeltaLig = min(nbLig - 1, K);
vector<int> avecDeltaLig(maxDeltaLig + 1);
// 2 sur meme lig ?
vector<int> sameLig;
for (int lig = 0; lig < nbLig; ++lig) {
vector<int> pos;
for (int col = 0; col < nbCol; ++col)
pos.push_back(col + nbCol * lig);
sameLig.push_back(add_and({add_or(pos), add_not(add_xor(pos))}));
}
avecDeltaLig[0] = add_or(sameLig);
vector<int> before;
before.push_back(avecDeltaLig[0]);
for (int deltaLig = maxDeltaLig; deltaLig; --deltaLig) {
vector<int> toAsk;
for (int residu = 0; residu < deltaLig; ++residu) {
vector<int> cases;
for (int lig = residu; lig < nbLig; lig += deltaLig)
for (int col = 0; col < nbCol; ++col)
cases.push_back(lig * nbCol + col);
toAsk.push_back(add_and({add_or(cases), add_not(add_xor(cases))}));
}
int withMult = add_or(toAsk);
avecDeltaLig[deltaLig] = add_and({withMult, add_not(add_or(before))});
before.push_back(avecDeltaLig[deltaLig]);
}
int maxDeltaCol = min(nbCol - 1, K);
vector<int> avecDeltaCol(maxDeltaCol + 1);
vector<int> sameCol;
for (int col = 0; col < nbCol; ++col) {
vector<int> pos;
for (int lig = 0; lig < nbLig; ++lig)
pos.push_back(col + nbCol * lig);
sameCol.push_back(add_and({add_or(pos), add_not(add_xor(pos))}));
}
avecDeltaCol[0] = add_or(sameCol);
before.clear();
before.push_back(avecDeltaCol[0]);
for (int deltaCol = maxDeltaCol; deltaCol; --deltaCol) {
vector<int> toAsk;
for (int residu = 0; residu < deltaCol; ++residu) {
vector<int> cases;
for (int col = residu; col < nbCol; col += deltaCol)
for (int lig = 0; lig < nbLig; ++lig)
cases.push_back(col + nbCol * lig);
toAsk.push_back(add_and({add_or(cases), add_not(add_xor(cases))}));
}
int withMult = add_or(toAsk);
avecDeltaCol[deltaCol] = add_and({withMult, add_not(add_or(before))});
before.push_back(avecDeltaCol[deltaCol]);
}
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 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
3 ms |
460 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
4068 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
3 ms |
528 KB |
on inputs (48, 2), (50, 2), expected 0, but computed 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |