답안 #778479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778479 2023-07-10T11:02:14 Z bachhoangxuan 길고양이 (JOI20_stray) C++17
15 / 100
41 ms 16320 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[u].size()+(u==0)==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;
    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){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<=3) 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;
    return -2;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 14988 KB Output is correct
2 Correct 0 ms 520 KB Output is correct
3 Correct 24 ms 14592 KB Output is correct
4 Correct 33 ms 16320 KB Output is correct
5 Correct 32 ms 16100 KB Output is correct
6 Correct 26 ms 14844 KB Output is correct
7 Correct 28 ms 15092 KB Output is correct
8 Correct 33 ms 15808 KB Output is correct
9 Correct 31 ms 15600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 14988 KB Output is correct
2 Correct 0 ms 520 KB Output is correct
3 Correct 24 ms 14592 KB Output is correct
4 Correct 33 ms 16320 KB Output is correct
5 Correct 32 ms 16100 KB Output is correct
6 Correct 26 ms 14844 KB Output is correct
7 Correct 28 ms 15092 KB Output is correct
8 Correct 33 ms 15808 KB Output is correct
9 Correct 31 ms 15600 KB Output is correct
10 Correct 26 ms 13156 KB Output is correct
11 Correct 30 ms 13036 KB Output is correct
12 Correct 30 ms 13192 KB Output is correct
13 Correct 25 ms 13168 KB Output is correct
14 Correct 26 ms 13172 KB Output is correct
15 Correct 28 ms 13500 KB Output is correct
16 Correct 28 ms 16060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 12924 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Correct 23 ms 12592 KB Output is correct
4 Correct 33 ms 14304 KB Output is correct
5 Correct 32 ms 14328 KB Output is correct
6 Correct 28 ms 13004 KB Output is correct
7 Correct 25 ms 13016 KB Output is correct
8 Correct 35 ms 13500 KB Output is correct
9 Correct 41 ms 13744 KB Output is correct
10 Correct 30 ms 13496 KB Output is correct
11 Correct 26 ms 13068 KB Output is correct
12 Correct 27 ms 13332 KB Output is correct
13 Correct 28 ms 13324 KB Output is correct
14 Correct 30 ms 13592 KB Output is correct
15 Correct 38 ms 13628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 12924 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Correct 23 ms 12592 KB Output is correct
4 Correct 33 ms 14304 KB Output is correct
5 Correct 32 ms 14328 KB Output is correct
6 Correct 28 ms 13004 KB Output is correct
7 Correct 25 ms 13016 KB Output is correct
8 Correct 35 ms 13500 KB Output is correct
9 Correct 41 ms 13744 KB Output is correct
10 Correct 30 ms 13496 KB Output is correct
11 Correct 26 ms 13068 KB Output is correct
12 Correct 27 ms 13332 KB Output is correct
13 Correct 28 ms 13324 KB Output is correct
14 Correct 30 ms 13592 KB Output is correct
15 Correct 38 ms 13628 KB Output is correct
16 Correct 26 ms 11556 KB Output is correct
17 Correct 26 ms 11252 KB Output is correct
18 Correct 24 ms 11464 KB Output is correct
19 Correct 25 ms 11196 KB Output is correct
20 Correct 27 ms 12016 KB Output is correct
21 Correct 26 ms 11392 KB Output is correct
22 Correct 28 ms 13816 KB Output is correct
23 Correct 28 ms 11496 KB Output is correct
24 Correct 26 ms 11592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 908 KB Output is correct
2 Incorrect 1 ms 512 KB Wrong Answer [4]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 10632 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 11048 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -