답안 #199819

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199819 2020-02-03T14:12:33 Z mahmoudbadawy Sajam (COCI18_sajam) C++17
90 / 90
194 ms 3232 KB
#include <bits/stdc++.h>

using namespace std;

string arr[1005];
bitset<1005> bit[1005];
int co[1005];
int n,k;


int main()
{
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		for(int j=0;j<n;j++)
		{
			arr[i][j]=(arr[i][j]=='o'?'1':'0');
		}
		bit[i]=bitset<1005>(arr[i]);
	}
	for(int i=0;i<n;i++)
	{
		int cur=0;
		for(int j=0;j<n;j++)
		{
			int z=(bit[i]^bit[j]).count();
			cur+=min(z,n-z);
		}
		if(cur<=k)
		{
			cout << "DA" << endl;
			return 0;
		}
	}
	bitset<1005> b=bit[0];
	for(int i=0;i<n;i++)
	{
		b[i]=(1-b[i]);
		int cur=0;
		for(int j=0;j<n;j++)
		{
			int z=(b^bit[j]).count();
			cur+=min(z,n-z);
		}
		if(cur<=k)
		{
			cout << "DA" << endl;
			return 0;
		}
		b[i]=(1-b[i]);
	}
	cout << "NE" << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 15 ms 632 KB Output is correct
3 Correct 20 ms 888 KB Output is correct
4 Correct 49 ms 1400 KB Output is correct
5 Correct 21 ms 888 KB Output is correct
6 Correct 10 ms 504 KB Output is correct
7 Correct 66 ms 888 KB Output is correct
8 Correct 176 ms 1504 KB Output is correct
9 Correct 15 ms 376 KB Output is correct
10 Correct 175 ms 1404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 6 ms 380 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 1144 KB Output is correct
2 Correct 43 ms 1272 KB Output is correct
3 Correct 30 ms 1144 KB Output is correct
4 Correct 28 ms 1016 KB Output is correct
5 Correct 49 ms 1272 KB Output is correct
6 Correct 61 ms 888 KB Output is correct
7 Correct 112 ms 1144 KB Output is correct
8 Correct 117 ms 1144 KB Output is correct
9 Correct 36 ms 632 KB Output is correct
10 Correct 194 ms 2300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 1272 KB Output is correct
2 Correct 44 ms 1272 KB Output is correct
3 Correct 28 ms 1016 KB Output is correct
4 Correct 34 ms 1144 KB Output is correct
5 Correct 36 ms 1144 KB Output is correct
6 Correct 189 ms 2424 KB Output is correct
7 Correct 49 ms 632 KB Output is correct
8 Correct 103 ms 1144 KB Output is correct
9 Correct 114 ms 1144 KB Output is correct
10 Correct 193 ms 2424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1016 KB Output is correct
2 Correct 28 ms 1020 KB Output is correct
3 Correct 160 ms 2424 KB Output is correct
4 Correct 48 ms 1272 KB Output is correct
5 Correct 82 ms 1532 KB Output is correct
6 Correct 189 ms 3232 KB Output is correct
7 Correct 62 ms 1192 KB Output is correct
8 Correct 76 ms 1272 KB Output is correct
9 Correct 71 ms 1272 KB Output is correct
10 Correct 65 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 2296 KB Output is correct
2 Correct 59 ms 2424 KB Output is correct
3 Correct 148 ms 1516 KB Output is correct
4 Correct 72 ms 1656 KB Output is correct
5 Correct 107 ms 1656 KB Output is correct
6 Correct 115 ms 1768 KB Output is correct
7 Correct 62 ms 1272 KB Output is correct
8 Correct 150 ms 2060 KB Output is correct
9 Correct 91 ms 1400 KB Output is correct
10 Correct 189 ms 2296 KB Output is correct