Submission #1031525

# Submission time Handle Problem Language Result Execution time Memory
1031525 2024-07-22T23:30:01 Z Marco_Escandon Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include "vision.h"

#include<bits/stdc++.h>
typedef int ll;
void construct_network(int H, int W, int K) {
	vector<ll> ia, da;
	for(int i=0; i<W; i++)
	{
		vector<ll> temp;
		for(int j=0; j<=min(i,H-1); j++)
			temp.push_back((i-j)+(W*j));
		ia.push_back(add_or(temp));
	}
	for(int i=1; i<H; i++)
	{
		vector<ll> temp;
		for(int j=0; j<W; j++)
			if(j+i<H)
				temp.push_back((W-j-1)+(W*(j+i)));
		ia.push_back(add_or(temp));
	}

	for(int i=W-1; i>-1; i--)
	{
		vector<ll> temp;
		for(int j=0; j<=min(H-1,W-i-1); j++)
		{
			temp.push_back((i+j)+(W*j));
		}
		da.push_back(add_or(temp));
	}
	for(int i=1; i<H; i++)
	{
		vector<ll> temp;
		for(int j=0; j+i<W; j++)
			if(j+i<H)
				temp.push_back(j+(W*(j+i)));
		da.push_back(add_or(temp));
	}
	vector<ll> asd1;
	for(int i=0; i<ia.size()-K; i++)
	{
		vector<int> sub_vector(ia.begin() + i, ia.begin() + i+K+1);
		ll a=add_xor(sub_vector);
		ll b=add_not(a);
		ll c=add_or(sub_vector);
		asd1.push_back(add_and({b,c}));
	}
	vector<ll> asd2;
	for(int i=0; i<da.size()-K; i++)
	{
		vector<int> sub_vector(da.begin() + i, da.begin() + i+K+1);
		ll a=add_xor(sub_vector);
		ll b=add_not(a);
		ll c=add_or(sub_vector);
		asd2.push_back(add_and({b,c}));
	}
	ll bsk_1=add_and({add_or(asd1),add_or(asd2)});
	if(K==1)
	{
		return;
	}
	asd1.clear();
	for(int i=0; i<ia.size()-K+1; i++)
	{
		vector<int> sub_vector(ia.begin() + i, ia.begin() + i+K);
		ll a=add_xor(sub_vector);
		ll b=add_not(a);
		ll c=add_or(sub_vector);
		asd1.push_back(add_and({b,c}));
	}
	asd2.clear();
	for(int i=0; i<da.size()-K+1; i++)
	{
		vector<int> sub_vector(da.begin() + i, da.begin() + i+K);
		ll a=add_xor(sub_vector);
		ll b=add_not(a);
		ll c=add_or(sub_vector);
		asd2.push_back(add_and({b,c}));
	}
	ll bsk_2=add_and({add_or(asd1),add_or(asd2)});
	ll ans=add_and({bsk_1,add_not(bsk_2)});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:7:2: error: 'vector' was not declared in this scope
    7 |  vector<ll> ia, da;
      |  ^~~~~~
vision.cpp:7:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.cpp:2:
/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:2:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
vision.cpp:7:11: error: expected primary-expression before '>' token
    7 |  vector<ll> ia, da;
      |           ^
vision.cpp:7:13: error: 'ia' was not declared in this scope
    7 |  vector<ll> ia, da;
      |             ^~
vision.cpp:7:17: error: 'da' was not declared in this scope
    7 |  vector<ll> ia, da;
      |                 ^~
vision.cpp:10:12: error: expected primary-expression before '>' token
   10 |   vector<ll> temp;
      |            ^
vision.cpp:10:14: error: 'temp' was not declared in this scope
   10 |   vector<ll> temp;
      |              ^~~~
vision.cpp:11:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   11 |   for(int j=0; j<=min(i,H-1); j++)
      |                   ^~~
      |                   std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from vision.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
vision.cpp:17:12: error: expected primary-expression before '>' token
   17 |   vector<ll> temp;
      |            ^
vision.cpp:17:14: error: 'temp' was not declared in this scope
   17 |   vector<ll> temp;
      |              ^~~~
vision.cpp:26:12: error: expected primary-expression before '>' token
   26 |   vector<ll> temp;
      |            ^
vision.cpp:26:14: error: 'temp' was not declared in this scope
   26 |   vector<ll> temp;
      |              ^~~~
vision.cpp:27:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   27 |   for(int j=0; j<=min(H-1,W-i-1); j++)
      |                   ^~~
      |                   std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from vision.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
vision.cpp:35:12: error: expected primary-expression before '>' token
   35 |   vector<ll> temp;
      |            ^
vision.cpp:35:14: error: 'temp' was not declared in this scope
   35 |   vector<ll> temp;
      |              ^~~~
vision.cpp:41:11: error: expected primary-expression before '>' token
   41 |  vector<ll> asd1;
      |           ^
vision.cpp:41:13: error: 'asd1' was not declared in this scope
   41 |  vector<ll> asd1;
      |             ^~~~
vision.cpp:44:10: error: expected primary-expression before 'int'
   44 |   vector<int> sub_vector(ia.begin() + i, ia.begin() + i+K+1);
      |          ^~~
vision.cpp:45:16: error: 'sub_vector' was not declared in this scope
   45 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:50:11: error: expected primary-expression before '>' token
   50 |  vector<ll> asd2;
      |           ^
vision.cpp:50:13: error: 'asd2' was not declared in this scope
   50 |  vector<ll> asd2;
      |             ^~~~
vision.cpp:53:10: error: expected primary-expression before 'int'
   53 |   vector<int> sub_vector(da.begin() + i, da.begin() + i+K+1);
      |          ^~~
vision.cpp:54:16: error: 'sub_vector' was not declared in this scope
   54 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:59:46: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   59 |  ll bsk_1=add_and({add_or(asd1),add_or(asd2)});
      |                                              ^
      |                                              |
      |                                              <brace-enclosed initializer list>
vision.cpp:67:10: error: expected primary-expression before 'int'
   67 |   vector<int> sub_vector(ia.begin() + i, ia.begin() + i+K);
      |          ^~~
vision.cpp:68:16: error: 'sub_vector' was not declared in this scope
   68 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:76:10: error: expected primary-expression before 'int'
   76 |   vector<int> sub_vector(da.begin() + i, da.begin() + i+K);
      |          ^~~
vision.cpp:77:16: error: 'sub_vector' was not declared in this scope
   77 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:82:46: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   82 |  ll bsk_2=add_and({add_or(asd1),add_or(asd2)});
      |                                              ^
      |                                              |
      |                                              <brace-enclosed initializer list>
vision.cpp:83:5: warning: unused variable 'ans' [-Wunused-variable]
   83 |  ll ans=add_and({bsk_1,add_not(bsk_2)});
      |     ^~~