Submission #199820

# Submission time Handle Problem Language Result Execution time Memory
199820 2020-02-03T14:22:07 Z mohammedehab2002 Sajam (COCI18_sajam) C++11
90 / 90
199 ms 2424 KB
#include <bits/stdc++.h>
using namespace std;
int n,k;
string s[1005];
bitset<1005> b[1005];
int get(int i,int j)
{
	int cnt=(b[i]^b[j]).count();
	return min(cnt,n-cnt);
}
int main()
{
	cin >> n >> k;
	for (int i=0;i<n;i++)
	{
		cin >> s[i];
		for (int j=0;j<n;j++)
		b[i][j]=(s[i][j]=='o');
	}
	for (int i=0;i<n;i++)
	{
		int cur=0;
		for (int j=0;j<n;j++)
		cur+=get(i,j);
		if (cur<=k)
		{
			cout << "DA";
			return 0;
		}
	}
	for (int i=0;i<n;i++)
	{
		b[0][i].flip();
		int cur=0;
		for (int j=0;j<n;j++)
		cur+=get(0,j);
		if (cur<=k)
		{
			cout << "DA";
			return 0;
		}
		b[0][i].flip();
	}
	cout << "NE";
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 14 ms 504 KB Output is correct
3 Correct 21 ms 888 KB Output is correct
4 Correct 47 ms 1272 KB Output is correct
5 Correct 19 ms 760 KB Output is correct
6 Correct 10 ms 504 KB Output is correct
7 Correct 51 ms 888 KB Output is correct
8 Correct 173 ms 1388 KB Output is correct
9 Correct 15 ms 376 KB Output is correct
10 Correct 174 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 380 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 5 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 1144 KB Output is correct
2 Correct 40 ms 1272 KB Output is correct
3 Correct 29 ms 1016 KB Output is correct
4 Correct 26 ms 1016 KB Output is correct
5 Correct 46 ms 1272 KB Output is correct
6 Correct 66 ms 888 KB Output is correct
7 Correct 105 ms 1144 KB Output is correct
8 Correct 118 ms 1236 KB Output is correct
9 Correct 36 ms 632 KB Output is correct
10 Correct 197 ms 2296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 1272 KB Output is correct
2 Correct 44 ms 1272 KB Output is correct
3 Correct 27 ms 1016 KB Output is correct
4 Correct 33 ms 1144 KB Output is correct
5 Correct 36 ms 1144 KB Output is correct
6 Correct 177 ms 2296 KB Output is correct
7 Correct 46 ms 632 KB Output is correct
8 Correct 105 ms 1144 KB Output is correct
9 Correct 118 ms 1144 KB Output is correct
10 Correct 199 ms 2424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 888 KB Output is correct
2 Correct 27 ms 1016 KB Output is correct
3 Correct 153 ms 2296 KB Output is correct
4 Correct 54 ms 1016 KB Output is correct
5 Correct 66 ms 1144 KB Output is correct
6 Correct 182 ms 2296 KB Output is correct
7 Correct 61 ms 1016 KB Output is correct
8 Correct 64 ms 1016 KB Output is correct
9 Correct 69 ms 1012 KB Output is correct
10 Correct 65 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2296 KB Output is correct
2 Correct 54 ms 2296 KB Output is correct
3 Correct 146 ms 1396 KB Output is correct
4 Correct 101 ms 1144 KB Output is correct
5 Correct 70 ms 1272 KB Output is correct
6 Correct 108 ms 1204 KB Output is correct
7 Correct 59 ms 1016 KB Output is correct
8 Correct 146 ms 1272 KB Output is correct
9 Correct 82 ms 1016 KB Output is correct
10 Correct 178 ms 1400 KB Output is correct