Submission #1063633

# Submission time Handle Problem Language Result Execution time Memory
1063633 2024-08-17T21:47:58 Z aaaaaarroz Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include "vision.h"
#include<bits/stdc++.h>
bool limites(int x, int y, int h, int w){
	return x>=0&&x<h&&y>=0&&y<w;
}
void construct_network(int H, int W, int K) {
	map<pair<int,int>,int>numero;
	int pos=1;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			numero[{i,j}]=pos;
			pos++;
		}
	}
	vector<int>dx,dy;
	for(int restar=0;restar<=K;restar++){
		int c_x=restar;
		int c_y=K-restar;
		dx.push_back(c_x);
		dy.push_back(c_y);
		dx.push_back(-c_x);
		dy.push_back(c_y);
		dx.push_back(c_x);
		dy.push_back(-c_y);
		dx.push_back(-c_x);
		dy.push_back(-c_y);
	}
	map<pair<pair<int,int>,pair<int,int>>,bool>marked;
	int cnt=1;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			for(int itr=0;itr<dx.size();itr++){
				int x=i+dx[itr];
				int y=j+dy[itr];
				if(limites(x,y,H,W)){
					if(!marked[{{i,j},{x,y}}]){
						and_and({numero[{i,j}],numero[{x,y}]});
						cnt++;
					}
				}
			}
		}
	}
	vector<int>instruct;
	for(int i=H*W+1;i<=(H*W+cnt);i++){
		instruct.push_back(i);
	}
	and_or(instruct);
	return;
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:7:2: error: 'map' was not declared in this scope
    7 |  map<pair<int,int>,int>numero;
      |  ^~~
vision.cpp:7:2: note: suggested alternatives:
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from vision.cpp:2:
/usr/include/c++/10/bits/stl_map.h:100:11: note:   'std::map'
  100 |     class map
      |           ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from vision.cpp:2:
/usr/include/c++/10/map:78:13: note:   'std::pmr::map'
   78 |       using map
      |             ^~~
vision.cpp:7:6: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 |  map<pair<int,int>,int>numero;
      |      ^~~~
      |      std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
vision.cpp:7:11: error: expected primary-expression before 'int'
    7 |  map<pair<int,int>,int>numero;
      |           ^~~
vision.cpp:11:4: error: 'numero' was not declared in this scope
   11 |    numero[{i,j}]=pos;
      |    ^~~~~~
vision.cpp:15:2: error: 'vector' was not declared in this scope
   15 |  vector<int>dx,dy;
      |  ^~~~~~
vision.cpp:15: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:15:9: error: expected primary-expression before 'int'
   15 |  vector<int>dx,dy;
      |         ^~~
vision.cpp:19:3: error: 'dx' was not declared in this scope
   19 |   dx.push_back(c_x);
      |   ^~
vision.cpp:20:3: error: 'dy' was not declared in this scope
   20 |   dy.push_back(c_y);
      |   ^~
vision.cpp:28:16: error: expected primary-expression before 'int'
   28 |  map<pair<pair<int,int>,pair<int,int>>,bool>marked;
      |                ^~~
vision.cpp:32:22: error: 'dx' was not declared in this scope
   32 |    for(int itr=0;itr<dx.size();itr++){
      |                      ^~
vision.cpp:34:13: error: 'dy' was not declared in this scope; did you mean 'y'?
   34 |     int y=j+dy[itr];
      |             ^~
      |             y
vision.cpp:36:10: error: 'marked' was not declared in this scope
   36 |      if(!marked[{{i,j},{x,y}}]){
      |          ^~~~~~
vision.cpp:37:16: error: 'numero' was not declared in this scope
   37 |       and_and({numero[{i,j}],numero[{x,y}]});
      |                ^~~~~~
vision.cpp:37:7: error: 'and_and' was not declared in this scope; did you mean 'add_and'?
   37 |       and_and({numero[{i,j}],numero[{x,y}]});
      |       ^~~~~~~
      |       add_and
vision.cpp:44:9: error: expected primary-expression before 'int'
   44 |  vector<int>instruct;
      |         ^~~
vision.cpp:46:3: error: 'instruct' was not declared in this scope; did you mean 'struct'?
   46 |   instruct.push_back(i);
      |   ^~~~~~~~
      |   struct
vision.cpp:48:9: error: 'instruct' was not declared in this scope; did you mean 'struct'?
   48 |  and_or(instruct);
      |         ^~~~~~~~
      |         struct
vision.cpp:48:2: error: 'and_or' was not declared in this scope; did you mean 'add_or'?
   48 |  and_or(instruct);
      |  ^~~~~~
      |  add_or