답안 #212440

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
212440 2020-03-23T03:48:43 Z Sweetlemon 길고양이 (JOI20_stray) C++14
0 / 100
60 ms 15992 KB
#include "Anthony.h"
#include <vector>
#include <algorithm>

using namespace std;

namespace {

const int MAXN=20005;
const int INF=19260817;
vector<int> g[MAXN];
int dep[MAXN],par[MAXN],col[MAXN],stat[MAXN];
const int arr[]={0,0,1,0,1,1};

void dfs(int x){
    stat[x]=stat[par[x]]+1,(stat[x]==6)?(stat[x]=0):(0);
    col[x]=arr[stat[x]];
    if (g[x].size()>2)
        stat[x]=(col[x])?(0):(1);
    for (auto v:g[x]){
        if (v==par[x])
            continue;
        dep[v]=dep[x]+1,par[v]=x;
        dfs(v);
    }
}

}  // 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++){
        g[U[i]].push_back(V[i]);
        g[V[i]].push_back(U[i]);
    }
    dfs(0);
    vector<int> anss;
    for (int i=0;i<m;i++){
        int ncol;
        int u=U[i];
        int v=V[i];
        if (u==par[v])
            ncol=col[v];
        if (v==par[u])
            ncol=col[u];
        anss.push_back(ncol);
    }
    return anss;
}
#include "Catherine.h"
#include <vector>

using namespace std;
namespace {

int a,b;
int moves;
int lstmv;
int detecting;
const int arr[]={0,0,1,0,1,1};
int detect_val=0;

}  // namespace

void Init(int A,int B){
    a=A;
    b=B;
    moves=0;
    lstmv=-1;
    detecting=0;
}

int Move(vector<int> y) {
    int hscnt=0;
    for (int i=0;i<a;i++){
        hscnt+=y[i];
    }
    if (!moves){
        if (hscnt>2){
            detecting=39;
            return (lstmv=(y[1]<y[0]));
        }
        detecting=1;
        if (y[0]==2)
            lstmv=0,detect_val=0;
        else if (y[0]==1)
            lstmv=0,detect_val=2;
        else
            lstmv=1,detect_val=3;
        return lstmv;
    }
    if (detecting<3){
        detecting++;
        if (!hscnt){
            detecting=39;
            return -1;
        }
        if (hscnt+1>2){
            detecting=39;
            y[lstmv]++;
            if (y[0]>y[1]){
                lstmv=1;
                return (lstmv==1)?(-1):(1);
            }
            lstmv=0;
            return (lstmv==0)?(-1):(0);
        }
        (y[0])?(lstmv=0):(lstmv=1);
        detect_val=detect_val*2+lstmv;
        return lstmv;
    }
    if (detecting==3){
        detecting=39;
        if (!hscnt)
            return -1;
        if (hscnt+1>2){
            y[lstmv]++;
            if (y[0]>y[1]){
                lstmv=1;
                return (lstmv==1)?(-1):(1);
            }
            lstmv=0;
            return (lstmv==0)?(-1):(0);
        }
        if (detect_val==5 || detect_val==18 || detect_val==25 || detect_val==11 
            || detect_val==22 || detect_val==12)
            return -1;
        (y[0])?(lstmv=0):(lstmv=1);
        return lstmv;
    }
    if (!hscnt)
        return -1;
    if (hscnt==1){
        (y[0])?(lstmv=0):(lstmv=1);
        return lstmv;
    }
    y[lstmv]++;
    lstmv=(y[0]>y[1]);
    return lstmv;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 15992 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 15992 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 60 ms 13900 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 60 ms 13900 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1536 KB Output is correct
2 Correct 10 ms 1536 KB Output is correct
3 Correct 13 ms 1792 KB Output is correct
4 Correct 11 ms 1792 KB Output is correct
5 Correct 11 ms 1792 KB Output is correct
6 Correct 12 ms 1792 KB Output is correct
7 Incorrect 11 ms 1792 KB Wrong Answer [5]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 11772 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 11764 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -