#include "Anthony.h"
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
std::vector<int> Mark(int N, int M, int A, int B,std::vector<int> U, std::vector<int> V) {
vector<vector<pair<int,int>>> paths(N);
for(int i = 0;i<M;i++){
paths[U[i]].push_back({V[i],i});
paths[V[i]].push_back({U[i],i});
}
vector<int> dist(N,-1);
vector<int> col(M,-1);
dist[0] = 0;
queue<int> q;
q.push(0);
while(!q.empty()){
auto now = q.front();
q.pop();
for(auto nxt:paths[now]){
if(dist[nxt.first] != -1)continue;
dist[nxt.first] = dist[now]+1;
col[nxt.second] = dist[nxt.first]%3;
q.push(nxt.first);
}
}
// for(int i = 0;i<M;i++)assert(col[i] != -1);
return col;
}
#include "Catherine.h"
#include <set>
#include <vector>
#include <cassert>
void Init(int A, int B) {
return;
}
using namespace std;
int Move(std::vector<int> y) {
set<int> st;
st.insert(1);
st.insert(2);
st.insert(0);
for(int i = 0;i<3;i++)if(y[i])st.erase(i);
assert(st.size()<3&&st.size()>0);
if(st.size() == 2){
for(int i = 0;i<3;i++)if(y[i])return i;
}
if(*st.begin() == 0)return 1;
else if(*st.begin() == 1)return 2;
else return 0;
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
48 ms |
14992 KB |
Output is correct |
2 |
Correct |
1 ms |
516 KB |
Output is correct |
3 |
Correct |
31 ms |
14452 KB |
Output is correct |
4 |
Correct |
50 ms |
15952 KB |
Output is correct |
5 |
Correct |
47 ms |
16096 KB |
Output is correct |
6 |
Correct |
38 ms |
14820 KB |
Output is correct |
7 |
Correct |
36 ms |
14848 KB |
Output is correct |
8 |
Correct |
44 ms |
15520 KB |
Output is correct |
9 |
Correct |
41 ms |
15476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
48 ms |
14992 KB |
Output is correct |
2 |
Correct |
1 ms |
516 KB |
Output is correct |
3 |
Correct |
31 ms |
14452 KB |
Output is correct |
4 |
Correct |
50 ms |
15952 KB |
Output is correct |
5 |
Correct |
47 ms |
16096 KB |
Output is correct |
6 |
Correct |
38 ms |
14820 KB |
Output is correct |
7 |
Correct |
36 ms |
14848 KB |
Output is correct |
8 |
Correct |
44 ms |
15520 KB |
Output is correct |
9 |
Correct |
41 ms |
15476 KB |
Output is correct |
10 |
Incorrect |
7 ms |
2052 KB |
Wrong Answer [2] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
12520 KB |
Output is correct |
2 |
Correct |
0 ms |
508 KB |
Output is correct |
3 |
Correct |
28 ms |
12208 KB |
Output is correct |
4 |
Correct |
51 ms |
13876 KB |
Output is correct |
5 |
Correct |
46 ms |
13788 KB |
Output is correct |
6 |
Correct |
33 ms |
12564 KB |
Output is correct |
7 |
Correct |
38 ms |
12564 KB |
Output is correct |
8 |
Correct |
44 ms |
13232 KB |
Output is correct |
9 |
Correct |
41 ms |
13368 KB |
Output is correct |
10 |
Correct |
41 ms |
12948 KB |
Output is correct |
11 |
Correct |
40 ms |
13012 KB |
Output is correct |
12 |
Correct |
36 ms |
12976 KB |
Output is correct |
13 |
Correct |
47 ms |
13132 KB |
Output is correct |
14 |
Correct |
46 ms |
13256 KB |
Output is correct |
15 |
Correct |
43 ms |
13240 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
12520 KB |
Output is correct |
2 |
Correct |
0 ms |
508 KB |
Output is correct |
3 |
Correct |
28 ms |
12208 KB |
Output is correct |
4 |
Correct |
51 ms |
13876 KB |
Output is correct |
5 |
Correct |
46 ms |
13788 KB |
Output is correct |
6 |
Correct |
33 ms |
12564 KB |
Output is correct |
7 |
Correct |
38 ms |
12564 KB |
Output is correct |
8 |
Correct |
44 ms |
13232 KB |
Output is correct |
9 |
Correct |
41 ms |
13368 KB |
Output is correct |
10 |
Correct |
41 ms |
12948 KB |
Output is correct |
11 |
Correct |
40 ms |
13012 KB |
Output is correct |
12 |
Correct |
36 ms |
12976 KB |
Output is correct |
13 |
Correct |
47 ms |
13132 KB |
Output is correct |
14 |
Correct |
46 ms |
13256 KB |
Output is correct |
15 |
Correct |
43 ms |
13240 KB |
Output is correct |
16 |
Incorrect |
7 ms |
2192 KB |
Wrong Answer [2] |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
516 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
2316 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
2328 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |