Submission #508820

# Submission time Handle Problem Language Result Execution time Memory
508820 2022-01-13T20:56:59 Z inksamurai Sajam (COCI18_sajam) C++17
0 / 90
28 ms 28204 KB
#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;
		}
	}
	vec(vi) c(n);
	{
		rep(i,n){
			rep(j,n){
				c[i].pb((tbl[i][j+n]!=tbl[0][j+n]));
			}
		}
	}
	auto affine=[&](vec(vi) a){
		vec(vi) rbe(n,vi(2));
		rep(i,n){
			rep(j,n){
				rbe[j][a[i][j]]++;
			}
		}
		int now=0;
		rep(i,n){
			now+=min(rbe[i][0],rbe[i][1]);
		}
		return now;
	};
	if(affine(c)<=k){
		yare;
	}
	nare;
//	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 16868 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 21828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 13124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 28204 KB Output isn't correct
2 Halted 0 ms 0 KB -