Submission #212442

# Submission time Handle Problem Language Result Execution time Memory
212442 2020-03-23T03:55:42 Z Sweetlemon Stray Cat (JOI20_stray) C++14
0 / 100
103 ms 16360 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){
        moves++;
        if (hscnt>2){
            detecting=39;
            return (lstmv=(y[1]<y[0]));
        }
        if (hscnt==1){
            detecting=39;
            return (lstmv=(!(!y[1])));
        }
        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;
    }
    moves++;
    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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 16360 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 16360 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 13796 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 49 ms 13044 KB Output is correct
4 Correct 96 ms 15376 KB Output is correct
5 Correct 103 ms 15348 KB Output is correct
6 Correct 53 ms 13564 KB Output is correct
7 Incorrect 59 ms 13540 KB Wrong Answer [5]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 13796 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 49 ms 13044 KB Output is correct
4 Correct 96 ms 15376 KB Output is correct
5 Correct 103 ms 15348 KB Output is correct
6 Correct 53 ms 13564 KB Output is correct
7 Incorrect 59 ms 13540 KB Wrong Answer [5]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1536 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 71 ms 11616 KB Output is correct
2 Correct 59 ms 12680 KB Output is correct
3 Correct 11 ms 1536 KB Output is correct
4 Correct 48 ms 11392 KB Output is correct
5 Correct 69 ms 13820 KB Output is correct
6 Correct 72 ms 13956 KB Output is correct
7 Incorrect 50 ms 12932 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 11780 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -