답안 #518709

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
518709 2022-01-24T13:07:18 Z inksamurai Sajam (COCI18_sajam) C++17
45 / 90
119 ms 472 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]));
	}
	print((res<=k?"DA":"NE"),"\n");
//
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 21 ms 368 KB Output is correct
3 Correct 32 ms 332 KB Output is correct
4 Correct 96 ms 460 KB Output is correct
5 Correct 32 ms 332 KB Output is correct
6 Correct 15 ms 356 KB Output is correct
7 Correct 33 ms 384 KB Output is correct
8 Correct 116 ms 448 KB Output is correct
9 Correct 7 ms 272 KB Output is correct
10 Correct 105 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 332 KB Output is correct
2 Correct 80 ms 428 KB Output is correct
3 Correct 54 ms 332 KB Output is correct
4 Correct 47 ms 332 KB Output is correct
5 Correct 99 ms 436 KB Output is correct
6 Correct 34 ms 332 KB Output is correct
7 Correct 66 ms 452 KB Output is correct
8 Correct 70 ms 332 KB Output is correct
9 Correct 21 ms 364 KB Output is correct
10 Correct 119 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 448 KB Output is correct
2 Correct 88 ms 440 KB Output is correct
3 Correct 53 ms 396 KB Output is correct
4 Correct 66 ms 412 KB Output is correct
5 Correct 67 ms 396 KB Output is correct
6 Correct 111 ms 440 KB Output is correct
7 Correct 26 ms 332 KB Output is correct
8 Correct 61 ms 412 KB Output is correct
9 Correct 76 ms 332 KB Output is correct
10 Correct 117 ms 472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 332 KB Output is correct
2 Correct 50 ms 396 KB Output is correct
3 Incorrect 113 ms 432 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 460 KB Output is correct
2 Correct 116 ms 440 KB Output is correct
3 Incorrect 103 ms 460 KB Output isn't correct
4 Halted 0 ms 0 KB -