Submission #1066433

# Submission time Handle Problem Language Result Execution time Memory
1066433 2024-08-19T21:38:51 Z aaaaaarroz Soccer Stadium (IOI23_soccer) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int N, vector<vector<int>> F){
	map<tuple<int,int,int>,bool>libre;
	for(int fila=0;fila<N;fila++){
		for(int i=0;i<N;i++){
			for(int j=0;j<N;i++){
				if(i==j){
					libre[{fila,i,j}]=!F[fila][j];
				}
				else{
					libre[{fila,i,j}]=(!F[fila][j])||libre[{fila,i,j-1}];
				}
			}
		}
	}
	int best=0;
	for(int fila=0;fila<N;fila++){
		for(int columna=0;columna<N;columna++){
			for(int i=0;i<=columna;i++){
				for(int j=columna;j<N;j++){
					if(libre[{fila,i,j}]){
						vector<pair<int,int>>almacen;
						almacen.push_back({i,j});
						int suma=0;
						int fil=fila;
						while(fil>=0&&F[fila][columna]==1){
							int l=columna,r=columna;
							while(l>almacen.back().first&&r<almacen.back().second){
								if(libre[{fil,l-1,r}]){
									l--;
								}
								else if(libre[{fil,l,r+1}]){
									r++;
								}
								else{
									break;
								}
							}
							almacen.push_back({l,r});
							fil--;
						}
						almacen.push_back({i,j});
						fil=fila;
						int fila_extra=1;
						int alm_ant=almacen.size()-1;
						while(fil<N&&F[fila][columna]==1){
							int l1=columna,r1=columna;
							if(fila_extra<alm_ant){
								l1=almacen[alm_ant].first;
								r1=almacen[alm_ant]-second;
								while(l1>almacen.back().first&&r1<almacen.back().second){
									if(libre[{fil,l-1,r}]){
										l--;
									}
									else if(libre[{fil,l,r+1}]){
										r++;
									}
									else{
										break;
									}
								}
							}
							int l=columna,r=columna;
							while(l>almacen.back().first&&r<almacen.back().second){
								if(libre[{fil,l-1,r}]){
									l--;
								}
								else if(libre[{fil,l,r+1}]){
									r++;
								}
								else{
									break;
								}
							}
							if(libre[{fil,l1,r1}]){
								almacen.push_back({l1,r1});
							}
							else{
								almacen.push_back({l,r});
							}
							fil++;
						}
						for(auto[x,y]:almacen){
							suma+=(y-x+1);
						}
						suma-=(j-i+1);
						best=max(suma,best);
					}
					else{
						continue;
					}
				}
			}
		}
	}
	return best;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:51:29: error: 'second' was not declared in this scope
   51 |         r1=almacen[alm_ant]-second;
      |                             ^~~~~~
soccer.cpp:53:24: error: 'l' was not declared in this scope; did you mean 'l1'?
   53 |          if(libre[{fil,l-1,r}]){
      |                        ^
      |                        l1
soccer.cpp:53:28: error: 'r' was not declared in this scope; did you mean 'r1'?
   53 |          if(libre[{fil,l-1,r}]){
      |                            ^
      |                            r1
soccer.cpp:53:18: error: no match for 'operator[]' (operand types are 'std::map<std::tuple<int, int, int>, bool>' and '<brace-enclosed initializer list>')
   53 |          if(libre[{fil,l-1,r}]){
      |                  ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from soccer.cpp:1:
/usr/include/c++/10/bits/stl_map.h:492:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::tuple<int, int, int>; _Tp = bool; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::tuple<int, int, int>]'
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::tuple<int, int, int>&'}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:512:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::tuple<int, int, int>; _Tp = bool; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::tuple<int, int, int>]'
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::tuple<int, int, int>, bool>::key_type&&' {aka 'std::tuple<int, int, int>&&'}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
soccer.cpp:56:23: error: no match for 'operator[]' (operand types are 'std::map<std::tuple<int, int, int>, bool>' and '<brace-enclosed initializer list>')
   56 |          else if(libre[{fil,l,r+1}]){
      |                       ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from soccer.cpp:1:
/usr/include/c++/10/bits/stl_map.h:492:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::tuple<int, int, int>; _Tp = bool; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::tuple<int, int, int>]'
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::tuple<int, int, int>&'}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:512:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::tuple<int, int, int>; _Tp = bool; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::tuple<int, int, int>]'
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::tuple<int, int, int>, bool>::key_type&&' {aka 'std::tuple<int, int, int>&&'}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~