Submission #430457

#TimeUsernameProblemLanguageResultExecution timeMemory
430457p_squareVision Program (IOI19_vision)C++14
Compilation error
0 ms0 KiB
#include <vision.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second

int h;
int w;
int k;

int cnum(int i, int j)
{
	return i*w + j;
}

void opt(vector <int> qry)
{
	for(int i = 0; i<qry.size(); i++)
	{
		cerr<<qry[i]<<" ";
	}
}

void construct_network(int H, int W, int K)
{
	h = H;
	w = W;
	k = K;

	int row, col, reply, NWd = h*w, NEd = h*w+h+w-1, cr1be, cr1en, cr1;
	vector <int> qry;
	for(int diag = 0; diag<h+w-1; diag++)
	{
		qry.clear();
		for(row = 0; row<h; row++)
		{
			col = diag - row;
			if(col >= 0 && col < w)
			{
				qry.push_back(cnum(row, col));
			}
		}
		assert(!qry.empty());
		reply = add_xor(qry);
	}
	for(int diag = 0; diag<h+w-1; diag++)
	{
		qry.clear();
		for(row = 0; row<h; row++)
		{
			col = w + row - diag - 1;
			if(col >= 0 && col < w)
			{
				cerr<<row<<" "<<col<<endl;
				qry.push_back(cnum(row, col));
			}
		}
		assert(!qry.empty());
		reply = add_xor(qry);
	}

	cr1be = reply+1;

	for(int i = 0; i<h+w-k-1; i++)
	{
		reply = add_and({NWd+i, NWd+i+k});
	}
	for(int i = 0; i<h+w-k-1; i++)
	{
		reply = add_and({NEd+i, NEd+i+k});
	}

	cr1en = reply;
	qry.clear();
	for(int i = cr1be; i<=cr1en; i++)
	{
		qry.push_back(i);
	}
	assert(!qry.empty());
	cr1 = add_or(qry);

}

Compilation message (stderr)

vision.cpp: In function 'void opt(std::vector<int>)':
vision.cpp:20:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for(int i = 0; i<qry.size(); i++)
      |                 ~^~~~~~~~~~~
vision.cpp:22:3: error: 'cerr' was not declared in this scope
   22 |   cerr<<qry[i]<<" ";
      |   ^~~~
vision.cpp:2:1: note: 'std::cerr' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include <vision.h>
  +++ |+#include <iostream>
    2 | 
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:45:3: error: 'assert' was not declared in this scope
   45 |   assert(!qry.empty());
      |   ^~~~~~
vision.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include <vision.h>
  +++ |+#include <cassert>
    2 | 
vision.cpp:56:5: error: 'cerr' was not declared in this scope
   56 |     cerr<<row<<" "<<col<<endl;
      |     ^~~~
vision.cpp:56:5: note: 'std::cerr' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
vision.cpp:56:26: error: 'endl' was not declared in this scope
   56 |     cerr<<row<<" "<<col<<endl;
      |                          ^~~~
vision.cpp:2:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
    1 | #include <vision.h>
  +++ |+#include <ostream>
    2 | 
vision.cpp:60:3: error: 'assert' was not declared in this scope
   60 |   assert(!qry.empty());
      |   ^~~~~~
vision.cpp:60:3: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
vision.cpp:81:2: error: 'assert' was not declared in this scope
   81 |  assert(!qry.empty());
      |  ^~~~~~
vision.cpp:81:2: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?