#include <bits/stdc++.h>
#include "Anthony.h"
#define pb push_back
#define eb emplace_back
using namespace std;
int n,m;
vector<vector<pair<int,int>>> g;
vector<int> Mark1();
vector<int> Mark2();
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V){
n=N, m=M;
g.resize(n);
for(int i=0;i<m;i++){
g[U[i]].eb(V[i],i);
g[V[i]].eb(U[i],i);
}
if(A>=3) return Mark1();
return Mark2();
}
vector<int> Mark1(){
vector<int> dpth(n);
vector<bool> vis(n);
vector<int> ans(m);
queue<int> bfs;
bfs.push(0);
dpth[0]=0;
vis[0]=1;
while(!bfs.empty()){
int u=bfs.front();
bfs.pop();
for(auto p:g[u]){
int v=p.first, e=p.second;
if(!vis[v]){
vis[v]=1;
bfs.push(v);
dpth[v]=dpth[u]+1;
ans[e]=dpth[v]%3;
}
else{
if(dpth[v]==dpth[u]) ans[e]=(dpth[v]+1)%3;
else ans[e]=max(dpth[v],dpth[u])%3;
}
}
}
return ans;
}
vector<int> Mark2(){
vector<int> ans(m);
return ans;
}
#include <bits/stdc++.h>
#include "Catherine.h"
#define pb push_back
#define x first
#define y second
using namespace std;
int a;
void Init(int A, int B){
a=A;
}
int Move1(vector<int> arr);
int Move2(vector<int> arr);
int Move(vector<int> arr){
if(a>=3) return Move1(arr);
return Move2(arr);
}
int Move1(vector<int> arr){
set<int> st={0,1,2};
for(int i=0;i<3;i++) if(arr[i]==0) st.erase(i);
if(st.size()==1) return *st.begin();
if(*next(st.begin())-*st.begin()==1) return *st.begin();
return 2;
}
int Move2(vector<int> arr){
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
16208 KB |
Output is correct |
2 |
Correct |
9 ms |
1012 KB |
Output is correct |
3 |
Correct |
47 ms |
15644 KB |
Output is correct |
4 |
Correct |
78 ms |
16972 KB |
Output is correct |
5 |
Correct |
70 ms |
17352 KB |
Output is correct |
6 |
Correct |
54 ms |
15864 KB |
Output is correct |
7 |
Correct |
55 ms |
15992 KB |
Output is correct |
8 |
Correct |
66 ms |
16876 KB |
Output is correct |
9 |
Correct |
64 ms |
16676 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
16208 KB |
Output is correct |
2 |
Correct |
9 ms |
1012 KB |
Output is correct |
3 |
Correct |
47 ms |
15644 KB |
Output is correct |
4 |
Correct |
78 ms |
16972 KB |
Output is correct |
5 |
Correct |
70 ms |
17352 KB |
Output is correct |
6 |
Correct |
54 ms |
15864 KB |
Output is correct |
7 |
Correct |
55 ms |
15992 KB |
Output is correct |
8 |
Correct |
66 ms |
16876 KB |
Output is correct |
9 |
Correct |
64 ms |
16676 KB |
Output is correct |
10 |
Correct |
50 ms |
13896 KB |
Output is correct |
11 |
Correct |
51 ms |
14008 KB |
Output is correct |
12 |
Correct |
52 ms |
13936 KB |
Output is correct |
13 |
Correct |
51 ms |
13892 KB |
Output is correct |
14 |
Correct |
55 ms |
14148 KB |
Output is correct |
15 |
Correct |
59 ms |
14588 KB |
Output is correct |
16 |
Correct |
66 ms |
16508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
13668 KB |
Output is correct |
2 |
Correct |
9 ms |
884 KB |
Output is correct |
3 |
Correct |
48 ms |
13324 KB |
Output is correct |
4 |
Correct |
70 ms |
14956 KB |
Output is correct |
5 |
Correct |
72 ms |
14940 KB |
Output is correct |
6 |
Correct |
53 ms |
13652 KB |
Output is correct |
7 |
Correct |
59 ms |
13668 KB |
Output is correct |
8 |
Correct |
62 ms |
14488 KB |
Output is correct |
9 |
Correct |
61 ms |
14480 KB |
Output is correct |
10 |
Correct |
59 ms |
14164 KB |
Output is correct |
11 |
Correct |
57 ms |
14164 KB |
Output is correct |
12 |
Correct |
59 ms |
14220 KB |
Output is correct |
13 |
Correct |
59 ms |
14228 KB |
Output is correct |
14 |
Correct |
68 ms |
14420 KB |
Output is correct |
15 |
Correct |
65 ms |
14284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
13668 KB |
Output is correct |
2 |
Correct |
9 ms |
884 KB |
Output is correct |
3 |
Correct |
48 ms |
13324 KB |
Output is correct |
4 |
Correct |
70 ms |
14956 KB |
Output is correct |
5 |
Correct |
72 ms |
14940 KB |
Output is correct |
6 |
Correct |
53 ms |
13652 KB |
Output is correct |
7 |
Correct |
59 ms |
13668 KB |
Output is correct |
8 |
Correct |
62 ms |
14488 KB |
Output is correct |
9 |
Correct |
61 ms |
14480 KB |
Output is correct |
10 |
Correct |
59 ms |
14164 KB |
Output is correct |
11 |
Correct |
57 ms |
14164 KB |
Output is correct |
12 |
Correct |
59 ms |
14220 KB |
Output is correct |
13 |
Correct |
59 ms |
14228 KB |
Output is correct |
14 |
Correct |
68 ms |
14420 KB |
Output is correct |
15 |
Correct |
65 ms |
14284 KB |
Output is correct |
16 |
Correct |
47 ms |
12192 KB |
Output is correct |
17 |
Correct |
47 ms |
12204 KB |
Output is correct |
18 |
Correct |
49 ms |
12032 KB |
Output is correct |
19 |
Correct |
49 ms |
12020 KB |
Output is correct |
20 |
Correct |
56 ms |
12664 KB |
Output is correct |
21 |
Correct |
55 ms |
12400 KB |
Output is correct |
22 |
Correct |
68 ms |
14656 KB |
Output is correct |
23 |
Correct |
49 ms |
12148 KB |
Output is correct |
24 |
Correct |
50 ms |
12164 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
1256 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
44 ms |
11432 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
45 ms |
11412 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |