Submission #199812

# Submission time Handle Problem Language Result Execution time Memory
199812 2020-02-03T13:36:37 Z mohammedehab2002 Sajam (COCI18_sajam) C++11
45 / 90
96 ms 3324 KB
#include <bits/stdc++.h>
using namespace std;
pair<int,int> par[2005];
string s[1005];
pair<int,int> find(pair<int,int> x)
{
	if (par[x.first]==x)
	return x;
	auto p=find(par[x.first]);
	p.second^=par[x.first].second;
	return par[x.first]=p;
}
int Union(int x,int y,int a)
{
	auto xx=find({x,0}),yy=find({y,0});
	if (xx.first==yy.first)
	return ((xx.second^yy.second)!=a);
	par[xx.first]={yy.first,(a^xx.second^yy.second)};
	return 0;
}
int main()
{
	int n,k;
	cin >> n >> k;
	for (int i=0;i<2*n;i++)
	par[i]={i,0};
	for (int i=0;i<n;i++)
	{
		cin >> s[i];
		for (int j=0;j<n;j++)
		k-=Union(i,j+n,s[i][j]=='o');
	}
	printf(k>=0? "DA":"NE");
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 20 ms 760 KB Output is correct
3 Correct 27 ms 1144 KB Output is correct
4 Correct 75 ms 2040 KB Output is correct
5 Correct 27 ms 1016 KB Output is correct
6 Correct 14 ms 632 KB Output is correct
7 Correct 27 ms 1020 KB Output is correct
8 Correct 77 ms 2168 KB Output is correct
9 Correct 9 ms 504 KB Output is correct
10 Correct 80 ms 2168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 6 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 1656 KB Output is correct
2 Correct 67 ms 1912 KB Output is correct
3 Correct 43 ms 1528 KB Output is correct
4 Correct 39 ms 1400 KB Output is correct
5 Correct 75 ms 2044 KB Output is correct
6 Correct 30 ms 1148 KB Output is correct
7 Correct 51 ms 1656 KB Output is correct
8 Correct 54 ms 1656 KB Output is correct
9 Correct 18 ms 760 KB Output is correct
10 Correct 88 ms 3192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 1912 KB Output is correct
2 Correct 67 ms 1912 KB Output is correct
3 Correct 40 ms 1400 KB Output is correct
4 Correct 50 ms 1656 KB Output is correct
5 Correct 54 ms 1656 KB Output is correct
6 Correct 83 ms 3168 KB Output is correct
7 Correct 23 ms 760 KB Output is correct
8 Correct 48 ms 1528 KB Output is correct
9 Correct 53 ms 1656 KB Output is correct
10 Correct 88 ms 3192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1400 KB Output is correct
2 Correct 41 ms 1400 KB Output is correct
3 Incorrect 91 ms 3192 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 90 ms 3324 KB Output is correct
2 Correct 96 ms 3192 KB Output is correct
3 Incorrect 79 ms 2136 KB Output isn't correct
4 Halted 0 ms 0 KB -