Submission #211878

# Submission time Handle Problem Language Result Execution time Memory
211878 2020-03-21T15:05:16 Z MarcoMeijer Vision Program (IOI19_vision) C++14
0 / 100
25 ms 2408 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MX=500;

int h, w, k;

int getPos(int x, int y) {
	return x+y*w;
}
void construct_network(int H, int W, int K) {
	h=H, w=W, k=K;
	vi diagonal[2];
	vi diagonalXOR[2];
	int dist[2][MX];
	vi ans;
	RE(i,w+h-1) {
		int x=i, y=0;
		if(x>=w) {
			y=x-w+1;
			x=w-1;
		}
		vi f;
		while(x>=0 && y<h) {
			f.pb(getPos(x,y));
			x--;
			y++;
		}
		diagonal[0].pb(add_or(f));
		diagonalXOR[0].pb(add_xor(f));
	}
	RE(i,w+h-1) {
		int x=0, y=h-i-1;
		if(y<0) {
			x=-y;
			y=0;
		}
		vi f;
		while(x<w && y<h) {
			f.pb(getPos(x,y));
			x++;
			y++;
		}
		diagonal[1].pb(add_or(f));
		diagonalXOR[1].pb(add_xor(f));
	}
	RE(i,2) RE(j,k+1) {
		vi f;
		if(j == 0) {
			vi g;
			RE(l,diagonal[i].size())
				g.pb(diagonal[i][l]);
			dist[i][j] = add_xor(g);
		} else {
			RE(l,diagonal[i].size()-j) {
				vi g;
				g.pb(diagonal[i][l]);
				g.pb(diagonal[i][l+j]);
				f.pb(add_and(g));
			}
			dist[i][j] = add_or(f);
		}
	}
	RE(i,2) {
		vi f;
		vi distK;
		RE(j,diagonal[i].size()-k) {
			vi g;
			g.pb(diagonal[i][j]);
			g.pb(diagonal[i][j+k]);
			distK.pb(add_and(g));
		}
		f.pb(add_or(distK));
		vi distLessK;
		RE(j,diagonalXOR[!i].size()) distLessK.pb(diagonalXOR[!i][j]);
		RE(j,diagonal[!i].size()-k) {
			vi g;
			RE(l,k+1) {
				g.pb(diagonal[!i][j+l]);
			}
			int ad=add_xor(g);
			f.pb(add_not(ad));
		}
		f.pb(add_or(distLessK));
		ans.pb(add_and(f));
	}
	add_or(ans);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:35:6: warning: variable 'dist' set but not used [-Wunused-but-set-variable]
  int dist[2][MX];
      ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 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 5 ms 256 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 5 ms 256 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 5 ms 256 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 6 ms 512 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 5 ms 256 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 25 ms 2408 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -