# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
966063 | 2024-04-19T10:30:33 Z | Trisanu_Das | Council (JOI23_council) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; int a[n + 1][m + 1]; vector<int> vis(m + 1), mp(1 << m), mask(1 << m), idx(n + 1); for(int i = 1; i <= n; i++){ int sum = 0; for(int j = 1; j <= m; j++){ cin >> a[i][j]; if(a[i][j]){ vis[j]++; sum += (1 << (j - 1)); } } idx[i] = sum; mp[sum]++; } if(n<=3000){ for(int i = 1; i <= n; i++){ int mx = 0; vector<int>vis1(m + 1); for(int j = 1; j <= m; j++) if(arr[i][j]) vis1[j]++; for(int j = 1; j <= n; j++){ if(j == i) continue; vector<int> vis2(m + 1); int cnt = 0 ; for(int k = 1; k <= m;k++) if(arr[j][k]) vis2[k]++; for(int k = 1; k <= m; k++) if((vis[k] - vis1[k] - vis2[k]) > ((n - 2) / 2)) cnt++; mx = max(mx, cnt); } cout << mx << '\n'; } } else{ int mn = ((n - 2) / 2); for(int i = 1; i <= n; i++){ int val = idx[i]; vector<int> vis1(m + 1); for(int j = 1; j <= m;j++) if(arr[i][j]) vis1[j]++; mp[val]--; int mx = 0; for(int msk = 0; msk < (1 << m); msk++){ if(mp[mask] <= 0 || mx == m) continue; vector<int> vis2(m + 1); int cnt = 0; for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; for(int j = 1; j <= m; j++) if(vis[j] - vis1[j] - vis2[j] > mn)cnt++; mx = max(mx, cnt); if(mask == 0)break; } cout << mx << '\n'; mp[val]++; } } }
Compilation message
council.cpp: In function 'int main()': council.cpp:25:35: error: 'arr' was not declared in this scope 25 | for(int j = 1; j <= m; j++) if(arr[i][j]) vis1[j]++; | ^~~ council.cpp:30:35: error: 'arr' was not declared in this scope 30 | for(int k = 1; k <= m;k++) if(arr[j][k]) vis2[k]++; | ^~~ council.cpp:42:34: error: 'arr' was not declared in this scope 42 | for(int j = 1; j <= m;j++) if(arr[i][j]) vis1[j]++; | ^~~ council.cpp:46:10: error: no match for 'operator[]' (operand types are 'std::vector<int>' and 'std::vector<int>') 46 | if(mp[mask] <= 0 || mx == m) continue; | ^ 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 council.cpp:1: /usr/include/c++/10/bits/stl_vector.h:1043:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:1043:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT | ~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:1061:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:1061:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT | ~~~~~~~~~~^~~ council.cpp:49:42: error: no match for 'operator>>' (operand types are 'std::vector<int>' and 'int') 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ~~~~ ^~ ~ | | | | | int | std::vector<int> In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45, from council.cpp:1: /usr/include/c++/10/cstddef:130:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(std::byte, _IntegerType)' 130 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/10/cstddef:130:5: note: template argument deduction/substitution failed: council.cpp:49:37: note: cannot convert 'mask' (type 'std::vector<int>') to type 'std::byte' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^~~~ In file included from /usr/include/c++/10/string:56, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/bits/basic_string.tcc:1476:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 1476 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.tcc:1476:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/c++/10/istream:991, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/bits/istream.tcc:931:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)' 931 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/10/bits/istream.tcc:931:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/istream:756:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)' 756 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/10/istream:756:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<char, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/istream:761:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)' 761 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/10/istream:761:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<char, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/c++/10/istream:991, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/bits/istream.tcc:963:5: note: candidate: 'template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)' 963 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/10/bits/istream.tcc:963:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/istream:803:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)' 803 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/10/istream:803:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<char, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/istream:808:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)' 808 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/10/istream:808:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<char, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/istream:980:5: note: candidate: 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&)' 980 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/10/istream:980:5: note: template argument deduction/substitution failed: /usr/include/c++/10/istream: In substitution of 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::vector<int>&; _Tp = int&]': council.cpp:49:45: required from here /usr/include/c++/10/istream:980:5: error: no type named 'type' in 'struct std::enable_if<false, void>' In file included from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from council.cpp:1: /usr/include/c++/10/complex:500:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::complex<_Tp>&)' 500 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/10/complex:500:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66, from council.cpp:1: /usr/include/c++/10/bitset:1472:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::bitset<_Nb>&)' 1472 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) | ^~~~~~~~ /usr/include/c++/10/bitset:1472:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from council.cpp:1: /usr/include/c++/10/iomanip:71:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Resetiosflags)' 71 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/10/iomanip:71:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from council.cpp:1: /usr/include/c++/10/iomanip:101:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setiosflags)' 101 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/10/iomanip:101:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from council.cpp:1: /usr/include/c++/10/iomanip:132:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setbase)' 132 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) | ^~~~~~~~ /usr/include/c++/10/iomanip:132:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from council.cpp:1: /usr/include/c++/10/iomanip:170:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setfill<_CharT>)' 170 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) | ^~~~~~~~ /usr/include/c++/10/iomanip:170:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from council.cpp:1: /usr/include/c++/10/iomanip:200:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setprecision)' 200 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f) | ^~~~~~~~ /usr/include/c++/10/iomanip:200:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from council.cpp:1: /usr/include/c++/10/iomanip:230:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setw)' 230 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f) | ^~~~~~~~ /usr/include/c++/10/iomanip:230:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from council.cpp:1: /usr/include/c++/10/iomanip:264:5: note: candidate: 'template<class _CharT, class _Traits, class _MoneyT> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Get_money<_MoneyT>)' 264 | operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f) | ^~~~~~~~ /usr/include/c++/10/iomanip:264:5: note: template argument deduction/substitution failed: council.cpp:49:45: note: 'std::vector<int>' is not derived from 'std::basic_istream<_CharT, _Traits>' 49 | for(int j = 0; j < m; j++) if(((mask >> j) & 1) == 1) vis2[j + 1]++; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72,