Submission #442213

# Submission time Handle Problem Language Result Execution time Memory
442213 2021-07-07T09:42:13 Z peijar Vision Program (IOI19_vision) C++17
32 / 100
14 ms 4664 KB
#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) {
    if (nbLig - deltaLig <= deltaLig) {
      vector<int> toAsk;
      for (int lig = 0; lig + deltaLig < nbLig; ++lig) {
        vector<int> cases1, cases2;
        for (int col = 0; col < nbCol; ++col)
          cases1.push_back(col + nbCol * lig),
              cases2.push_back(col + nbCol * (lig + deltaLig));
        toAsk.push_back(add_and({add_or(cases1), add_or(cases2)}));
      }
      avecDeltaLig[deltaLig] = add_or(toAsk);
    } else {
      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) {
    if (nbCol - deltaCol <= deltaCol) {
      vector<int> toAsk;
      for (int col = 0; col + deltaCol < nbCol; ++col) {
        vector<int> pos1, pos2;
        for (int lig = 0; lig < nbLig; ++lig)
          pos1.push_back(col + nbCol * lig),
              pos2.push_back(col + deltaCol + nbCol * lig);
        toAsk.push_back(add_and({add_or(pos1), add_or(pos2)}));
      }
      avecDeltaCol[deltaCol] = add_or(toAsk);
    } else {
      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 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 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 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 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 1 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 2 ms 332 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 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 1 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 2 ms 332 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 9 ms 972 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 4 ms 588 KB Output is correct
32 Correct 4 ms 588 KB Output is correct
33 Correct 12 ms 936 KB Output is correct
34 Correct 13 ms 876 KB Output is correct
35 Correct 14 ms 864 KB Output is correct
36 Correct 9 ms 972 KB Output is correct
37 Correct 10 ms 972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 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 1 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 2 ms 332 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 9 ms 972 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 4 ms 588 KB Output is correct
32 Correct 4 ms 588 KB Output is correct
33 Correct 12 ms 936 KB Output is correct
34 Correct 13 ms 876 KB Output is correct
35 Correct 14 ms 864 KB Output is correct
36 Correct 9 ms 972 KB Output is correct
37 Correct 10 ms 972 KB Output is correct
38 Incorrect 8 ms 4664 KB WA in grader: Too many inputs
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 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 5 ms 2372 KB WA in grader: Too many instructions
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 4552 KB WA in grader: Too many inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 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 1 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 2 ms 332 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 9 ms 972 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 4 ms 588 KB Output is correct
32 Correct 4 ms 588 KB Output is correct
33 Correct 12 ms 936 KB Output is correct
34 Correct 13 ms 876 KB Output is correct
35 Correct 14 ms 864 KB Output is correct
36 Correct 9 ms 972 KB Output is correct
37 Correct 10 ms 972 KB Output is correct
38 Incorrect 8 ms 4664 KB WA in grader: Too many inputs
39 Halted 0 ms 0 KB -