답안 #286436

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
286436 2020-08-30T11:48:16 Z TadijaSebez 길고양이 (JOI20_stray) C++14
20 / 100
77 ms 19056 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;
	}
	vector<int> Solve2(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)%2);
			else col.pb(dist[b]%2);
		}
		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);
	if(a>2)return ::Solve(n,m,u,v);
	else return ::Solve2(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;
	if(a==2)::now=1;
}

int Move(vector<int> y){
	if(::a>2){
	//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;
	}*/
	}else{
		if(!y[0]&&!y[1])return -1;
		::now^=1;
		if(!y[::now])::now^=1;
		return ::now;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 17716 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 43 ms 16728 KB Output is correct
4 Correct 74 ms 19056 KB Output is correct
5 Correct 68 ms 19056 KB Output is correct
6 Correct 52 ms 17436 KB Output is correct
7 Correct 51 ms 17376 KB Output is correct
8 Correct 65 ms 18004 KB Output is correct
9 Correct 62 ms 18240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 17716 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 43 ms 16728 KB Output is correct
4 Correct 74 ms 19056 KB Output is correct
5 Correct 68 ms 19056 KB Output is correct
6 Correct 52 ms 17436 KB Output is correct
7 Correct 51 ms 17376 KB Output is correct
8 Correct 65 ms 18004 KB Output is correct
9 Correct 62 ms 18240 KB Output is correct
10 Correct 48 ms 15356 KB Output is correct
11 Correct 49 ms 15500 KB Output is correct
12 Correct 46 ms 15488 KB Output is correct
13 Correct 49 ms 15488 KB Output is correct
14 Correct 48 ms 15784 KB Output is correct
15 Correct 54 ms 16176 KB Output is correct
16 Correct 59 ms 18452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 15292 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 41 ms 14556 KB Output is correct
4 Correct 77 ms 16628 KB Output is correct
5 Correct 69 ms 16880 KB Output is correct
6 Correct 51 ms 15284 KB Output is correct
7 Correct 52 ms 15284 KB Output is correct
8 Correct 61 ms 16068 KB Output is correct
9 Correct 66 ms 16060 KB Output is correct
10 Correct 56 ms 15584 KB Output is correct
11 Correct 59 ms 15820 KB Output is correct
12 Correct 56 ms 15804 KB Output is correct
13 Correct 60 ms 15576 KB Output is correct
14 Correct 64 ms 15840 KB Output is correct
15 Correct 64 ms 16064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 15292 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 41 ms 14556 KB Output is correct
4 Correct 77 ms 16628 KB Output is correct
5 Correct 69 ms 16880 KB Output is correct
6 Correct 51 ms 15284 KB Output is correct
7 Correct 52 ms 15284 KB Output is correct
8 Correct 61 ms 16068 KB Output is correct
9 Correct 66 ms 16060 KB Output is correct
10 Correct 56 ms 15584 KB Output is correct
11 Correct 59 ms 15820 KB Output is correct
12 Correct 56 ms 15804 KB Output is correct
13 Correct 60 ms 15576 KB Output is correct
14 Correct 64 ms 15840 KB Output is correct
15 Correct 64 ms 16064 KB Output is correct
16 Correct 44 ms 13536 KB Output is correct
17 Correct 44 ms 13548 KB Output is correct
18 Correct 50 ms 13588 KB Output is correct
19 Correct 52 ms 13580 KB Output is correct
20 Correct 68 ms 14036 KB Output is correct
21 Correct 48 ms 13988 KB Output is correct
22 Correct 55 ms 16028 KB Output is correct
23 Correct 45 ms 13728 KB Output is correct
24 Correct 46 ms 13720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5376 KB Output is correct
2 Correct 2 ms 5376 KB Output is correct
3 Correct 3 ms 5376 KB Output is correct
4 Correct 3 ms 5376 KB Output is correct
5 Correct 3 ms 5376 KB Output is correct
6 Correct 3 ms 5376 KB Output is correct
7 Correct 3 ms 5376 KB Output is correct
8 Correct 4 ms 5376 KB Output is correct
9 Correct 3 ms 5376 KB Output is correct
10 Correct 4 ms 5376 KB Output is correct
11 Correct 3 ms 5376 KB Output is correct
12 Correct 4 ms 5376 KB Output is correct
13 Correct 4 ms 5376 KB Output is correct
14 Correct 4 ms 5376 KB Output is correct
15 Correct 4 ms 5376 KB Output is correct
16 Correct 3 ms 5376 KB Output is correct
17 Correct 4 ms 5376 KB Output is correct
18 Correct 4 ms 5376 KB Output is correct
19 Correct 4 ms 5376 KB Output is correct
20 Correct 4 ms 5376 KB Output is correct
21 Correct 4 ms 5376 KB Output is correct
22 Correct 3 ms 5376 KB Output is correct
23 Correct 5 ms 5376 KB Output is correct
24 Correct 3 ms 5376 KB Output is correct
25 Correct 3 ms 5376 KB Output is correct
26 Correct 4 ms 5376 KB Output is correct
27 Correct 3 ms 5376 KB Output is correct
28 Correct 4 ms 5376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 13472 KB Output is correct
2 Correct 51 ms 14260 KB Output is correct
3 Correct 2 ms 5376 KB Output is correct
4 Correct 41 ms 13444 KB Output is correct
5 Correct 64 ms 15356 KB Output is correct
6 Correct 62 ms 15408 KB Output is correct
7 Correct 52 ms 14544 KB Output is correct
8 Incorrect 52 ms 14532 KB Wrong Answer [6]
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 13472 KB Output is correct
2 Correct 56 ms 14176 KB Output is correct
3 Correct 3 ms 5376 KB Output is correct
4 Correct 41 ms 13460 KB Output is correct
5 Correct 60 ms 15444 KB Output is correct
6 Correct 63 ms 15428 KB Output is correct
7 Correct 48 ms 14548 KB Output is correct
8 Incorrect 46 ms 14544 KB Wrong Answer [6]
9 Halted 0 ms 0 KB -