답안 #945349

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
945349 2024-03-13T16:37:41 Z Darren0724 길고양이 (JOI20_stray) C++17
컴파일 오류
0 ms 0 KB
#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(min(y[0],y[1])==0){
			return last=(y[0]?0:1);
		}
		else{
			assert(y[last^1]!=0);
			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==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){
				last=0;
				sure=1;
				return (last==0?-1:0);
			}
			else{
				last=1;
				sure=1;
				return (last==1?-1:1);
			}
		}
	}
	assert(false);
}



    

Compilation message

Anthony.cpp: In function 'int Move(std::vector<int>)':
Anthony.cpp:13:7: warning: unused variable 'tot' [-Wunused-variable]
   13 |   int tot=y[0]+y[1];
      |       ^~~
/usr/bin/ld: /tmp/cciHVlco.o: in function `main':
grader_anthony.cpp:(.text.startup+0x191): undefined reference to `Mark(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccS0QYx9.o: in function `main':
grader_catherine.cpp:(.text.startup+0x41c): undefined reference to `Init(int, int)'
/usr/bin/ld: grader_catherine.cpp:(.text.startup+0xcfa): undefined reference to `Move(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status