Submission #163220

# Submission time Handle Problem Language Result Execution time Memory
163220 2019-11-11T22:23:26 Z qkxwsm Sajam (COCI18_sajam) C++14
45 / 90
87 ms 1500 KB
#include <bits/stdc++.h>

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define MAXN 1013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

int N, K;
bitset<MAXN> grid[MAXN];

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cout << fixed << setprecision(12);
	cerr << fixed << setprecision(4);
	cin >> N >> K;
	FOR(i, 0, N)
	{
		string temps; cin >> temps;
		FOR(j, 0, N)
		{
			grid[i][j] = (temps[j] == 'o');
		}
	}
	FOR(i, 0, N)
	{
		//dude ok what the fuck.
		FOR(j, 0, N)
		{
			if (i == j) continue;
			grid[j] ^= grid[i];
		}
		grid[i].reset();
		int res = 0;
		FOR(j, 0, N)
		{
			int x = grid[j].count();
			res += min(x, N - x);
			// FOR(k, 0, N)
			// {
			// 	cerr << grid[j][k] << ' ';
			// }
			// cerr << endl;
		}
		if (res <= K)
		{
			cout << "DA\n";
			return 0;
		}
	}
	//bleh now the N=K case
	cout << "NE\n";
	return 0;
	//there has to be a row with <=1.
	//fix a specific row and column.
	//What's the minimum we could have on after a series of operations.
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 4 ms 632 KB Output is correct
3 Correct 4 ms 632 KB Output is correct
4 Correct 6 ms 1272 KB Output is correct
5 Correct 3 ms 632 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 24 ms 680 KB Output is correct
8 Correct 76 ms 1272 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 77 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 3 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1016 KB Output is correct
2 Correct 5 ms 1144 KB Output is correct
3 Correct 5 ms 888 KB Output is correct
4 Correct 4 ms 888 KB Output is correct
5 Correct 6 ms 1272 KB Output is correct
6 Correct 26 ms 760 KB Output is correct
7 Correct 47 ms 1144 KB Output is correct
8 Correct 51 ms 1016 KB Output is correct
9 Correct 16 ms 504 KB Output is correct
10 Correct 86 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1144 KB Output is correct
2 Correct 6 ms 1144 KB Output is correct
3 Correct 4 ms 888 KB Output is correct
4 Correct 5 ms 1016 KB Output is correct
5 Correct 5 ms 1016 KB Output is correct
6 Correct 79 ms 1400 KB Output is correct
7 Correct 20 ms 632 KB Output is correct
8 Correct 45 ms 1016 KB Output is correct
9 Correct 51 ms 1016 KB Output is correct
10 Correct 87 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 888 KB Output is correct
2 Correct 5 ms 932 KB Output is correct
3 Incorrect 82 ms 1500 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1400 KB Output is correct
2 Correct 7 ms 1400 KB Output is correct
3 Incorrect 73 ms 1400 KB Output isn't correct
4 Halted 0 ms 0 KB -