Submission #283127

# Submission time Handle Problem Language Result Execution time Memory
283127 2020-08-25T10:17:46 Z aymanrs Vision Program (IOI19_vision) C++14
33 / 100
78 ms 10232 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, forbidden = -1;
	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)*W + j+x});
					ind++;
				}
				y=-y;
				if(valid(H, W, i+y, j+x, i, j)){
					add_and({i*W+j, (i+y)*W + j+x});
					ind++;
				}
			}
			if(valid(H, W, i, j+K, i, j)){
				add_and({i*W+j, i*W + j+K});
				ind++;
			}
			if(valid(H, W, i, j-K, i, j)){
				add_and({i*W+j, i*W + j-K});
				ind++;
			}
			if(i == 0 && j == 0){
				std::vector<int> vec;
				for(int i = H*W;i < ind;i++){
					vec.push_back(i);
				}
				if(!vec.empty()){
					forbidden = ind;
					add_or(vec);
					ind++;
				}
			}
		}
	}
	std::vector<int> vec;
	for(int i = H*W;i < ind;i++){
		if(i != forbidden) vec.push_back(i);
	}
	add_or(vec);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 368 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 376 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 368 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 376 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 512 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 2 ms 512 KB Output is correct
26 Correct 2 ms 640 KB Output is correct
27 Correct 3 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 368 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 376 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 512 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 2 ms 512 KB Output is correct
26 Correct 2 ms 640 KB Output is correct
27 Correct 3 ms 768 KB Output is correct
28 Incorrect 10 ms 2300 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 368 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 376 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 512 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 2 ms 512 KB Output is correct
26 Correct 2 ms 640 KB Output is correct
27 Correct 3 ms 768 KB Output is correct
28 Incorrect 10 ms 2300 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 29 ms 5248 KB Output is correct
3 Correct 29 ms 5248 KB Output is correct
4 Correct 78 ms 10232 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 21 ms 3584 KB Output is correct
7 Correct 46 ms 7032 KB Output is correct
8 Correct 69 ms 10160 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 13 ms 2816 KB Output is correct
11 Correct 28 ms 5216 KB Output is correct
12 Correct 28 ms 5376 KB Output is correct
13 Correct 47 ms 7800 KB Output is correct
14 Correct 61 ms 10232 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 15 ms 2816 KB Output is correct
17 Correct 31 ms 5248 KB Output is correct
18 Correct 32 ms 5368 KB Output is correct
19 Correct 50 ms 7800 KB Output is correct
20 Correct 73 ms 10232 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 8 ms 1276 KB Output is correct
4 Incorrect 18 ms 3576 KB WA in grader: Too many instructions
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1660 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 368 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 376 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 512 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 512 KB Output is correct
25 Correct 2 ms 512 KB Output is correct
26 Correct 2 ms 640 KB Output is correct
27 Correct 3 ms 768 KB Output is correct
28 Incorrect 10 ms 2300 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -