답안 #430987

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430987 2021-06-17T08:45:05 Z _fractal Vision Program (IOI19_vision) C++14
58 / 100
12 ms 1220 KB
#include "vision.h"
#include <iostream>
using namespace std;

const int dx[] = {+1, +1};
const int dy[] = {+1, -1};


void construct_network(int H, int W, int K) {
	int sz = H * W, cur = H * W - 1;
	vector<int> ask, ksa, is(K + 1, 0), si(K + 1, 0);
	if (H > 1 && W > 1) {
		vector<int> kek[K + 1], lol[K + 1];
		for (int i = 0; i < H; ++i) {
			ask.clear();
			for (int j = 0; j < W; ++j)
				ask.push_back(i * W + j);
			add_or(ask);
		}
		for (int j = 0; j < W; ++j) {
			ask.clear();
			for (int i = 0; i < H; ++i)
				ask.push_back(i * W + j);
			add_or(ask);
		}
		sz = H * W, cur = H * W + H + W - 1;
		ask.clear();
		for (int i = 0; i < H; ++i) {
			ask.push_back(sz + i);
			for (int j = 1; i + j < H && j <= K; ++j) {
				add_and({sz + i, sz + i + j});
				cur++;
				kek[j].push_back(cur);
			}
		}
		add_xor(ask);
		cur++;
		kek[0].push_back(cur);
		sz = H * W + H;
		ask.clear();
		for (int i = 0; i < W; ++i) {
			ask.push_back(sz + i);
			for (int j = 1; i + j < W && j <= K; ++j) {
				add_and({sz + i, sz + i + j});
				cur++;
				lol[j].push_back(cur);
			}
		}
		add_xor(ask);
		cur++;
		lol[0].push_back(cur);
		for (int i = 0; i <= K; ++i) {
			if (kek[i].empty())
				add_xor({0, 0});
			else
				add_or(kek[i]);
			cur++;
			is[i] = cur;
		}
		for (int i = 0; i <= K; ++i) {
			if (lol[i].empty())
				add_xor({0, 0});
			else
				add_or(lol[i]);
			cur++;
			si[i] = cur;
		}
		ask.clear();
		for (int i = 0; i <= K; ++i) {
			add_and({is[i], si[K - i]});
			cur++;
			ask.push_back(cur);
		}
		add_or(ask);
		return;
	}
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			for (int k = 0; k <= K; ++k) {
				for (int x = 0; x < 2; ++x) {
					if (i + dx[x] * k >= H || i + dx[x] * k < 0 ||
						j + dy[x] * (K - k) >= W || j + dy[x] * (K - k) < 0)
						continue;
					ask.push_back(sz);
					sz++;
					int a = i * W + j;
					int b = (i + dx[x] * k) * W + j + dy[x] * (K - k);
					add_and({a, b});
				}
			}
		}
	}
	add_or(ask);
	return;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 416 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 256 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 2 ms 332 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 416 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 256 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 2 ms 332 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 2 ms 332 KB Output is correct
38 Correct 8 ms 1096 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 3 ms 436 KB Output is correct
42 Correct 6 ms 968 KB Output is correct
43 Correct 3 ms 460 KB Output is correct
44 Correct 10 ms 1124 KB Output is correct
45 Incorrect 2 ms 1184 KB WA in grader: Too many instructions
46 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 244 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 248 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 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 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 7 ms 716 KB Output is correct
6 Correct 6 ms 840 KB Output is correct
7 Correct 5 ms 840 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 6 ms 968 KB Output is correct
10 Correct 10 ms 1220 KB Output is correct
11 Incorrect 2 ms 1096 KB WA in grader: Too many instructions
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1100 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 5 ms 716 KB Output is correct
8 Correct 5 ms 716 KB Output is correct
9 Correct 10 ms 1016 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 416 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 256 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 2 ms 332 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 2 ms 332 KB Output is correct
38 Correct 8 ms 1096 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 3 ms 436 KB Output is correct
42 Correct 6 ms 968 KB Output is correct
43 Correct 3 ms 460 KB Output is correct
44 Correct 10 ms 1124 KB Output is correct
45 Incorrect 2 ms 1184 KB WA in grader: Too many instructions
46 Halted 0 ms 0 KB -