Submission #283116

# Submission time Handle Problem Language Result Execution time Memory
283116 2020-08-25T10:09:28 Z aymanrs Vision Program (IOI19_vision) C++14
0 / 100
7 ms 1788 KB
#include <iostream>
#include <set>
#include <vector>
#include "vision.h"
std::set<std::pair<std::pair<int,int>, std::pair<int, int>>> alreadyTried;
bool valid(int H, int W, int i, int j, int oI, int oJ){
	if(oI < i || (oI == i && oJ < j)){
		if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){
			return false;
		} else {
			alreadyTried.insert({{oI, oJ}, {i, j}});
		}
	}  else {
		if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){
			return false;
		} else {
			alreadyTried.insert({{i, j}, {oI, oJ}});
		}
	}
	return i >= 0 && i < H && j >= 0 && j < W;
}
void construct_network(int H, int W, int K){
	int ind = H*W;
	for(int i = 0;i < H;i++){
		for(int j = 0;j < W;j++){
			for(int x = -K + 1; x < K;x++){
				int y = K - abs(x);
				if(valid(H, W, i+y, j+x, i, j)){
					add_and({i*W+j, (i+y)*H + (j+x)*W});
					ind++;
				}
				y=-y;
				if(valid(H, W, i+y, j+x, i, j)){
					add_and({i*W+j, (i+y)*H + (j+x)*W});
					ind++;
				}
			}
			if(valid(H, W, i, j+K, i, j)){
				add_and({i*W+j, i*H + (j+K)*W});
				ind++;
			}
			if(valid(H, W, i, j-K, i, j)){
				add_and({i*W+j, i*H + (j-K)*W});
				ind++;
			}
		}
	}
	std::vector<int> vec;
	for(int i = H*W;i < ind;i++){
		vec.push_back(i);
	}
	add_or(vec);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 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 7 ms 1788 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -