Submission #292766

# Submission time Handle Problem Language Result Execution time Memory
292766 2020-09-07T13:08:30 Z miss_robot Vision Program (IOI19_vision) C++14
55 / 100
31 ms 2808 KB
#include <bits/stdc++.h>
#include "vision.h"

#pragma GCC optimize("O3")

using namespace std;

int ab(int a, int b, int W){
	int x = a/W, X = b/W, y = a%W, Y = b%W;
	if(x > X) swap(x, X);
	if(y > Y) swap(y, Y);
	return X-x+Y-y;
}

void st1(int H, int W, int K){
	int c = 0;
	for(int a = 0; a < H*W; a++)
		for(int b = a+1; b < H*W; b++)
			if(ab(a, b, W) == K) add_and({a, b}), c++;
	vector<int> x;
	for(int i = H*W; i < H*W+c; i++) x.push_back(i);
	add_or(x);
}

void st6(int H, int W, int K){
	int c = 0;
	for(int i = 1; i < H*W; i++)
		if(ab(0, i, W) == K) add_and({i}), c++;
	vector<int> x;
	for(int i = H*W; i < H*W+c; i++) x.push_back(i);
	add_or(x);
}

void st7(int H, int W){
	int t1, t2;
	vector<int> f_ask;
	for(int i = 0; i < H-1; i++){
		vector<int> x, y;
		for(int j = 0; j < W; j++)
			x.push_back(i*W+j),
				y.push_back((i+1)*W+j);
		int ind1 = add_or(x), ind2 = add_or(y);
		f_ask.push_back(add_and({ind1, ind2}));
	}
	int tmp1 = add_or(f_ask), tmp2;
	f_ask.clear();
	for(int j = 0; j < W; j++){
		vector<int> x;
		for(int i = 0; i < H; i++) x.push_back(i*W+j);
		f_ask.push_back(add_xor(x));
	}
	tmp2 = add_or(f_ask);
	tmp2 = add_not(tmp2);
	t1 = add_and({tmp1, tmp2});
	f_ask.clear();
	for(int j = 0; j < W-1; j++){
		vector<int> x, y;
		for(int i = 0; i < H; i++)
			x.push_back(i*W+j),
				y.push_back(i*W+j+1);
		int ind1 = add_or(x), ind2 = add_or(y);
		f_ask.push_back(add_and({ind1, ind2}));
	}
	tmp1 = add_or(f_ask);
	f_ask.clear();
	for(int i = 0; i < H; i++){
		vector<int> x;
		for(int j = 0; j < W; j++) x.push_back(i*W+j);
		f_ask.push_back(add_xor(x));
	}
	tmp2 = add_or(f_ask);
	tmp2 = add_not(tmp2);
	t2 = add_and({tmp1, tmp2});
	add_or({t1, t2});
}

void construct_network(int H, int W, int K) {
	if((H <= 10 && W <= 10) || (H == 1 || W == 1)) st1(H, W, K);
	else if(K == 1) st7(H, W);
	else st6(H, W, K);
}
# 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 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 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 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 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 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 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 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 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 256 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 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 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 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 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 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 256 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Incorrect 1 ms 256 KB on inputs (3, 13), (11, 6), expected 1, but computed 0
29 Halted 0 ms 0 KB -
# 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 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 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 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 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 256 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Incorrect 1 ms 256 KB on inputs (3, 13), (11, 6), expected 1, but computed 0
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 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 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 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 1 ms 256 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 0 ms 256 KB Output is correct
22 Correct 0 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 3 ms 512 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 5 ms 640 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 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 1 ms 256 KB Output is correct
20 Correct 15 ms 1536 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 17 ms 1536 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 31 ms 2752 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 1 ms 256 KB Output is correct
31 Correct 1 ms 256 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2808 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 5 ms 640 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 15 ms 1536 KB Output is correct
8 Correct 17 ms 1536 KB Output is correct
9 Correct 29 ms 2808 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 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 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 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 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 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 256 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Incorrect 1 ms 256 KB on inputs (3, 13), (11, 6), expected 1, but computed 0
29 Halted 0 ms 0 KB -