Submission #431429

# Submission time Handle Problem Language Result Execution time Memory
431429 2021-06-17T11:52:09 Z pure_mem Vision Program (IOI19_vision) C++14
0 / 100
3 ms 1480 KB
#include "vision.h"
#include <bits/stdc++.h>

#define X first
#define Y second
#define MP make_pair
#define ll long long

using namespace std;

void construct_network(int H, int W, int K) {
	int ptr = H * W;
	vector< int > rowIs(H), colIs(W), rowDist(H), colDist(W);
	vector< vector<int> > rowInfo(H), colInfo(W);
	
	for(int i = 0;i < H;i++){
		vector< int > tmp;
		for(int j = 0;j < W;j++){
			tmp.push_back(H * i + j);
		}
		add_or(tmp), rowIs[i] = ptr++;
	}
	for(int j = 0;j < W;j++){
		vector< int > tmp;
		for(int i = 0;i < H;i++){
			tmp.push_back(H * i + j);
		}
		add_or(tmp), colIs[j] = ptr++;
	}

	for(int i1 = 0;i1 < H;i1++){
		for(int i2 = i1;i2 < H;i2++){
			if(i1 == i2){
				vector< int > tmp;
				for(int i = 0;i < H;i++){
					tmp.push_back(rowIs[i]);
				}
				add_xor(tmp);
			}
			else{
				add_and({rowIs[i1], rowIs[i2]});
			}
			rowInfo[i2 - i1].push_back(ptr++);
		}
	}
	for(int i1 = 0;i1 < W;i1++){
		for(int i2 = i1;i2 < W;i2++){
			if(i1 == i2){
				vector< int > tmp;
				for(int i = 0;i < W;i++){
					tmp.push_back(colIs[i]);
				}
				add_xor(tmp);
			}
			else{
				add_and({colIs[i1], colIs[i2]});
			}
			colInfo[i2 - i1].push_back(ptr++);
		}
	}
	for(int i = 0;i < H;i++){
		add_or(rowInfo[i]);
		rowDist[i] = ptr++;
	}
	for(int i = 0;i < W;i++){
		add_or(colInfo[i]);
		colDist[i] = ptr++;
	}
	vector< int > fin;
	for(int i = 0;i < H;i++){
		for(int j = 0;j < W;j++){
			if(i + j == K){
				add_and({rowDist[i], colDist[j]});
				fin.push_back(ptr++);
			}
		}
	}
	add_or(fin);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB WA in grader: Invalid index
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB WA in grader: Invalid index
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB WA in grader: Invalid index
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB WA in grader: Invalid index
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1136 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB WA in grader: Invalid index
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1480 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB WA in grader: Invalid index
4 Halted 0 ms 0 KB -