Submission #288891

# Submission time Handle Problem Language Result Execution time Memory
288891 2020-09-02T06:19:22 Z mohammedehab2002 Stray Cat (JOI20_stray) C++17
0 / 100
45 ms 16532 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
namespace
{
	int seq[]={1,0,1,1,0,0};
	vector<pair<int,int> > v[20005];
	vector<int> ans;
}
void dfs(int node,int p,int idx,int gp)
{
	int c=(int)v[node].size()-(p!=-1);
	for (auto u:v[node])
	{
		if (u.first!=p)
		{
			if (c==1)
			{
				ans[u.second]=seq[idx];
				dfs(u.first,node,(idx+1)%6,seq[idx]);
			}
			else
			{
				ans[u.second]=!gp;
				dfs(u.first,node,0,!gp);
			}
		}
	}
}
vector<int> Mark(int n,int m,int A,int B,vector<int> a,vector<int> b)
{
	for (int i=0;i<m;i++)
	{
		v[a[i]].push_back({b[i],i});
		v[b[i]].push_back({a[i],i});
	}
	ans.resize(m);
	dfs(0,-1,0,0);
	return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace
{
	bool f;
	int l,seq[]={1,0,1,1,0,0};
	vector<int> p;
}
void Init(int A, int B){}
int Move(vector<int> y)
{
	if (!f)
	{
		f=1;
		bool b=(y[0]>y[1]);
		if (y[0]+y[1]==2)
		p.push_back(b);
		return l=b;
	}
	if (!y[0] && !y[1])
	{
		p.clear();
		return -1;
	}
	if (p.size()==6)
	{
		for (int i=0;i<6;i++)
		{
			bool eq=1;
			for (int j=0;j<6;j++)
			eq&=(p[(i+j)%6]==seq[j]);
			if (eq)
			{
				p.clear();
				return -1;
			}
		}
	}
	if (y[0]+y[1]==1)
	{
		p.push_back(y[1]);
		return l=y[1];
	}
	p.clear();
	if (y[!l])
	{
		l^=1;
		return l;
	}
	return -1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 16532 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 16532 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 14340 KB Output is correct
2 Incorrect 1 ms 1536 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 14340 KB Output is correct
2 Incorrect 1 ms 1536 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1536 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 2 ms 1792 KB Output is correct
4 Incorrect 2 ms 1792 KB Wrong Answer [5]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 11636 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 11776 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -