Submission #821584

# Submission time Handle Problem Language Result Execution time Memory
821584 2023-08-11T11:51:04 Z prvocislo Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include "vision.h"

int h, w;
int withdist(int x, int y, int k) // mame aspon jeden ktory ma vzdialenost najviac k od policka x
{
	vector<int> v;
	for (int xi = 0; xi < h; xi++) for (int yi = 0; yi < w; yi++) if (abs(x - xi) + abs(y - yi) <= k) v.push_back(xi * w + yi);
	return add_or(v);
}
int more(int k) // je to aspon k
{
	vector<int> a; // tie andy tych regionov
	for (int i = 0; i + k <= h + w - 2; i++)
	{
		vector<int> o1 = { withdist(0, 0, i), withdist(h - 1, w - 1, h - 1 + w - 1 - (i + k)) };
		a.push_back(add_and(o1));

		vector<int> o2 = { withdist(0, w - 1, i), withdist(h - 1, 0, h - 1 + w - 1 - (i + k)) };
		a.push_back(add_and(o2));
	}
	return add_or(a);
}
void construct_network(int H, int W, int k)
{
	h = H, w = W;
	if (k >= h + w - 2) more(k);
	else add_xor({ more(k), more(k + 1) });
}

Compilation message

vision.cpp: In function 'int withdist(int, int, int)':
vision.cpp:6:2: error: 'vector' was not declared in this scope
    6 |  vector<int> v;
      |  ^~~~~~
vision.cpp:6:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
vision.cpp:6:9: error: expected primary-expression before 'int'
    6 |  vector<int> v;
      |         ^~~
vision.cpp:7:100: error: 'v' was not declared in this scope
    7 |  for (int xi = 0; xi < h; xi++) for (int yi = 0; yi < w; yi++) if (abs(x - xi) + abs(y - yi) <= k) v.push_back(xi * w + yi);
      |                                                                                                    ^
vision.cpp:8:16: error: 'v' was not declared in this scope
    8 |  return add_or(v);
      |                ^
vision.cpp: In function 'int more(int)':
vision.cpp:12:2: error: 'vector' was not declared in this scope
   12 |  vector<int> a; // tie andy tych regionov
      |  ^~~~~~
vision.cpp:12:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
vision.cpp:12:9: error: expected primary-expression before 'int'
   12 |  vector<int> a; // tie andy tych regionov
      |         ^~~
vision.cpp:15:10: error: expected primary-expression before 'int'
   15 |   vector<int> o1 = { withdist(0, 0, i), withdist(h - 1, w - 1, h - 1 + w - 1 - (i + k)) };
      |          ^~~
vision.cpp:16:3: error: 'a' was not declared in this scope
   16 |   a.push_back(add_and(o1));
      |   ^
vision.cpp:16:23: error: 'o1' was not declared in this scope
   16 |   a.push_back(add_and(o1));
      |                       ^~
vision.cpp:18:10: error: expected primary-expression before 'int'
   18 |   vector<int> o2 = { withdist(0, w - 1, i), withdist(h - 1, 0, h - 1 + w - 1 - (i + k)) };
      |          ^~~
vision.cpp:19:23: error: 'o2' was not declared in this scope
   19 |   a.push_back(add_and(o2));
      |                       ^~
vision.cpp:21:16: error: 'a' was not declared in this scope
   21 |  return add_or(a);
      |                ^