답안 #945469

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
945469 2024-03-13T23:05:09 Z Darren0724 길고양이 (JOI20_stray) C++17
9 / 100
39 ms 16676 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) {
	//cout<<y[0]<<' '<<y[1]<<' '<<last<<endl;
	if(sure){
		int tot=y[0]+y[1];
		if(min(y[0],y[1])==0){
			return last=(y[0]?0:1);
		}
		else{
			if(y[last^1]==0)cout<<"NO"<<endl;
			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);
			assert(y[last]!=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==0){
					sure=1;
					return last=(y[0]?0:1);
				}
				else{
					sure=1;
					return -1;				
				}
			}
			else{
				last=(y[0]?0:1);
				return last;
			}
		}
		else{
			y[last]++;
			if(y[0]==1){
				int t=(last==0?-1:0);
				last=0;
				sure=1;
				return t;
			}
			else{
				int t=(last==1?-1:1);
				last=1;
				sure=1;
				return t;
			}
		}
	}
	assert(false);
}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:14:7: warning: unused variable 'tot' [-Wunused-variable]
   14 |   int tot=y[0]+y[1];
      |       ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 16676 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 16676 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 14152 KB Output is correct
2 Correct 2 ms 1300 KB Output is correct
3 Correct 27 ms 13088 KB Output is correct
4 Correct 34 ms 16216 KB Output is correct
5 Correct 34 ms 16128 KB Output is correct
6 Incorrect 25 ms 13628 KB Wrong Answer [6]
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 14152 KB Output is correct
2 Correct 2 ms 1300 KB Output is correct
3 Correct 27 ms 13088 KB Output is correct
4 Correct 34 ms 16216 KB Output is correct
5 Correct 34 ms 16128 KB Output is correct
6 Incorrect 25 ms 13628 KB Wrong Answer [6]
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1572 KB Output is correct
2 Correct 1 ms 1300 KB Output is correct
3 Correct 1 ms 1568 KB Output is correct
4 Correct 2 ms 1876 KB Output is correct
5 Correct 2 ms 1816 KB Output is correct
6 Correct 2 ms 1828 KB Output is correct
7 Correct 2 ms 1812 KB Output is correct
8 Correct 2 ms 1832 KB Output is correct
9 Correct 2 ms 1812 KB Output is correct
10 Correct 2 ms 1828 KB Output is correct
11 Correct 2 ms 1812 KB Output is correct
12 Correct 1 ms 1816 KB Output is correct
13 Correct 2 ms 1828 KB Output is correct
14 Correct 2 ms 1828 KB Output is correct
15 Correct 1 ms 1824 KB Output is correct
16 Correct 2 ms 1572 KB Output is correct
17 Correct 2 ms 1816 KB Output is correct
18 Correct 1 ms 1564 KB Output is correct
19 Correct 2 ms 1568 KB Output is correct
20 Correct 1 ms 1572 KB Output is correct
21 Correct 2 ms 1572 KB Output is correct
22 Correct 1 ms 1820 KB Output is correct
23 Correct 2 ms 1572 KB Output is correct
24 Correct 2 ms 1564 KB Output is correct
25 Correct 2 ms 1820 KB Output is correct
26 Incorrect 2 ms 1564 KB Wrong Answer [5]
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11820 KB Output is correct
2 Correct 27 ms 12864 KB Output is correct
3 Correct 1 ms 1300 KB Output is correct
4 Correct 26 ms 11688 KB Output is correct
5 Correct 30 ms 14668 KB Output is correct
6 Correct 36 ms 14636 KB Output is correct
7 Correct 27 ms 13644 KB Output is correct
8 Correct 27 ms 13668 KB Output is correct
9 Correct 32 ms 14668 KB Output is correct
10 Correct 32 ms 14616 KB Output is correct
11 Correct 32 ms 14692 KB Output is correct
12 Correct 32 ms 14536 KB Output is correct
13 Correct 30 ms 14636 KB Output is correct
14 Correct 32 ms 14688 KB Output is correct
15 Correct 30 ms 14628 KB Output is correct
16 Correct 39 ms 15164 KB Output is correct
17 Correct 28 ms 14232 KB Output is correct
18 Correct 32 ms 14264 KB Output is correct
19 Correct 30 ms 14396 KB Output is correct
20 Correct 30 ms 14428 KB Output is correct
21 Correct 30 ms 14432 KB Output is correct
22 Correct 30 ms 14416 KB Output is correct
23 Correct 34 ms 11852 KB Output is correct
24 Correct 25 ms 11804 KB Output is correct
25 Correct 26 ms 12120 KB Output is correct
26 Correct 26 ms 12056 KB Output is correct
27 Correct 27 ms 13144 KB Output is correct
28 Correct 28 ms 13144 KB Output is correct
29 Correct 36 ms 13568 KB Output is correct
30 Correct 27 ms 13132 KB Output is correct
31 Correct 26 ms 11832 KB Output is correct
32 Correct 24 ms 11848 KB Output is correct
33 Correct 30 ms 12372 KB Output is correct
34 Correct 26 ms 12340 KB Output is correct
35 Incorrect 24 ms 12884 KB Wrong Answer [5]
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11848 KB Output is correct
2 Correct 28 ms 12824 KB Output is correct
3 Correct 1 ms 1300 KB Output is correct
4 Correct 22 ms 11568 KB Output is correct
5 Correct 33 ms 14560 KB Output is correct
6 Correct 31 ms 14924 KB Output is correct
7 Correct 26 ms 13660 KB Output is correct
8 Correct 27 ms 13652 KB Output is correct
9 Correct 31 ms 14628 KB Output is correct
10 Correct 31 ms 14664 KB Output is correct
11 Correct 30 ms 14812 KB Output is correct
12 Correct 34 ms 14668 KB Output is correct
13 Correct 31 ms 14600 KB Output is correct
14 Correct 32 ms 14672 KB Output is correct
15 Correct 30 ms 14668 KB Output is correct
16 Correct 35 ms 14676 KB Output is correct
17 Correct 28 ms 14380 KB Output is correct
18 Correct 28 ms 14680 KB Output is correct
19 Correct 28 ms 14424 KB Output is correct
20 Correct 30 ms 14432 KB Output is correct
21 Correct 35 ms 14488 KB Output is correct
22 Correct 28 ms 14420 KB Output is correct
23 Correct 24 ms 11844 KB Output is correct
24 Correct 24 ms 11836 KB Output is correct
25 Correct 27 ms 12124 KB Output is correct
26 Correct 26 ms 12108 KB Output is correct
27 Correct 27 ms 13096 KB Output is correct
28 Correct 27 ms 13128 KB Output is correct
29 Correct 27 ms 13140 KB Output is correct
30 Correct 28 ms 13028 KB Output is correct
31 Correct 26 ms 11868 KB Output is correct
32 Correct 25 ms 11852 KB Output is correct
33 Correct 26 ms 12252 KB Output is correct
34 Correct 26 ms 12024 KB Output is correct
35 Correct 27 ms 13096 KB Output is correct
36 Correct 27 ms 13076 KB Output is correct
37 Correct 31 ms 13128 KB Output is correct
38 Correct 27 ms 13076 KB Output is correct
39 Correct 27 ms 13132 KB Output is correct
40 Correct 27 ms 13072 KB Output is correct
41 Correct 28 ms 13656 KB Output is correct
42 Correct 30 ms 13660 KB Output is correct
43 Correct 28 ms 13652 KB Output is correct
44 Correct 31 ms 13716 KB Output is correct
45 Correct 28 ms 13644 KB Output is correct
46 Correct 28 ms 13712 KB Output is correct
47 Correct 32 ms 12820 KB Output is correct
48 Correct 27 ms 13028 KB Output is correct
49 Correct 27 ms 12868 KB Output is correct
50 Correct 27 ms 12784 KB Output is correct
51 Correct 25 ms 11868 KB Output is correct
52 Correct 26 ms 11800 KB Output is correct
53 Correct 25 ms 11860 KB Output is correct
54 Correct 25 ms 11848 KB Output is correct
55 Correct 26 ms 11908 KB Output is correct
56 Correct 26 ms 11848 KB Output is correct
57 Correct 25 ms 11948 KB Output is correct
58 Correct 29 ms 12116 KB Output is correct
59 Correct 26 ms 12128 KB Output is correct
60 Correct 26 ms 12116 KB Output is correct