#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 = nbLig - 1;
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 = nbCol - 1;
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);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
1 ms |
332 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
1 ms |
332 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
15 ms |
1388 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
2 ms |
332 KB |
Output is correct |
31 |
Correct |
6 ms |
716 KB |
Output is correct |
32 |
Correct |
6 ms |
748 KB |
Output is correct |
33 |
Correct |
14 ms |
1332 KB |
Output is correct |
34 |
Correct |
14 ms |
1356 KB |
Output is correct |
35 |
Correct |
14 ms |
1356 KB |
Output is correct |
36 |
Correct |
13 ms |
1384 KB |
Output is correct |
37 |
Correct |
14 ms |
1388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
1 ms |
332 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
15 ms |
1388 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
2 ms |
332 KB |
Output is correct |
31 |
Correct |
6 ms |
716 KB |
Output is correct |
32 |
Correct |
6 ms |
748 KB |
Output is correct |
33 |
Correct |
14 ms |
1332 KB |
Output is correct |
34 |
Correct |
14 ms |
1356 KB |
Output is correct |
35 |
Correct |
14 ms |
1356 KB |
Output is correct |
36 |
Correct |
13 ms |
1384 KB |
Output is correct |
37 |
Correct |
14 ms |
1388 KB |
Output is correct |
38 |
Incorrect |
5 ms |
3012 KB |
WA in grader: Too many instructions |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
968 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
3 ms |
1480 KB |
WA in grader: Too many instructions |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
4688 KB |
WA in grader: Too many inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
1 ms |
332 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
15 ms |
1388 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
2 ms |
332 KB |
Output is correct |
31 |
Correct |
6 ms |
716 KB |
Output is correct |
32 |
Correct |
6 ms |
748 KB |
Output is correct |
33 |
Correct |
14 ms |
1332 KB |
Output is correct |
34 |
Correct |
14 ms |
1356 KB |
Output is correct |
35 |
Correct |
14 ms |
1356 KB |
Output is correct |
36 |
Correct |
13 ms |
1384 KB |
Output is correct |
37 |
Correct |
14 ms |
1388 KB |
Output is correct |
38 |
Incorrect |
5 ms |
3012 KB |
WA in grader: Too many instructions |
39 |
Halted |
0 ms |
0 KB |
- |