Submission #835418

#TimeUsernameProblemLanguageResultExecution timeMemory
835418happypotatoVision Program (IOI19_vision)C++17
44 / 100
14 ms2892 KiB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

void construct_network(int n, int m, int k) {
	function<int(int, int)> hash = [&](int x, int y) {
		return x * m + y;
	};
	function<bool(int, int)> valid = [&](int x, int y) {
		return ((0 <= x && x < n) && (0 <= y && y < m));
	};
	
	vector<int> res;
	vector<int> fin;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			res.clear();
			if (valid(i + k, j)) res.pb(hash(i + k, j));
			if (valid(i - k, j)) res.pb(hash(i - k, j));
			if (valid(i, j + k)) res.pb(hash(i, j + k));
			if (valid(i, j - k)) res.pb(hash(i, j - k));
			for (int l = 1; l < k; l++) {
				if (valid(i + l, j + (k - l))) res.pb(hash(i + l, j + (k - l)));
				if (valid(i + l, j - (k - l))) res.pb(hash(i + l, j - (k - l)));
				if (valid(i - l, j + (k - l))) res.pb(hash(i - l, j + (k - l)));
				if (valid(i - l, j - (k - l))) res.pb(hash(i - l, j - (k - l)));
			}
			if (!res.empty()) fin.pb(add_and({hash(i, j), add_or(res)}));
		}
	}
	add_or(fin);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...