Submission #795716

# Submission time Handle Problem Language Result Execution time Memory
795716 2023-07-27T13:28:51 Z WLZ Vision Program (IOI19_vision) C++17
32 / 100
10 ms 1960 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

int h, w, k;

void construct_network(int H, int W, int K) {
  h = H; w = W; k = K;
  if (k == h + w - 2) {
    add_or({add_and({0, h * w - 1}), add_and({w - 1, (h - 1) * w})});
    return;
  }
  map<int, vector<int> > diag1, diag2;
  map<int, int> rep1, rep2;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      diag1[i - j].push_back(i * w + j);
      diag2[i + j].push_back(i * w + j);
    }
  }
  for (auto &p : diag1) rep1[p.first] = add_or(p.second);
  for (auto &p : diag2) rep2[p.first] = add_or(p.second);
  vector<int> vx(h + w - 1), vy(h + w - 1);
  for (int d = h + w - 2; d >= k; d--) {
    vector<int> v1, v2;
    for (auto &p : rep1) {
      if (p.first >= rep1.begin()->first + d) break;
      vector<int> tmp;
      for (int i = p.first; ; i += d) {
        if (!rep1.count(i)) break;
        tmp.push_back(rep1[i]);
      }
      if ((int) tmp.size() > 1) v1.push_back(add_and({add_or(tmp), add_not(add_xor(tmp))}));
    }
    vx[d] = add_or(v1);
    for (auto &p : rep2) {
      if (p.first >= rep2.begin()->first + d) break;
      vector<int> tmp;
      for (int i = p.first; ; i += d) {
        if (!rep2.count(i)) break;
        tmp.push_back(rep2[i]);
      }
      if ((int) tmp.size() > 1) v2.push_back(add_and({add_or(tmp), add_not(add_xor(tmp))}));
    }
    vy[d] = add_or(v2);
  }
  vector<int> tmp1, tmp2;
  for (int d = h + w - 2; d > k; d--) {
    tmp1.push_back(vx[d]);
    tmp2.push_back(vy[d]);
  }
  int a = add_or({add_or(tmp1), add_or(tmp2)});
  tmp1.push_back(vx[k]); tmp2.push_back(vy[k]);
  int b = add_or({add_or(tmp1), add_or(tmp2)});
  add_xor({a, b});
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 296 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 296 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 296 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 3 ms 724 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 3 ms 552 KB Output is correct
33 Correct 4 ms 904 KB Output is correct
34 Correct 4 ms 724 KB Output is correct
35 Correct 3 ms 596 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 296 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 3 ms 724 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 3 ms 552 KB Output is correct
33 Correct 4 ms 904 KB Output is correct
34 Correct 4 ms 724 KB Output is correct
35 Correct 3 ms 596 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 304 KB Output is correct
38 Incorrect 4 ms 1236 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1104 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 3 ms 1108 KB WA in grader: Too many instructions
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1960 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 296 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 3 ms 724 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 3 ms 552 KB Output is correct
33 Correct 4 ms 904 KB Output is correct
34 Correct 4 ms 724 KB Output is correct
35 Correct 3 ms 596 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 304 KB Output is correct
38 Incorrect 4 ms 1236 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -