Submission #290941

# Submission time Handle Problem Language Result Execution time Memory
290941 2020-09-04T14:55:11 Z Haunted_Cpp Vision Program (IOI19_vision) C++17
58 / 100
22 ms 2176 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

const int MAX_N = 200 + 5;

int g[MAX_N][MAX_N];



void construct_network(int H, int W, int K) {
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      g[i][j] = i * W + j;
    }
  }
  vector<int> linha;
  vector<int> coluna;
  for (int i = 0; i < H; i++) {
    vector<int> ask;
    for (int j = 0; j < W; j++) {
      ask.emplace_back(g[i][j]);
    }
    linha.emplace_back(add_or(ask));
  }
  for (int j = 0; j < W; j++) {
    vector<int> ask;
    for (int i = 0; i < H; i++) {
      ask.emplace_back(g[i][j]);
    }
    coluna.emplace_back(add_or(ask));
  }
  vector<int> ans;
  for (int diff_linha = 1; diff_linha <= K; diff_linha++) {
    for (int diff_coluna = 1; diff_coluna + diff_linha <= K; diff_coluna++) {
      if (diff_linha + diff_coluna != K) continue;
      for (int i = 0; i + diff_linha < H; i++) {
        for (int j = 0; j + diff_coluna < W; j++) {
          ans.emplace_back(add_and({linha[i], linha[i + diff_linha], coluna[j], coluna[j + diff_coluna]}));
        }
      }
    }
  }
  
  // Same Row
  if (K < W) {
    vector<int> same_line;
    vector<int> col;
    for (int i = 0; i < H; i++) {
      vector<int> ask;
      for (int j = 0; j < W; j++) {
        ask.emplace_back(g[i][j]);
      }
      
      int A = add_xor(ask);
      int B = add_not(A);
      
      int C = linha[i];
      same_line.emplace_back(add_and({B, C}));
    }
    for (int j = 0; j + K < W; j++) {
      col.emplace_back(add_and({coluna[j], coluna[j + K]}) );
    }
    // HAS TO BE ONE
    int chk_xor = add_or(same_line);
    // HAS TO BE ONE
    int chk_col = add_or(col); 
    // MERGE BOTH
    ans.emplace_back(add_and({chk_col, chk_xor}));
  }
  // Same Col
  if (K < H) {
    vector<int> same_col;
    vector<int> lin;
    
    for (int j = 0; j < W; j++) {
      vector<int> ask;
      for (int i = 0; i < H; i++) {
        ask.emplace_back(g[i][j]);
      }
      int A = add_xor(ask);
      int B = add_not(A);
      int C = coluna[j];
      same_col.emplace_back(add_and({B, C}));
    }
    for (int j = 0; j + K < H; j++) {
      lin.emplace_back(add_and({linha[j], linha[j + K]}));
    }
    // HAS TO BE ONE
    int chk_xor = add_or(same_col);
    // HAS TO BE ONE
    int chk_lin = add_or(lin); 
    // MERGE BOTH
    ans.emplace_back(add_and({chk_xor, chk_lin}));
  }
    
  add_or(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 8 ms 1020 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 0 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 9 ms 1020 KB Output is correct
35 Correct 6 ms 892 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 8 ms 1020 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 0 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 9 ms 1020 KB Output is correct
35 Correct 6 ms 892 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
38 Incorrect 2 ms 1276 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 512 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 512 KB Output is correct
16 Correct 1 ms 512 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 1 ms 512 KB Output is correct
19 Correct 1 ms 512 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 0 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Incorrect 3 ms 1276 KB WA in grader: Too many instructions
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 2176 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 6 ms 632 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 12 ms 1304 KB Output is correct
8 Correct 11 ms 1280 KB Output is correct
9 Correct 22 ms 2176 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
25 Correct 1 ms 416 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 8 ms 1020 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 0 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 9 ms 1020 KB Output is correct
35 Correct 6 ms 892 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
38 Incorrect 2 ms 1276 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -