#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#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 _34raRxL ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
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...);
}
}
#define yare {cout<<"DA\n"; exit(0);}
#define nare {cout<<"NE\n"; exit(0);}
using pii=pair<int,int>;
using vi=vector<int>;
using vll=vector<long long>;
signed main(){
_34raRxL;
int n,k;
cin>>n>>k;
int h=n,w=n;
vec(vi) a(h,vi(w));
rep(i,h){
string s;
cin>>s;
rep(j,w){
a[i][j]=s[j]=='o';
}
}
vec(vi) tbl(2*n,vi(2*n));
rep(i,h){
rep(j,w){
int x=a[i][j];
// co = j + n ..
int ro=i,co=j+n;
tbl[ro][co]=tbl[co][ro]=x;
}
}
vi c(n);
{
rep(i,n){
rep(j,n){
c[i]+=(tbl[i][j+n]!=tbl[0][j+n]);
}
}
}
auto affine=[&](int i0,int i1,int add)->void{
rep(i,n){
if(i==i0 or i==i1) continue;
add+=min(c[i],n-c[i]);
}
if(add<=k){
yare;
}
};
affine(-1,-1,0);
rep(i,n){
affine(i,-1,max(c[i],n-c[i]));
}
rep(i,n){
rep(j,i,n){
if(i==j) continue;
affine(i,j,max(c[i],n-c[i])+max(c[j],n-c[j]));
}
}
nare;
//
return 0;
}
Compilation message
sajam.cpp:79:12: error: macro "rep" passed 3 arguments, but takes just 2
79 | rep(j,i,n){
| ^
sajam.cpp:7: note: macro "rep" defined here
7 | #define rep(i,n) for(int i=0;i<n;i++)
|
sajam.cpp: In function 'int main()':
sajam.cpp:79:3: error: 'rep' was not declared in this scope
79 | rep(j,i,n){
| ^~~