답안 #944363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
944363 2024-03-12T15:50:56 Z Darren0724 길고양이 (JOI20_stray) C++17
0 / 100
36 ms 28740 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
string str="001011";
const int N=20005;
vector<int> v,adj[N+1],deg(N),e(N);
const int INF=1e9;
void dfs(int k,int pa,int dis,int up){
	for(int i:adj[k]){
		int j=e[i]^k;
		if(j==pa)continue;
		if(deg[k]<=2){
			v[i]=str[dis%6]-'0';
		}
		else{
			v[i]=up^1;
		}
		dfs(j,k,dis+1,v[i]);
	}
}
vector<int> Mark(int N, int M, int A, int B,vector<int> U, vector<int> V) {
	v.resize(M,-1);
	queue<int> q;
  	vector<int> dis(N+1,INF);
	for(int i=0;i<M;i++){
		adj[U[i]].push_back(i);
		adj[V[i]].push_back(i);
		deg[U[i]]++;
		deg[V[i]]++;
		e[i]=U[i]^V[i];
	}
	dfs(0,0,0,0);
  	return v;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
int last=-1,sure=0;
vector<int> tmp={0,0,1,0,1,1};
vector<int> rec;
void Init(int A, int B) {

}

int Move(vector<int> y) {
	if(sure){
		int tot=y[0]+y[1];
		if(tot==1){
			return last=(y[0]?0:1);
		}
		else{
			return last=last^1;
		}
	}

  	if(last==-1){
		int tot=y[0]+y[1];
		if(tot==1){
			sure=1;
			last=(y[0]?0:1);
			return last;
		}
		else if(tot==2){
			if(y[0]&&y[1]){
				rec.push_back(0);
				rec.push_back(1);
				return last=1;
			}
			else if(y[0]==2){
				rec.push_back(0);
				rec.push_back(0);
				return last=0;
			}
			else{
				rec.push_back(1);
				rec.push_back(1);
				return last=1;
			}
		}
		else{
			sure=1;
			last=(y[0]>y[1]?1:0);
			return last;
		}
	}
	else{
		int tot=y[0]+y[1];
		if(tot==0){
			sure=1;
			return -1;
		}
		else if(tot==1){
			rec.push_back((y[0]?0:1));
			if(rec.size()==5){
				int flag=0;
				for(int i=0;i<6;i++){
					vector<int> a(tmp.begin(),tmp.begin()+5);
					if(a==rec){
						flag=1;
						break;
					}
					rotate(tmp.begin(),tmp.begin()+1,tmp.end());
				}
				if(flag){
					sure=1;
					return last=(y[0]?0:1);
				}
				else{
					sure=1;
					return -1;				
				}
			}
		}
		else{
			y[last]++;
			if(y[0]==1){
				last=0;
				sure=1;
				return (last==0?-1:0);
			}
			else{
				last=1;
				sure=1;
				return (last==1?-1:1);;
			}
		}
	}
	assert(false);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 28740 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 28740 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 14068 KB Output is correct
2 Correct 1 ms 1300 KB Output is correct
3 Correct 24 ms 13256 KB Output is correct
4 Correct 32 ms 16208 KB Output is correct
5 Runtime error 35 ms 25912 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 14068 KB Output is correct
2 Correct 1 ms 1300 KB Output is correct
3 Correct 24 ms 13256 KB Output is correct
4 Correct 32 ms 16208 KB Output is correct
5 Runtime error 35 ms 25912 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1564 KB Output is correct
2 Correct 1 ms 1296 KB Output is correct
3 Correct 1 ms 1572 KB Output is correct
4 Correct 2 ms 1828 KB Output is correct
5 Correct 2 ms 1828 KB Output is correct
6 Runtime error 2 ms 2076 KB Execution killed with signal 6
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 11864 KB Output is correct
2 Runtime error 31 ms 21328 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11832 KB Output is correct
2 Runtime error 28 ms 21124 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -