Submission #425184

# Submission time Handle Problem Language Result Execution time Memory
425184 2021-06-12T14:45:54 Z daanolav Vision Program (IOI19_vision) C++14
0 / 100
29 ms 7848 KB
#include "vision.h"
 
 
using namespace std;
 
typedef vector<int> vi;
 
 
int x,y,k,xOffset,yOffset,a,b,c;
 
void construct_network(int H, int W, int _K) {
	std::vector<int> Ns;
 
	vi kSizeIndexes[W][H];
	vi kPlusOneSizeIndexes[W][H];
 
	k = (_K + 1) / 2;
 
	for(x = 0; x < W; ++x) {
        for(y = 0; y < H; ++y) {
            for(xOffset = -k - 1; xOffset <= k + 1; ++xOffset) {
                if(x + xOffset < 0 || x + xOffset >= W) {
                    continue;
                }
                for(yOffset = -k - 1; yOffset <= k + 1; ++yOffset) {
                    if(y + yOffset < 0 || y + yOffset >= H) {
                        continue;
                    }
                    if(abs(xOffset) + abs(yOffset) <= k) {
                        kSizeIndexes[x][y].push_back((y + yOffset) * W + x + xOffset);
 
                    }
                    if(min(abs(xOffset - 1),abs(xOffset)) + abs(yOffset) <= k || (xOffset == 0 && yOffset == k + 1)) {
                        kPlusOneSizeIndexes[x][y].push_back((y + yOffset) * W + x + xOffset);
 
                    }
                }
            }
        }
	}
 
	vi shouldAllBeOn;
	vi shouldBeOn;
 
	if(k == _K * 2) {
        for(x = 0; x < W; ++x) {
            for(y = 0; y < H; ++y) {
                a = add_or(kSizeIndexes[x][y]);
                b = add_not(a);
                c = add_xor(kSizeIndexes[x][y]);
                Ns = {b,c};
                shouldAllBeOn.push_back(add_or(Ns));
 
                a = add_or(kPlusOneSizeIndexes[x][y]);
                b = add_xor(kPlusOneSizeIndexes[x][y]);
                c = add_not(b);
                Ns = {b,c};
                shouldBeOn.push_back(add_and(Ns));
            }
        }
	} else {
        for(x = 0; x < W; ++x) {
            for(y = 0; y < H; ++y) {
                a = add_or(kPlusOneSizeIndexes[x][y]);
                b = add_not(a);
                c = add_xor(kPlusOneSizeIndexes[x][y]);
                Ns = {b,c};
                shouldAllBeOn.push_back(add_or(Ns));
 
                a = add_or(kSizeIndexes[x][y]);
                b = add_xor(kSizeIndexes[x][y]);
                c = add_not(b);
                Ns = {b,c};
                shouldBeOn.push_back(add_and(Ns));
            }
        }
	}
 
	a = add_and(shouldAllBeOn);
	b = add_or(shouldBeOn);
	Ns = {a,b};
	add_and(Ns);
 
 
 
 
 
	return;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 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 204 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 204 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 204 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 332 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 204 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 29 ms 7848 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -