Submission #442156

# Submission time Handle Problem Language Result Execution time Memory
442156 2021-07-07T08:36:58 Z peijar Vision Program (IOI19_vision) C++17
46 / 100
39 ms 3552 KB
#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 = 1; 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);
  }

  // 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);

  int maxDeltaCol = min(nbCol - 1, K);
  vector<int> avecDeltaCol(maxDeltaCol + 1);
  for (int deltaCol = 1; 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> 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);
  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);*/
}
# 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 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 1 ms 204 KB Output is correct
18 Correct 0 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 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 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 296 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 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 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 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 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 296 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 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 204 KB Output is correct
28 Correct 6 ms 812 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 460 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 7 ms 716 KB Output is correct
35 Correct 8 ms 844 KB Output is correct
36 Correct 9 ms 844 KB Output is correct
37 Correct 8 ms 844 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 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 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 296 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 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 204 KB Output is correct
28 Correct 6 ms 812 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 460 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 7 ms 716 KB Output is correct
35 Correct 8 ms 844 KB Output is correct
36 Correct 9 ms 844 KB Output is correct
37 Correct 8 ms 844 KB Output is correct
38 Incorrect 8 ms 3352 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 2 ms 968 KB WA in grader: Too many instructions
3 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 4 ms 460 KB Output is correct
4 Correct 34 ms 2964 KB Output is correct
5 Incorrect 4 ms 1568 KB WA in grader: Too many instructions
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 3552 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 6 ms 716 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 416 KB Output is correct
7 Correct 19 ms 1856 KB Output is correct
8 Correct 19 ms 1928 KB Output is correct
9 Correct 36 ms 3524 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 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 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 296 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 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 204 KB Output is correct
28 Correct 6 ms 812 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 460 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 7 ms 716 KB Output is correct
35 Correct 8 ms 844 KB Output is correct
36 Correct 9 ms 844 KB Output is correct
37 Correct 8 ms 844 KB Output is correct
38 Incorrect 8 ms 3352 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -