답안 #778534

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778534 2023-07-10T11:47:41 Z bachhoangxuan 길고양이 (JOI20_stray) C++17
컴파일 오류
0 ms 0 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
namespace {
    int c[]={0,1,0,0,1,1};
}
 
vector<int> Mark(int N, int M, int A, int B,vector<int> U,vector<int> V) {
    vector<int> X(M),dep(N,-1);
    vector<vector<pii>> edge(N);
    for(int i=0;i<M;i++) edge[U[i]].push_back({V[i],i}),edge[V[i]].push_back({U[i],i});
    queue<pii> q;q.push({0,0});dep[0]=0;
    while(!q.empty()){
        auto [u,d]=q.front();q.pop();
        for(auto [v,id]:edge[u]){
            if(B){
                if(dep[v]!=-1) continue;
                int nd=((int)edge[v].size()==2?(d+1)%6:(c[d]^1));
                q.push({v,dep[v]=nd});X[id]=c[d];
            }
            else if(dep[v]==-1) dep[v]=d+1,q.push({v,dep[v]});
        }
    }
    if(!B) for(int i=0;i<M;i++) X[i]=min(dep[U[i]],dep[V[i]])%3;
    return X;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
 
namespace {
    int A,B,p=-1;
    int up=0,st=0,num=0;
    int f[81];
}
 
void Init(int _A, int _B) {
    A=_A;B=_B
    f[39]=-1;f[43]=0;f[32]=-1;f[13]=1;
    f[16]=-1;f[31]=0;f[67]=-1;f[64]=1;
}
 
int Move(vector<int> y) {
    auto g = [&](int val){return p=(val==-1?p:val),val;};
    if(A==2){
        int d=y[0]+y[1]+(st!=0);st++;
        if(up) return g(d>=3?(p^1):y[1]);
        if(d==1) return up=true,g(st!=1?-1:y[1]);
        if(d>2) return up=true,g(y[0]==0 || y[1]==0?-1:(y[1]+(p==1)>y[0]+(p==0)?0:1));
        num=num*3+y[1]+(p==1);
        if(st<4) return g(!y[0]);
        else return up=true,g(f[num]);
    }
    else for(int i=0;i<3;i++) if(y[i] && !y[(i+2)%3]) return i;
}

Compilation message

Catherine.cpp: In function 'void Init(int, int)':
Catherine.cpp:12:14: error: expected ';' before 'f'
   12 |     A=_A;B=_B
      |              ^
      |              ;
   13 |     f[39]=-1;f[43]=0;f[32]=-1;f[13]=1;
      |     ~         
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^