Submission #723823

# Submission time Handle Problem Language Result Execution time Memory
723823 2023-04-14T10:47:01 Z GrandTiger1729 Vision Program (IOI19_vision) C++17
0 / 100
2 ms 808 KB
#include "vision.h"
#ifndef EVAL
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
using namespace std;

void construct_network(int n, int m, int K){
	vector<int> res(n);
	auto idx = [&](int i, int j) -> int {
		return i * m + j;
	};
	auto make = [&](int i, int l, int r) -> vector<int> {
		vector<int> ret;
		for (int j = l; j < r; j++)
			ret.push_back(idx(i, j));
		return ret;
	};
	for (int i = 0; i < n; i++)
		res[i] = add_or(make(i, 0, m));
	vector<int> row;
	for (int i = 0; i < n; i++)
		if (res[i] > 0)
			row.push_back(i);
	function<int(int, int, int)> search = [&](int i, int l, int r) -> int {
		l--, r--;
		while (l < r - 1){
			int mid = (l + r + 1) / 2;
			if (mid - l > 1 && add_or(make(i, l + 1, mid)) == 0)
				l = mid;
			else
				r = mid;
		}
		return r;
	};
	vector<int> col(2);
	auto check = [&](){
		for (int i = 0; i < 2; i++)
			assert(add_or({idx(row[i], col[i])}) == 1);

		if (abs(row[0] - row[1]) + abs(col[0] - col[1]) == K)
			add_or({idx(row[0], col[0])});
		else
			add_not(idx(row[0], col[0]));
	};
	if (row.size() == 2){
		for (int i = 0; i < 2; i++)
			col[i] = search(row[i], 0, m);
		check();
	}else{
		row.push_back(row[0]);
		col[0] = search(row[0], 0, m);
		col[1] = search(row[0], col[0] + 1, m);
		check();
	}
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 808 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -