Submission #230545

# Submission time Handle Problem Language Result Execution time Memory
230545 2020-05-10T10:39:46 Z VEGAnn Sajam (COCI18_sajam) C++14
45 / 90
1175 ms 1916 KB
# include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
//# define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0LL)
# define debug(x) cerr<< #x << " = " << x << endl
# define ddebug(x, y) cerr<< #x << " = " << x  << ", " << #y << " = " << y << endl
# define tdebug(x, y, z) cerr<< #x << " = " << x  << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
# define bin(x) cerr<< #x << " : " << bitset<4>(x) << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define MP make_pair
# define uop(x, y) pii(min(x, y), max(x, y))
 
const int MAXN = 1000 + 10;
bool a[MAXN][MAXN];
int sum[MAXN];
 
int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
	int n, k;
	cin >> n >> k;
 
	for (int i = 0; i < n; i ++)
		for (int j = 0; j < n; j ++)
		{
			char c;
			cin >> c;
			a[i][j] = (c == 'x');
		}
 
	for (int x = 0; x < n; x ++)
	{
		memset(sum, 0, sizeof sum);
		for (int j = 0; j < n; j ++)
			for (int i = 0; i < n; i ++)
				sum[i] += a[i][j] ^ a[x][j];
 
		int s = 0;
		for (int i = 0; i < n; i ++)
			s += min(sum[i], n - sum[i]);
		if (s <= k)
			kill("DA");
	}
	if (k != n)
		kill("NE");
 
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 8 ms 896 KB Output is correct
3 Correct 9 ms 1152 KB Output is correct
4 Correct 22 ms 1664 KB Output is correct
5 Correct 9 ms 1152 KB Output is correct
6 Correct 6 ms 768 KB Output is correct
7 Correct 145 ms 1024 KB Output is correct
8 Correct 967 ms 1784 KB Output is correct
9 Correct 17 ms 640 KB Output is correct
10 Correct 1000 ms 1768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1564 KB Output is correct
2 Correct 16 ms 1664 KB Output is correct
3 Correct 13 ms 1408 KB Output is correct
4 Correct 12 ms 1408 KB Output is correct
5 Correct 19 ms 1664 KB Output is correct
6 Correct 177 ms 1152 KB Output is correct
7 Correct 496 ms 1632 KB Output is correct
8 Correct 576 ms 1656 KB Output is correct
9 Correct 75 ms 896 KB Output is correct
10 Correct 1156 ms 1816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1664 KB Output is correct
2 Correct 17 ms 1664 KB Output is correct
3 Correct 12 ms 1384 KB Output is correct
4 Correct 14 ms 1536 KB Output is correct
5 Correct 15 ms 1536 KB Output is correct
6 Correct 1075 ms 1804 KB Output is correct
7 Correct 123 ms 1024 KB Output is correct
8 Correct 461 ms 1568 KB Output is correct
9 Correct 527 ms 1656 KB Output is correct
10 Correct 1175 ms 1916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1408 KB Output is correct
2 Correct 12 ms 1408 KB Output is correct
3 Incorrect 1172 ms 1792 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1792 KB Output is correct
2 Correct 21 ms 1784 KB Output is correct
3 Incorrect 985 ms 1664 KB Output isn't correct
4 Halted 0 ms 0 KB -