Submission #906295

# Submission time Handle Problem Language Result Execution time Memory
906295 2024-01-13T23:41:34 Z vjudge1 Vision Program (IOI19_vision) C++17
0 / 100
4 ms 1588 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int one,zero;

vi add(vi src, int v){
	vi res;
	int cin = zero;
	rep(i,0,sz(src)){
		vi inp = {src[i], cin?one:zero};
		if(v&(1<<i)) inp.pb(one);

		res.pb(add_xor(inp));

		if(sz(inp)==3){
			vi outs = {add_and({inp[0],inp[1]}),add_and({inp[1],inp[2]}),add_and({inp[0],inp[2]})};
			cin=add_or(outs);
		}else{
			cin=add_and(inp);
		}
	}
	return res;
}

// vi negate(vi src){
// 	vi res;
// 	rep(i,0,sz(src)) res.pb(add_not(src[i]));
// 	return add(res,1);
// }

vi add(vi a, vi b){
	vi res;
	int cin = zero;
	rep(i,0,max(sz(a),sz(b))){
		vi inp = {cin?one:zero};
		if(i<sz(a)) inp.pb(a[i]);
		if(i<sz(b)) inp.pb(b[i]);

		res.pb(add_xor(inp));

		if(sz(inp)==3){
			vi outs = {add_and({inp[0],inp[1]}),add_and({inp[1],inp[2]}),add_and({inp[0],inp[2]})};
			cin=add_or(outs);
		}else{
			cin=add_and(inp);
		}
	}
	return res;
}

void construct_network(int H, int W, int K) {

	// setup
	vi allcells;
	rep(i,0,H)rep(j,0,W)allcells.pb(i*W+j);
	one = add_or(allcells);
	zero = add_not(one);

	vi counter(10,zero);

	int active = zero;
	rep(i,0,H){
		vi onrow;
		rep(j,0,W) onrow.pb(i*W+j);
		active = add_xor({active, add_xor(onrow)});
		counter = add(counter,{active});
	}

	active = zero;
	rep(j,0,W){
		vi oncol;
		rep(i,0,H) oncol.pb(i*W+j);
		active = add_xor({active, add_xor(oncol)});
		counter = add(counter,{active});
	}

	rep(i,0,sz(counter)){
		if(K&(1<<i)){
			counter[i]=add_not(counter[i]);
		}
	}

	add_not(add_or(counter));
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 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 344 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 344 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 344 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 4 ms 980 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 348 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 2 ms 1588 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -