Submission #286433

# Submission time Handle Problem Language Result Execution time Memory
286433 2020-08-30T11:40:25 Z TadijaSebez Stray Cat (JOI20_stray) C++14
15 / 100
78 ms 19316 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

namespace {
	const int N=100050;
	int dist[N];
	vector<int> E[N];
	void AddEdge(int u,int v){E[u].pb(v);E[v].pb(u);}
	void BFS(int n,int m){
		queue<int> q;
		q.push(0);dist[0]=1;
		while(q.size()){
			int u=q.front();
			q.pop();
			for(int v:E[u])if(!dist[v]){
				dist[v]=dist[u]+1;
				q.push(v);
			}
		}
	}
	vector<int> Solve(int n,int m,vector<int> u,vector<int> v){
		vector<int> col;
		for(int i=0;i<m;i++){
			int a=u[i],b=v[i];
			if(dist[a]>dist[b])swap(a,b);
			if(dist[a]==dist[b])col.pb((dist[b]+1)%3);
			else col.pb(dist[b]%3);
		}
		return col;
	}
}  // namespace

vector<int> Mark(int n,int m,int a,int b,vector<int> u,vector<int> v){
	for(int i=0;i<m;i++)::AddEdge(u[i],v[i]);
	::BFS(n,m);
	return ::Solve(n,m,u,v);
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
	int a,b,now;
	bool fir;
}  // namespace

void Init(int a,int b){
	::a=a;
	::b=b;
	::fir=1;
}

int Move(vector<int> y){
	//if(::fir==1){
	//	::fir=0;
		int cnt=0;
		for(int i=0;i<3;i++)if(y[i]!=0)cnt++;
		if(cnt<2){
			assert(cnt==1);
			for(int i=0;i<3;i++)if(y[i]!=0)::now=i;
		}else{
			assert(cnt==2);
			if(y[0]==0)::now=1;
			else if(y[1]==0)::now=2;
			else ::now=0;
		}
		return ::now;
	/*}else{
		::now=(::now+2)%3;
		return ::now;
	}*/
}
# Verdict Execution time Memory Grader output
1 Correct 57 ms 17624 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 43 ms 17392 KB Output is correct
4 Correct 66 ms 19276 KB Output is correct
5 Correct 78 ms 19316 KB Output is correct
6 Correct 51 ms 17888 KB Output is correct
7 Correct 63 ms 18012 KB Output is correct
8 Correct 61 ms 18352 KB Output is correct
9 Correct 60 ms 18508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 17624 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 43 ms 17392 KB Output is correct
4 Correct 66 ms 19276 KB Output is correct
5 Correct 78 ms 19316 KB Output is correct
6 Correct 51 ms 17888 KB Output is correct
7 Correct 63 ms 18012 KB Output is correct
8 Correct 61 ms 18352 KB Output is correct
9 Correct 60 ms 18508 KB Output is correct
10 Correct 48 ms 15780 KB Output is correct
11 Correct 47 ms 16032 KB Output is correct
12 Correct 56 ms 15928 KB Output is correct
13 Correct 49 ms 16000 KB Output is correct
14 Correct 49 ms 16092 KB Output is correct
15 Correct 55 ms 16296 KB Output is correct
16 Correct 59 ms 18920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 15292 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 40 ms 15220 KB Output is correct
4 Correct 68 ms 17100 KB Output is correct
5 Correct 65 ms 17148 KB Output is correct
6 Correct 49 ms 15784 KB Output is correct
7 Correct 49 ms 15776 KB Output is correct
8 Correct 56 ms 16192 KB Output is correct
9 Correct 57 ms 16312 KB Output is correct
10 Correct 54 ms 16060 KB Output is correct
11 Correct 61 ms 16064 KB Output is correct
12 Correct 61 ms 16296 KB Output is correct
13 Correct 54 ms 16080 KB Output is correct
14 Correct 57 ms 16344 KB Output is correct
15 Correct 60 ms 16176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 15292 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 40 ms 15220 KB Output is correct
4 Correct 68 ms 17100 KB Output is correct
5 Correct 65 ms 17148 KB Output is correct
6 Correct 49 ms 15784 KB Output is correct
7 Correct 49 ms 15776 KB Output is correct
8 Correct 56 ms 16192 KB Output is correct
9 Correct 57 ms 16312 KB Output is correct
10 Correct 54 ms 16060 KB Output is correct
11 Correct 61 ms 16064 KB Output is correct
12 Correct 61 ms 16296 KB Output is correct
13 Correct 54 ms 16080 KB Output is correct
14 Correct 57 ms 16344 KB Output is correct
15 Correct 60 ms 16176 KB Output is correct
16 Correct 42 ms 14108 KB Output is correct
17 Correct 42 ms 14056 KB Output is correct
18 Correct 48 ms 14000 KB Output is correct
19 Correct 48 ms 14000 KB Output is correct
20 Correct 53 ms 14512 KB Output is correct
21 Correct 56 ms 14504 KB Output is correct
22 Correct 54 ms 16596 KB Output is correct
23 Correct 47 ms 14236 KB Output is correct
24 Correct 46 ms 14228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5440 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 8448 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 8192 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -