답안 #1031519

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031519 2024-07-22T23:23:51 Z Marco_Escandon Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#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)});
	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:5:2: error: 'vector' was not declared in this scope
    5 |  vector<ll> ia, da;
      |  ^~~~~~
vision.cpp:5:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 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 /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 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:5:11: error: expected primary-expression before '>' token
    5 |  vector<ll> ia, da;
      |           ^
vision.cpp:5:13: error: 'ia' was not declared in this scope
    5 |  vector<ll> ia, da;
      |             ^~
vision.cpp:5:17: error: 'da' was not declared in this scope
    5 |  vector<ll> ia, da;
      |                 ^~
vision.cpp:8:12: error: expected primary-expression before '>' token
    8 |   vector<ll> temp;
      |            ^
vision.cpp:8:14: error: 'temp' was not declared in this scope
    8 |   vector<ll> temp;
      |              ^~~~
vision.cpp:9:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
    9 |   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:2:
/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:11:16: error: 'add_or' was not declared in this scope
   11 |   ia.push_back(add_or(temp));
      |                ^~~~~~
vision.cpp:15:12: error: expected primary-expression before '>' token
   15 |   vector<ll> temp;
      |            ^
vision.cpp:15:14: error: 'temp' was not declared in this scope
   15 |   vector<ll> temp;
      |              ^~~~
vision.cpp:19:16: error: 'add_or' was not declared in this scope
   19 |   ia.push_back(add_or(temp));
      |                ^~~~~~
vision.cpp:24:12: error: expected primary-expression before '>' token
   24 |   vector<ll> temp;
      |            ^
vision.cpp:24:14: error: 'temp' was not declared in this scope
   24 |   vector<ll> temp;
      |              ^~~~
vision.cpp:25:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   25 |   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:2:
/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:29:16: error: 'add_or' was not declared in this scope
   29 |   da.push_back(add_or(temp));
      |                ^~~~~~
vision.cpp:33:12: error: expected primary-expression before '>' token
   33 |   vector<ll> temp;
      |            ^
vision.cpp:33:14: error: 'temp' was not declared in this scope
   33 |   vector<ll> temp;
      |              ^~~~
vision.cpp:37:16: error: 'add_or' was not declared in this scope
   37 |   da.push_back(add_or(temp));
      |                ^~~~~~
vision.cpp:39:11: error: expected primary-expression before '>' token
   39 |  vector<ll> asd1;
      |           ^
vision.cpp:39:13: error: 'asd1' was not declared in this scope
   39 |  vector<ll> asd1;
      |             ^~~~
vision.cpp:42:10: error: expected primary-expression before 'int'
   42 |   vector<int> sub_vector(ia.begin() + i, ia.begin() + i+K+1);
      |          ^~~
vision.cpp:43:16: error: 'sub_vector' was not declared in this scope
   43 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:43:8: error: 'add_xor' was not declared in this scope
   43 |   ll a=add_xor(sub_vector);
      |        ^~~~~~~
vision.cpp:44:8: error: 'add_not' was not declared in this scope
   44 |   ll b=add_not(a);
      |        ^~~~~~~
vision.cpp:45:8: error: 'add_or' was not declared in this scope
   45 |   ll c=add_or(sub_vector);
      |        ^~~~~~
vision.cpp:46:18: error: 'add_and' was not declared in this scope
   46 |   asd1.push_back(add_and({b,c}));
      |                  ^~~~~~~
vision.cpp:48:11: error: expected primary-expression before '>' token
   48 |  vector<ll> asd2;
      |           ^
vision.cpp:48:13: error: 'asd2' was not declared in this scope
   48 |  vector<ll> asd2;
      |             ^~~~
vision.cpp:51:10: error: expected primary-expression before 'int'
   51 |   vector<int> sub_vector(da.begin() + i, da.begin() + i+K+1);
      |          ^~~
vision.cpp:52:16: error: 'sub_vector' was not declared in this scope
   52 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:52:8: error: 'add_xor' was not declared in this scope
   52 |   ll a=add_xor(sub_vector);
      |        ^~~~~~~
vision.cpp:53:8: error: 'add_not' was not declared in this scope
   53 |   ll b=add_not(a);
      |        ^~~~~~~
vision.cpp:54:8: error: 'add_or' was not declared in this scope
   54 |   ll c=add_or(sub_vector);
      |        ^~~~~~
vision.cpp:55:18: error: 'add_and' was not declared in this scope
   55 |   asd2.push_back(add_and({b,c}));
      |                  ^~~~~~~
vision.cpp:57:20: error: 'add_or' was not declared in this scope
   57 |  ll bsk_1=add_and({add_or(asd1),add_or(asd2)});
      |                    ^~~~~~
vision.cpp:57:11: error: 'add_and' was not declared in this scope
   57 |  ll bsk_1=add_and({add_or(asd1),add_or(asd2)});
      |           ^~~~~~~
vision.cpp:61:10: error: expected primary-expression before 'int'
   61 |   vector<int> sub_vector(ia.begin() + i, ia.begin() + i+K);
      |          ^~~
vision.cpp:62:16: error: 'sub_vector' was not declared in this scope
   62 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:62:8: error: 'add_xor' was not declared in this scope
   62 |   ll a=add_xor(sub_vector);
      |        ^~~~~~~
vision.cpp:63:8: error: 'add_not' was not declared in this scope
   63 |   ll b=add_not(a);
      |        ^~~~~~~
vision.cpp:70:10: error: expected primary-expression before 'int'
   70 |   vector<int> sub_vector(da.begin() + i, da.begin() + i+K);
      |          ^~~
vision.cpp:71:16: error: 'sub_vector' was not declared in this scope
   71 |   ll a=add_xor(sub_vector);
      |                ^~~~~~~~~~
vision.cpp:71:8: error: 'add_xor' was not declared in this scope
   71 |   ll a=add_xor(sub_vector);
      |        ^~~~~~~
vision.cpp:72:8: error: 'add_not' was not declared in this scope
   72 |   ll b=add_not(a);
      |        ^~~~~~~
vision.cpp:77:24: error: 'add_not' was not declared in this scope
   77 |  ll ans=add_and({bsk_1,add_not(bsk_2)});
      |                        ^~~~~~~
vision.cpp:77:5: warning: unused variable 'ans' [-Wunused-variable]
   77 |  ll ans=add_and({bsk_1,add_not(bsk_2)});
      |     ^~~