답안 #778537

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778537 2023-07-10T11:48:28 Z bachhoangxuan 길고양이 (JOI20_stray) C++17
100 / 100
40 ms 16552 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 'int Move(std::vector<int>)':
Catherine.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 15568 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 24 ms 14972 KB Output is correct
4 Correct 35 ms 16528 KB Output is correct
5 Correct 39 ms 16552 KB Output is correct
6 Correct 28 ms 15224 KB Output is correct
7 Correct 34 ms 15224 KB Output is correct
8 Correct 32 ms 16132 KB Output is correct
9 Correct 32 ms 16040 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 15568 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 24 ms 14972 KB Output is correct
4 Correct 35 ms 16528 KB Output is correct
5 Correct 39 ms 16552 KB Output is correct
6 Correct 28 ms 15224 KB Output is correct
7 Correct 34 ms 15224 KB Output is correct
8 Correct 32 ms 16132 KB Output is correct
9 Correct 32 ms 16040 KB Output is correct
10 Correct 26 ms 13376 KB Output is correct
11 Correct 26 ms 13444 KB Output is correct
12 Correct 25 ms 13304 KB Output is correct
13 Correct 25 ms 13336 KB Output is correct
14 Correct 27 ms 13496 KB Output is correct
15 Correct 30 ms 14008 KB Output is correct
16 Correct 32 ms 16064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13088 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 23 ms 12712 KB Output is correct
4 Correct 32 ms 14352 KB Output is correct
5 Correct 33 ms 14356 KB Output is correct
6 Correct 27 ms 13208 KB Output is correct
7 Correct 27 ms 13132 KB Output is correct
8 Correct 31 ms 13720 KB Output is correct
9 Correct 33 ms 13704 KB Output is correct
10 Correct 28 ms 13492 KB Output is correct
11 Correct 37 ms 13520 KB Output is correct
12 Correct 28 ms 13512 KB Output is correct
13 Correct 28 ms 13500 KB Output is correct
14 Correct 30 ms 13888 KB Output is correct
15 Correct 33 ms 13952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13088 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 23 ms 12712 KB Output is correct
4 Correct 32 ms 14352 KB Output is correct
5 Correct 33 ms 14356 KB Output is correct
6 Correct 27 ms 13208 KB Output is correct
7 Correct 27 ms 13132 KB Output is correct
8 Correct 31 ms 13720 KB Output is correct
9 Correct 33 ms 13704 KB Output is correct
10 Correct 28 ms 13492 KB Output is correct
11 Correct 37 ms 13520 KB Output is correct
12 Correct 28 ms 13512 KB Output is correct
13 Correct 28 ms 13500 KB Output is correct
14 Correct 30 ms 13888 KB Output is correct
15 Correct 33 ms 13952 KB Output is correct
16 Correct 24 ms 11560 KB Output is correct
17 Correct 27 ms 11408 KB Output is correct
18 Correct 26 ms 11436 KB Output is correct
19 Correct 25 ms 11528 KB Output is correct
20 Correct 26 ms 12100 KB Output is correct
21 Correct 26 ms 11856 KB Output is correct
22 Correct 40 ms 13812 KB Output is correct
23 Correct 26 ms 11544 KB Output is correct
24 Correct 26 ms 11572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 908 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 2 ms 908 KB Output is correct
4 Correct 2 ms 900 KB Output is correct
5 Correct 2 ms 908 KB Output is correct
6 Correct 2 ms 900 KB Output is correct
7 Correct 2 ms 900 KB Output is correct
8 Correct 2 ms 900 KB Output is correct
9 Correct 2 ms 900 KB Output is correct
10 Correct 2 ms 912 KB Output is correct
11 Correct 2 ms 908 KB Output is correct
12 Correct 2 ms 856 KB Output is correct
13 Correct 2 ms 908 KB Output is correct
14 Correct 2 ms 900 KB Output is correct
15 Correct 2 ms 896 KB Output is correct
16 Correct 2 ms 908 KB Output is correct
17 Correct 2 ms 900 KB Output is correct
18 Correct 2 ms 900 KB Output is correct
19 Correct 2 ms 900 KB Output is correct
20 Correct 2 ms 868 KB Output is correct
21 Correct 2 ms 856 KB Output is correct
22 Correct 2 ms 868 KB Output is correct
23 Correct 2 ms 860 KB Output is correct
24 Correct 2 ms 868 KB Output is correct
25 Correct 2 ms 872 KB Output is correct
26 Correct 2 ms 900 KB Output is correct
27 Correct 2 ms 908 KB Output is correct
28 Correct 2 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11260 KB Output is correct
2 Correct 27 ms 11724 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 20 ms 11156 KB Output is correct
5 Correct 35 ms 12308 KB Output is correct
6 Correct 33 ms 12288 KB Output is correct
7 Correct 31 ms 11380 KB Output is correct
8 Correct 26 ms 11464 KB Output is correct
9 Correct 30 ms 12360 KB Output is correct
10 Correct 31 ms 12352 KB Output is correct
11 Correct 31 ms 12484 KB Output is correct
12 Correct 30 ms 12304 KB Output is correct
13 Correct 30 ms 12340 KB Output is correct
14 Correct 30 ms 12348 KB Output is correct
15 Correct 30 ms 12352 KB Output is correct
16 Correct 31 ms 12300 KB Output is correct
17 Correct 28 ms 12052 KB Output is correct
18 Correct 30 ms 12100 KB Output is correct
19 Correct 30 ms 11988 KB Output is correct
20 Correct 27 ms 12060 KB Output is correct
21 Correct 28 ms 12172 KB Output is correct
22 Correct 28 ms 12116 KB Output is correct
23 Correct 27 ms 11432 KB Output is correct
24 Correct 25 ms 11292 KB Output is correct
25 Correct 26 ms 11436 KB Output is correct
26 Correct 25 ms 11412 KB Output is correct
27 Correct 27 ms 11816 KB Output is correct
28 Correct 27 ms 11844 KB Output is correct
29 Correct 28 ms 11756 KB Output is correct
30 Correct 27 ms 11832 KB Output is correct
31 Correct 25 ms 11312 KB Output is correct
32 Correct 25 ms 11368 KB Output is correct
33 Correct 28 ms 11288 KB Output is correct
34 Correct 26 ms 11436 KB Output is correct
35 Correct 32 ms 11800 KB Output is correct
36 Correct 27 ms 11852 KB Output is correct
37 Correct 27 ms 11816 KB Output is correct
38 Correct 28 ms 11792 KB Output is correct
39 Correct 27 ms 11836 KB Output is correct
40 Correct 28 ms 11764 KB Output is correct
41 Correct 34 ms 11988 KB Output is correct
42 Correct 32 ms 12000 KB Output is correct
43 Correct 28 ms 12092 KB Output is correct
44 Correct 27 ms 12064 KB Output is correct
45 Correct 28 ms 12080 KB Output is correct
46 Correct 31 ms 12040 KB Output is correct
47 Correct 28 ms 11660 KB Output is correct
48 Correct 26 ms 11680 KB Output is correct
49 Correct 26 ms 11556 KB Output is correct
50 Correct 28 ms 11656 KB Output is correct
51 Correct 25 ms 11584 KB Output is correct
52 Correct 25 ms 11528 KB Output is correct
53 Correct 30 ms 11568 KB Output is correct
54 Correct 30 ms 11500 KB Output is correct
55 Correct 25 ms 11468 KB Output is correct
56 Correct 24 ms 11552 KB Output is correct
57 Correct 25 ms 11336 KB Output is correct
58 Correct 25 ms 11404 KB Output is correct
59 Correct 25 ms 11464 KB Output is correct
60 Correct 28 ms 11436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 11300 KB Output is correct
2 Correct 27 ms 11668 KB Output is correct
3 Correct 1 ms 524 KB Output is correct
4 Correct 24 ms 11180 KB Output is correct
5 Correct 30 ms 12260 KB Output is correct
6 Correct 34 ms 12320 KB Output is correct
7 Correct 26 ms 11472 KB Output is correct
8 Correct 34 ms 11372 KB Output is correct
9 Correct 34 ms 12260 KB Output is correct
10 Correct 37 ms 12380 KB Output is correct
11 Correct 30 ms 12352 KB Output is correct
12 Correct 30 ms 12276 KB Output is correct
13 Correct 28 ms 12472 KB Output is correct
14 Correct 33 ms 12420 KB Output is correct
15 Correct 30 ms 12332 KB Output is correct
16 Correct 30 ms 12412 KB Output is correct
17 Correct 27 ms 12016 KB Output is correct
18 Correct 32 ms 12012 KB Output is correct
19 Correct 28 ms 12064 KB Output is correct
20 Correct 28 ms 12152 KB Output is correct
21 Correct 39 ms 12044 KB Output is correct
22 Correct 28 ms 12024 KB Output is correct
23 Correct 25 ms 11288 KB Output is correct
24 Correct 25 ms 11120 KB Output is correct
25 Correct 28 ms 11396 KB Output is correct
26 Correct 26 ms 11464 KB Output is correct
27 Correct 30 ms 11776 KB Output is correct
28 Correct 27 ms 11808 KB Output is correct
29 Correct 27 ms 11876 KB Output is correct
30 Correct 27 ms 11796 KB Output is correct
31 Correct 25 ms 11388 KB Output is correct
32 Correct 25 ms 11428 KB Output is correct
33 Correct 27 ms 11344 KB Output is correct
34 Correct 30 ms 11460 KB Output is correct
35 Correct 28 ms 11764 KB Output is correct
36 Correct 27 ms 11732 KB Output is correct
37 Correct 27 ms 11632 KB Output is correct
38 Correct 32 ms 11492 KB Output is correct
39 Correct 27 ms 11700 KB Output is correct
40 Correct 28 ms 11624 KB Output is correct
41 Correct 35 ms 11804 KB Output is correct
42 Correct 36 ms 11868 KB Output is correct
43 Correct 28 ms 11864 KB Output is correct
44 Correct 30 ms 11876 KB Output is correct
45 Correct 31 ms 11800 KB Output is correct
46 Correct 28 ms 11912 KB Output is correct
47 Correct 27 ms 11512 KB Output is correct
48 Correct 27 ms 11532 KB Output is correct
49 Correct 27 ms 11356 KB Output is correct
50 Correct 27 ms 11472 KB Output is correct
51 Correct 33 ms 11520 KB Output is correct
52 Correct 30 ms 11376 KB Output is correct
53 Correct 26 ms 11328 KB Output is correct
54 Correct 27 ms 11340 KB Output is correct
55 Correct 31 ms 11284 KB Output is correct
56 Correct 25 ms 11344 KB Output is correct
57 Correct 27 ms 11324 KB Output is correct
58 Correct 25 ms 11156 KB Output is correct
59 Correct 25 ms 11344 KB Output is correct
60 Correct 27 ms 11024 KB Output is correct