Submission #778515

# Submission time Handle Problem Language Result Execution time Memory
778515 2023-07-10T11:35:55 Z bachhoangxuan Stray Cat (JOI20_stray) C++17
15 / 100
47 ms 19560 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};

}  // namespace

vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::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:(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];
}  // namespace

void Init(int A, int B) {
    ::A = A;
    ::B = B;
    for(int i=0;i<81;i++) f[i]=-2;
    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(std::vector<int> y) {
    auto g = [&](int val,int x){
        p=(val==-1?p:val);
        if(val!=-1) assert((to_string(x),y[val]));
        return val;
    };
    if(A==2){
        int d=y[0]+y[1]+(st!=0);st++;
        if(up) return g(d>=3?(p^1):y[1],0);
        if(d==1) return up=true,g(st!=1?-1:y[1],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),2);
        num=num*3+y[1]+(p==1);
        if(st<=3) return g(!y[0],3);
        else return up=true,g(f[num],4);
    }
    else for(int i=0;i<3;i++) if(y[i] && !y[(i+2)%3]) return i;
    return -2;
}
# Verdict Execution time Memory Grader output
1 Correct 30 ms 15564 KB Output is correct
2 Correct 0 ms 520 KB Output is correct
3 Correct 26 ms 14424 KB Output is correct
4 Correct 34 ms 16244 KB Output is correct
5 Correct 39 ms 16104 KB Output is correct
6 Correct 31 ms 14836 KB Output is correct
7 Correct 33 ms 14788 KB Output is correct
8 Correct 33 ms 15560 KB Output is correct
9 Correct 36 ms 15576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 15564 KB Output is correct
2 Correct 0 ms 520 KB Output is correct
3 Correct 26 ms 14424 KB Output is correct
4 Correct 34 ms 16244 KB Output is correct
5 Correct 39 ms 16104 KB Output is correct
6 Correct 31 ms 14836 KB Output is correct
7 Correct 33 ms 14788 KB Output is correct
8 Correct 33 ms 15560 KB Output is correct
9 Correct 36 ms 15576 KB Output is correct
10 Correct 26 ms 13024 KB Output is correct
11 Correct 25 ms 12868 KB Output is correct
12 Correct 27 ms 12892 KB Output is correct
13 Correct 27 ms 12996 KB Output is correct
14 Correct 33 ms 13120 KB Output is correct
15 Correct 30 ms 13560 KB Output is correct
16 Correct 32 ms 15796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 12880 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 27 ms 12256 KB Output is correct
4 Correct 47 ms 14160 KB Output is correct
5 Correct 37 ms 14036 KB Output is correct
6 Correct 27 ms 12792 KB Output is correct
7 Correct 28 ms 12864 KB Output is correct
8 Correct 33 ms 13396 KB Output is correct
9 Correct 32 ms 13428 KB Output is correct
10 Correct 28 ms 13268 KB Output is correct
11 Correct 33 ms 13492 KB Output is correct
12 Correct 34 ms 13212 KB Output is correct
13 Correct 44 ms 13192 KB Output is correct
14 Correct 31 ms 13504 KB Output is correct
15 Correct 30 ms 13504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 12880 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 27 ms 12256 KB Output is correct
4 Correct 47 ms 14160 KB Output is correct
5 Correct 37 ms 14036 KB Output is correct
6 Correct 27 ms 12792 KB Output is correct
7 Correct 28 ms 12864 KB Output is correct
8 Correct 33 ms 13396 KB Output is correct
9 Correct 32 ms 13428 KB Output is correct
10 Correct 28 ms 13268 KB Output is correct
11 Correct 33 ms 13492 KB Output is correct
12 Correct 34 ms 13212 KB Output is correct
13 Correct 44 ms 13192 KB Output is correct
14 Correct 31 ms 13504 KB Output is correct
15 Correct 30 ms 13504 KB Output is correct
16 Correct 23 ms 11212 KB Output is correct
17 Correct 22 ms 11328 KB Output is correct
18 Correct 33 ms 11188 KB Output is correct
19 Correct 31 ms 11148 KB Output is correct
20 Correct 33 ms 11676 KB Output is correct
21 Correct 26 ms 11852 KB Output is correct
22 Correct 40 ms 13596 KB Output is correct
23 Correct 26 ms 11324 KB Output is correct
24 Correct 33 ms 11272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1288 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 19560 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 19044 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -