Submission #830267

# Submission time Handle Problem Language Result Execution time Memory
830267 2023-08-19T02:05:27 Z pavement Vision Program (IOI19_vision) C++17
0 / 100
3 ms 1360 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

void construct_network(int H, int W, int K) {
	auto conv = [&](int r, int c) {
		return r * W + c;
	};
	vector<int> row(H), col(W), fin_row(H), fin_col(W);
	vector<vector<int> > rows(H), cols(W);
	int ins = H * W;
	for (int i = 0; i < H; i++) {
		vector<int> cur;
		for (int j = 0; j < W; j++) {
			cur.pb(conv(i, j));
		}
		add_or(cur);
		row[i] = ins++;
	}
	for (int i = 0; i < W; i++) {
		vector<int> cur;
		for (int j = 0; j < H; j++) {
			cur.pb(conv(j, i));
		}
		add_or(cur);
		col[i] = ins++;
	}
	for (int i = 0; i < H; i++) {
		for (int j = i + 1; j < H; j++) {
			add_and({row[i], row[j]});
			rows[j - i].pb(ins++);
		}
	}
	{
		vector<int> tmp;
		for (int i = 1; i < H; i++) {
			add_or(rows[i]);
			fin_row[i] = ins++;
			tmp.pb(fin_row[i]);
		}
		if (tmp.empty()) {
			tmp.resize(H * W);
			iota(tmp.begin(), tmp.end(), 0);
		}
		add_or(tmp);
		add_not({ins});
		ins += 2;
		fin_row[0] = ins - 1;
	}
	for (int i = 0; i < W; i++) {
		for (int j = i + 1; j < W; j++) {
			add_and({col[i], col[j]});
			cols[j - i].pb(ins++);
		}
	}
	{
		vector<int> tmp;
		for (int i = 1; i < W; i++) {
			add_or(cols[i]);
			fin_col[i] = ins++;
			tmp.pb(fin_col[i]);
		}
		if (tmp.empty()) {
			tmp.resize(H * W);
			iota(tmp.begin(), tmp.end(), 0);
		}
		add_or(tmp);
		add_not({ins});
		ins += 2;
		fin_col[0] = ins - 1;
	}
	vector<int> fin;
	for (int i = 0; i <= K; i++) {
		int j = K - i;
		if (0 <= i && i < H && 0 <= j && j < W) {
			add_and({fin_row[i], fin_col[j]});
			fin.pb(ins);
			ins++;
		}
	}
	add_or(fin);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1104 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 848 KB Output is correct
4 Correct 3 ms 848 KB Output is correct
5 Correct 3 ms 848 KB Output is correct
6 Correct 3 ms 848 KB Output is correct
7 Correct 3 ms 808 KB Output is correct
8 Incorrect 1 ms 1104 KB WA in grader: Too many instructions
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1360 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -