Submission #569288

# Submission time Handle Problem Language Result Execution time Memory
569288 2022-05-27T08:58:46 Z pavement Vision Program (IOI19_vision) C++17
58 / 100
760 ms 1168 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;
	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++;
	}
	
	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:94:7: warning: unused variable 'ocnt' [-Wunused-variable]
   94 |   int ocnt = cnt, tmpp = 0;
      |       ^~~~
vision.cpp:94:19: warning: unused variable 'tmpp' [-Wunused-variable]
   94 |   int ocnt = cnt, tmpp = 0;
      |                   ^~~~
# 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 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
10 Correct 1 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 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
10 Correct 1 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 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 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 0 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 328 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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
10 Correct 1 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 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 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 0 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 328 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 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 0 ms 212 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 4 ms 340 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 3 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 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
10 Correct 1 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 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 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 0 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 328 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 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 0 ms 212 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 4 ms 340 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 3 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 64 ms 1044 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 16 ms 340 KB Output is correct
42 Correct 35 ms 276 KB Output is correct
43 Correct 52 ms 408 KB Output is correct
44 Correct 73 ms 1056 KB Output is correct
45 Incorrect 53 ms 1168 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 0 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 1 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 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 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 1 ms 212 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Correct 10 ms 556 KB Output is correct
5 Correct 10 ms 596 KB Output is correct
6 Correct 7 ms 468 KB Output is correct
7 Correct 11 ms 304 KB Output is correct
8 Correct 19 ms 428 KB Output is correct
9 Correct 26 ms 936 KB Output is correct
10 Correct 21 ms 724 KB Output is correct
11 Correct 17 ms 556 KB Output is correct
12 Correct 34 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 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 199 ms 620 KB Output is correct
21 Incorrect 205 ms 1168 KB WA in grader: Too many instructions
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 701 ms 1048 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 8 ms 340 KB Output is correct
4 Correct 19 ms 420 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 274 ms 676 KB Output is correct
8 Correct 163 ms 668 KB Output is correct
9 Correct 760 ms 1060 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 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 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
10 Correct 1 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 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 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 0 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 328 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 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 0 ms 212 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 4 ms 340 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 3 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 64 ms 1044 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 16 ms 340 KB Output is correct
42 Correct 35 ms 276 KB Output is correct
43 Correct 52 ms 408 KB Output is correct
44 Correct 73 ms 1056 KB Output is correct
45 Incorrect 53 ms 1168 KB WA in grader: Too many instructions
46 Halted 0 ms 0 KB -