Submission #569289

# Submission time Handle Problem Language Result Execution time Memory
569289 2022-05-27T09:01:24 Z pavement Vision Program (IOI19_vision) C++17
58 / 100
684 ms 1172 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

int or_row[205], or_col[205], can_row[205], can_col[205];

void construct_network(int H, int W, int K) {
	int ops = 0;
	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++)
			for (int k = i + 1; k < H; k++)
				for (int l = 0; l < W; l++)
					if (abs(i - k) + abs(j - l) == K) {
						vector<int> tmp = {i * W + j, k * W + l};
						ops++;
						//add_and(tmp);
					}
	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++)
			for (int k = i; k <= i; k++)
				for (int l = j + 1; l < W; l++)
					if (abs(i - k) + abs(j - l) == K) {
						vector<int> tmp = {i * W + j, k * W + l};
						ops++;
						//add_and(tmp);
					}
	if (2 * ops <= 10000) {
		ops = 0;
		for (int i = 0; i < H; i++)
			for (int j = 0; j < W; j++)
				for (int k = i + 1; k < H; k++)
					for (int l = 0; l < W; l++)
						if (abs(i - k) + abs(j - l) == K) {
							vector<int> tmp = {i * W + j, k * W + l};
							ops++;
							add_and(tmp);
						}
		for (int i = 0; i < H; i++)
			for (int j = 0; j < W; j++)
				for (int k = i; k <= i; k++)
					for (int l = j + 1; l < W; l++)
						if (abs(i - k) + abs(j - l) == K) {
							vector<int> tmp = {i * W + j, k * W + l};
							ops++;
							add_and(tmp);
						}
		vector<int> tmp;
		for (int i = 0; i < ops; i++)
			tmp.push_back(H * W + i);
		add_or(tmp);
		return;
	}

	int cnt = H * W;
	for (int i = 0; i < H; i++) {
		vector<int> tmp;
		for (int j = 0; j < W; j++)
			tmp.pb(i * W + j);
		add_or(tmp);
		or_row[i] = cnt++;
	}
	for (int j = 0; j < W; j++) {
		vector<int> tmp;
		for (int i = 0; i < H; i++)
			tmp.pb(i * W + j);
		add_or(tmp);
		or_col[j] = cnt++;
	}
	
	for (int ver = 1; ver <= K; ver++) {
		if (ver >= H || K - ver >= W) continue;
		vector<int> tmp2;
		for (int i = 0; i + ver < H; i++) {
			vector<int> tmp = {or_row[i], or_row[i + ver]};
			add_and(tmp);
			//cout << "@ " << ver << ' ' << i << ' ' << cnt << '\n';
			tmp2.pb(cnt++);
		}
		add_or(tmp2);
		can_row[ver] = cnt++;
	}
	
	vector<int> bruh;
	
	if (K < W) {
		for (int i = 0; i < H; i++)
			bruh.pb(or_row[i]);
		add_xor(bruh);
		can_row[0] = cnt++;
	}
	
	for (int hor = 1; hor <= K; hor++) {
		if (hor >= W || K - hor >= H) continue;
		vector<int> tmp2;
		int ocnt = cnt, tmpp = 0;
		for (int i = 0; i + hor < W; i++) {
			vector<int> tmp = {or_col[i], or_col[i + hor]};
			add_and(tmp);
			//cout << "@ " << hor << ' ' << i << ' ' << cnt << '\n';
			tmp2.pb(cnt++);
		}
		add_or(tmp2);
		can_col[hor] = cnt++;
	}
	
	if (K < H) {
		bruh.clear();
		for (int i = 0; i < W; i++)
			bruh.pb(or_col[i]);
		add_xor(bruh);
		can_col[0] = cnt++;
	}
	
	//cout << "@" << cnt << " " << can_row[1] << ' ' << can_col[0] << '\n';

	vector<int> tot;
	for (int ver = 0; ver <= K; ver++) {
		int hor = K - ver;
		if (ver < H && hor < W) {
			vector<int> tmp = {can_row[ver], can_col[hor]};
			add_and(tmp);
			tot.pb(cnt++);
		}
	}
	add_or(tot);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:97:7: warning: unused variable 'ocnt' [-Wunused-variable]
   97 |   int ocnt = cnt, tmpp = 0;
      |       ^~~~
vision.cpp:97:19: warning: unused variable 'tmpp' [-Wunused-variable]
   97 |   int ocnt = cnt, tmpp = 0;
      |                   ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 404 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 404 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 68 ms 1096 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 15 ms 400 KB Output is correct
42 Correct 22 ms 212 KB Output is correct
43 Correct 49 ms 424 KB Output is correct
44 Correct 64 ms 1056 KB Output is correct
45 Incorrect 53 ms 1096 KB WA in grader: Too many instructions
46 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 0 ms 212 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 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 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 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 8 ms 340 KB Output is correct
4 Correct 10 ms 552 KB Output is correct
5 Correct 8 ms 596 KB Output is correct
6 Correct 7 ms 468 KB Output is correct
7 Correct 10 ms 296 KB Output is correct
8 Correct 17 ms 384 KB Output is correct
9 Correct 29 ms 928 KB Output is correct
10 Correct 24 ms 760 KB Output is correct
11 Correct 20 ms 544 KB Output is correct
12 Correct 31 ms 300 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 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 195 ms 676 KB Output is correct
21 Incorrect 212 ms 1172 KB WA in grader: Too many instructions
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 655 ms 1048 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 7 ms 340 KB Output is correct
4 Correct 17 ms 428 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 181 ms 660 KB Output is correct
8 Correct 172 ms 664 KB Output is correct
9 Correct 684 ms 1048 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 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 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 404 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 68 ms 1096 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 15 ms 400 KB Output is correct
42 Correct 22 ms 212 KB Output is correct
43 Correct 49 ms 424 KB Output is correct
44 Correct 64 ms 1056 KB Output is correct
45 Incorrect 53 ms 1096 KB WA in grader: Too many instructions
46 Halted 0 ms 0 KB -