Submission #518712

# Submission time Handle Problem Language Result Execution time Memory
518712 2022-01-24T13:10:28 Z inksamurai Sajam (COCI18_sajam) C++17
45 / 90
267 ms 460 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]));
	}
	int i=0;
	rep(j,w){
		a[i][j]=1-a[i][j];
		af(a[i]);
		a[i][j]=1-a[i][j];
	}
	print((res<=k?"DA":"NE"),"\n");
//
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 55 ms 332 KB Output is correct
3 Correct 81 ms 376 KB Output is correct
4 Correct 215 ms 460 KB Output is correct
5 Correct 72 ms 372 KB Output is correct
6 Correct 28 ms 332 KB Output is correct
7 Correct 65 ms 332 KB Output is correct
8 Correct 237 ms 332 KB Output is correct
9 Correct 13 ms 336 KB Output is correct
10 Correct 264 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Incorrect 3 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 153 ms 332 KB Output is correct
2 Correct 175 ms 428 KB Output is correct
3 Correct 158 ms 388 KB Output is correct
4 Correct 116 ms 412 KB Output is correct
5 Correct 267 ms 440 KB Output is correct
6 Correct 152 ms 376 KB Output is correct
7 Correct 149 ms 412 KB Output is correct
8 Correct 153 ms 416 KB Output is correct
9 Correct 41 ms 332 KB Output is correct
10 Correct 244 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 198 ms 432 KB Output is correct
2 Correct 179 ms 332 KB Output is correct
3 Correct 106 ms 400 KB Output is correct
4 Correct 142 ms 408 KB Output is correct
5 Correct 156 ms 452 KB Output is correct
6 Correct 235 ms 432 KB Output is correct
7 Correct 75 ms 372 KB Output is correct
8 Correct 131 ms 408 KB Output is correct
9 Correct 145 ms 332 KB Output is correct
10 Correct 246 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 103 ms 392 KB Output is correct
2 Correct 105 ms 400 KB Output is correct
3 Incorrect 253 ms 432 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 249 ms 460 KB Output is correct
2 Correct 246 ms 440 KB Output is correct
3 Incorrect 209 ms 440 KB Output isn't correct
4 Halted 0 ms 0 KB -