Submission #1071269

# Submission time Handle Problem Language Result Execution time Memory
1071269 2024-08-23T06:26:45 Z Gromp15 Vision Program (IOI19_vision) C++17
0 / 100
14 ms 2648 KB
#include "vision.h"
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;
template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
void construct_network(int H, int W, int K) {
	if (K == 1) {
		int idx = -1;
		for (int i = 0; i < H; i++) {
			vector<int> cur;
			for (int j = 0; j < W; j++) {
				cur.push_back(i*W+j);
			}
			if (idx == -1) idx = add_or(cur);
			else idx = add_xor({idx, add_or(cur)});
		}
		for (int i = 0; i < W; i++) {
			vector<int> cur;
			for (int j = 0; j < H; j++) {
				cur.push_back(j*W+i);
			}
			assert(~idx);
			idx = add_xor({idx, add_or(cur)});
		}
		int idx2 = -1;
		for (int i = 0; i < H-1; i++) {
			vector<int> cur;
			for (int j = 0; j < W; j++) {
				cur.push_back(i*W+j);
				cur.push_back((i+1)*W+j);
			}
			if (idx2 == -1) idx2 = add_or(cur);
			else idx2 = add_or({idx2, add_or(cur)});
		}
		for (int i = 0; i < W-1; i++) {
			vector<int> cur;
			for (int j = 0; j < H; j++) {
				cur.push_back(j*W+i);
				cur.push_back(j*W+i+1);
			}
			if (idx2 == -1) idx2 = add_or(cur);
			else idx2 = add_or({idx2, add_or(cur)});
		}
		assert(~idx);
		assert(~idx2);
		add_and({idx, idx2});
		return;
	}
	vector<int> res;
	if ((H <= 30 && W <= 30) || min(H, W) == 1) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				vector<int> cur;
				for (int k = 0; k < H; k++) {
					for (int l = 0; l < W; l++) {
						if (abs(k - i) + abs(j - l) == K) {
							cur.emplace_back(k*W+l);
						}
					}
				}
				if (cur.size()) {
					int idx = add_or(cur);
					res.emplace_back(add_and({i*W+j, idx}));
				}
			}
		}
	}
	else {
		vector<int> cur;
		for (int k = 0; k < H; k++) {
			for (int l = 0; l < W; l++) {
				if (k + l == K) {
					cur.emplace_back(k*W+l);
				}
			}
		}
		if (cur.size()) {
			int idx = add_or(cur);
			res.emplace_back(add_and({0, idx}));
		}
	}
	add_or(res);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 604 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 2648 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 2 ms 600 KB on inputs (48, 2), (50, 2), expected 0, but computed 1
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -