Submission #799808

# Submission time Handle Problem Language Result Execution time Memory
799808 2023-08-01T04:28:50 Z Trisanu_Das Sajam (COCI18_sajam) C++17
90 / 90
105 ms 3284 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\n";
			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\n";
			return 0;
		}
		b[0][i].flip();
	}
	cout << "NE\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 4 ms 664 KB Output is correct
3 Correct 5 ms 1108 KB Output is correct
4 Correct 14 ms 2132 KB Output is correct
5 Correct 5 ms 1084 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 29 ms 1088 KB Output is correct
8 Correct 92 ms 2164 KB Output is correct
9 Correct 6 ms 468 KB Output is correct
10 Correct 94 ms 2196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1620 KB Output is correct
2 Correct 16 ms 1868 KB Output is correct
3 Correct 8 ms 1516 KB Output is correct
4 Correct 7 ms 1380 KB Output is correct
5 Correct 14 ms 2004 KB Output is correct
6 Correct 31 ms 1188 KB Output is correct
7 Correct 67 ms 1652 KB Output is correct
8 Correct 64 ms 1744 KB Output is correct
9 Correct 18 ms 732 KB Output is correct
10 Correct 105 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2012 KB Output is correct
2 Correct 13 ms 1960 KB Output is correct
3 Correct 7 ms 1364 KB Output is correct
4 Correct 9 ms 1620 KB Output is correct
5 Correct 10 ms 1620 KB Output is correct
6 Correct 100 ms 3188 KB Output is correct
7 Correct 25 ms 724 KB Output is correct
8 Correct 59 ms 1492 KB Output is correct
9 Correct 61 ms 1608 KB Output is correct
10 Correct 104 ms 3228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1364 KB Output is correct
2 Correct 7 ms 1404 KB Output is correct
3 Correct 83 ms 3248 KB Output is correct
4 Correct 27 ms 1120 KB Output is correct
5 Correct 31 ms 1452 KB Output is correct
6 Correct 97 ms 3108 KB Output is correct
7 Correct 30 ms 1260 KB Output is correct
8 Correct 33 ms 1240 KB Output is correct
9 Correct 35 ms 1236 KB Output is correct
10 Correct 37 ms 1252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 3284 KB Output is correct
2 Correct 16 ms 3224 KB Output is correct
3 Correct 74 ms 2132 KB Output is correct
4 Correct 55 ms 1600 KB Output is correct
5 Correct 36 ms 1624 KB Output is correct
6 Correct 59 ms 1696 KB Output is correct
7 Correct 31 ms 1208 KB Output is correct
8 Correct 90 ms 2132 KB Output is correct
9 Correct 45 ms 1412 KB Output is correct
10 Correct 98 ms 2232 KB Output is correct