Submission #518710

# Submission time Handle Problem Language Result Execution time Memory
518710 2022-01-24T13:08:29 Z inksamurai Sajam (COCI18_sajam) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define crep(i,x,n) for(int i=x;i<n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define vec(...) vector<__VA_ARGS__>
#define _343tk3a ios::sync_with_stdio(0),cin.tie(0)
using namespace std;
void print(){cout<<"\n";}
template<class te,class ...ti>
void print(const te&v,const ti&...nv){cout<<v;if(sizeof...(nv)){cout<<" ";print(nv...);}}
typedef long long ll;
using pii=pair<int,int>;
using vi=vector<int>;
//e

int main(){
_343tk3a;
	int n,k;
	cin>>n>>k;
	int h,w;
	h=n,w=n;
	vec(bitset<1000>) a(h);
	rep(i,h){
		string s;
		cin>>s;
		rep(j,w){
			a[i][j]=(s[j]=='x');
		}
	}
	bitset<1000> _ie;
	rep(i,n) _ie[i]=1;
	auto af=[&](bitset<1000> _a){
		int res=0;
		rep(i,h){
			res+=min((a[i]^_a).count(),(_ie^a[i]^_a).count());
		}
		return res;
	};
	int res=n+1;
	rep(i,h){
		res=min(res,af(a[i]));
	}
	rep(i,h){
		rep(j,w){
			a[i][j]^=1;
			af(a[i]);
			a[i][j]^=1;
		}
	}
	print((res<=k?"DA":"NE"),"\n");
//
	return 0;
}

Compilation message

sajam.cpp: In function 'int main()':
sajam.cpp:49:11: error: no match for 'operator^=' (operand types are 'std::bitset<1000>::reference' and 'int')
   49 |    a[i][j]^=1;
      |    ~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
                 from sajam.cpp:1:
/usr/include/c++/10/cstddef:168:3: note: candidate: 'constexpr std::byte& std::operator^=(std::byte&, std::byte)'
  168 |   operator^=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/cstddef:168:20: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::byte&'
  168 |   operator^=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included 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 sajam.cpp:1:
/usr/include/c++/10/bits/ios_base.h:107:3: note: candidate: 'const std::_Ios_Fmtflags& std::operator^=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)'
  107 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:107:29: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::_Ios_Fmtflags&'
  107 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:149:3: note: candidate: 'const std::_Ios_Openmode& std::operator^=(std::_Ios_Openmode&, std::_Ios_Openmode)'
  149 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:149:29: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::_Ios_Openmode&'
  149 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:189:3: note: candidate: 'const std::_Ios_Iostate& std::operator^=(std::_Ios_Iostate&, std::_Ios_Iostate)'
  189 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:189:28: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::_Ios_Iostate&'
  189 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from sajam.cpp:1:
/usr/include/c++/10/future:170:18: note: candidate: 'std::launch& std::operator^=(std::launch&, std::launch)'
  170 |   inline launch& operator^=(launch& __x, launch __y)
      |                  ^~~~~~~~
/usr/include/c++/10/future:170:37: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::launch&'
  170 |   inline launch& operator^=(launch& __x, launch __y)
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:127,
                 from sajam.cpp:1:
/usr/include/c++/10/charconv:688:3: note: candidate: 'constexpr std::chars_format& std::operator^=(std::chars_format&, std::chars_format)'
  688 |   operator^=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/charconv:688:28: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::chars_format&'
  688 |   operator^=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~
sajam.cpp:51:11: error: no match for 'operator^=' (operand types are 'std::bitset<1000>::reference' and 'int')
   51 |    a[i][j]^=1;
      |    ~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
                 from sajam.cpp:1:
/usr/include/c++/10/cstddef:168:3: note: candidate: 'constexpr std::byte& std::operator^=(std::byte&, std::byte)'
  168 |   operator^=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/cstddef:168:20: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::byte&'
  168 |   operator^=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included 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 sajam.cpp:1:
/usr/include/c++/10/bits/ios_base.h:107:3: note: candidate: 'const std::_Ios_Fmtflags& std::operator^=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)'
  107 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:107:29: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::_Ios_Fmtflags&'
  107 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:149:3: note: candidate: 'const std::_Ios_Openmode& std::operator^=(std::_Ios_Openmode&, std::_Ios_Openmode)'
  149 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:149:29: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::_Ios_Openmode&'
  149 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:189:3: note: candidate: 'const std::_Ios_Iostate& std::operator^=(std::_Ios_Iostate&, std::_Ios_Iostate)'
  189 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:189:28: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::_Ios_Iostate&'
  189 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from sajam.cpp:1:
/usr/include/c++/10/future:170:18: note: candidate: 'std::launch& std::operator^=(std::launch&, std::launch)'
  170 |   inline launch& operator^=(launch& __x, launch __y)
      |                  ^~~~~~~~
/usr/include/c++/10/future:170:37: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::launch&'
  170 |   inline launch& operator^=(launch& __x, launch __y)
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:127,
                 from sajam.cpp:1:
/usr/include/c++/10/charconv:688:3: note: candidate: 'constexpr std::chars_format& std::operator^=(std::chars_format&, std::chars_format)'
  688 |   operator^=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/charconv:688:28: note:   no known conversion for argument 1 from 'std::bitset<1000>::reference' to 'std::chars_format&'
  688 |   operator^=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~