답안 #841387

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841387 2023-09-01T15:16:46 Z pera 축구 경기장 (IOI23_soccer) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "soccer.h"
using namespace std;
 
int biggest_stadium(int N , vector<vector<int>> F){
	int c = 0 , i , j;
	for(int ii = 0;ii < N;ii ++){
		for(int jj = 0;jj < N;jj ++){
			if(F[ii][jj] == 1){
				c ++;
				i = ii , j = jj;
			}
		}
	}
	if(c == 1){
		int ans = N * N;
		ans -= min({(ii + 1) * (jj + 1) , (N - ii) * (jj + 1) , (N - jj) * (ii + 1) , (N - ii) * (N - jj)});
		return ans;
	}
	map<pair<pair<int , int> , pair<int , int>> , bool> ok;
	for(int i = 0;i < N;i ++){
		for(int j = 0;j < N;j ++){
			if(F[i][j] == 0){
				for(int k = j;k >= 0;k --){
					if(F[i][k] == 1) break;
					ok[{{i , j} , {i , k}}] = 1;
				}
				for(int k = j;k < N;k ++){
					if(F[i][k] == 1) break;
					ok[{{i , j} , {i , k}}] = 1;
				}
				for(int k = i;k >= 0;k --){
					if(F[k][j] == 1) break;
					ok[{{i , j} , {k , j}}] = 1;
				}
				for(int k = i;k < N;k ++){
					if(F[k][j] == 1) break;
					ok[{{i , j} , {k , j}}] = 1;
				}
			}
		}
	}
	for(int i = 0;i < N;i ++){
		for(int j = 0;j < N;j ++){
			if(F[i][j] == 0){
				for(int k1 = 0;k1 < N;k1 ++){
					for(int k2 = 0;k2 < N;k2 ++){
						if(k1 == i || k2 == j) continue;
						ok[{{i , j} , {k1 , k2}}] = ((ok[{{i , j} , {i , k2}}] && ok[{{i , k2} , {k1 , k2}}])
													|| (ok[{{i , j} , {k1 , j}}] && ok[{{k1 , j} , {k1 , k2}}]));
					}
				}
			}
		}
	}
	int ans = 0;
	for(int mk = 0;mk < (1 << (N * N));mk ++){
		int c = 0;
		vector<pair<int , int>> X;
		for(int i = 0;i < N;i ++){
			for(int j = 0;j < N;j ++){
				if((1 << (c ++)) & mk) X.push_back({i , j});
			}
		}
		int okk = 1;
		for(int i = 0;i < X.size();i ++){
			for(int j = 0;j < X.size();j ++){
				okk &= ok[{X[i] , X[j]}];	
			}
		}
		if(okk == 1) ans = max(ans , (int)X.size());
	}
	return ans;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:17:16: error: 'ii' was not declared in this scope; did you mean 'i'?
   17 |   ans -= min({(ii + 1) * (jj + 1) , (N - ii) * (jj + 1) , (N - jj) * (ii + 1) , (N - ii) * (N - jj)});
      |                ^~
      |                i
soccer.cpp:17:27: error: 'jj' was not declared in this scope; did you mean 'j'?
   17 |   ans -= min({(ii + 1) * (jj + 1) , (N - ii) * (jj + 1) , (N - jj) * (ii + 1) , (N - ii) * (N - jj)});
      |                           ^~
      |                           j
soccer.cpp:17:101: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   17 |   ans -= min({(ii + 1) * (jj + 1) , (N - ii) * (jj + 1) , (N - jj) * (ii + 1) , (N - ii) * (N - jj)});
      |                                                                                                     ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from soccer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
soccer.cpp:17:101: note:   candidate expects 2 arguments, 1 provided
   17 |   ans -= min({(ii + 1) * (jj + 1) , (N - ii) * (jj + 1) , (N - jj) * (ii + 1) , (N - ii) * (N - jj)});
      |                                                                                                     ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from soccer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
soccer.cpp:17:101: note:   candidate expects 3 arguments, 1 provided
   17 |   ans -= min({(ii + 1) * (jj + 1) , (N - ii) * (jj + 1) , (N - jj) * (ii + 1) , (N - ii) * (N - jj)});
      |                                                                                                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from soccer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
soccer.cpp:66:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |   for(int i = 0;i < X.size();i ++){
      |                 ~~^~~~~~~~~~
soccer.cpp:67:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |    for(int j = 0;j < X.size();j ++){
      |                  ~~^~~~~~~~~~