#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[200001];
int depth[200001],col[200001];
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
for(int i = 0; i < N; i++) {
adj[i].clear();
depth[i] = 1e9;
}
for(int i = 0; i < M; i++){
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
priority_queue<pair<int,int>>d;
d.push({0,0});
depth[0] = 0;
while(d.size()){
auto x = d.top();
d.pop();
x.first *= -1;
if(depth[x.second] < x.first) continue;
for(auto s: adj[x.second]){
if(x.first + 1 < depth[s]){
depth[s] = x.first + 1;
d.push({-depth[s], s});
}
}
}
vector<int>ans;
for(int i = 0; i < M; i++){
ans.push_back(max(depth[U[i]], depth[V[i]]) % 3);
}
return ans;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
int a,b;
void Init(int A, int B) {
a = A;
b = B;
}
int Move(vector<int> y) {
set<int>p;
int col = 0;
for(auto s: y) {
if(s > 0) p.insert(col);
col++;
}
auto xx = *p.begin();
p.erase(p.begin());
if(p.empty()) return xx;
if(xx == 0 and p.count(1)) return 0;
if(xx == 1 and p.count(2)) return 1;
if(xx == 0 and p.count(2)) return 2;
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
20072 KB |
Output is correct |
2 |
Correct |
3 ms |
5260 KB |
Output is correct |
3 |
Correct |
27 ms |
19372 KB |
Output is correct |
4 |
Correct |
36 ms |
21248 KB |
Output is correct |
5 |
Correct |
46 ms |
21252 KB |
Output is correct |
6 |
Correct |
31 ms |
19900 KB |
Output is correct |
7 |
Correct |
40 ms |
19884 KB |
Output is correct |
8 |
Correct |
37 ms |
20728 KB |
Output is correct |
9 |
Correct |
34 ms |
20584 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
20072 KB |
Output is correct |
2 |
Correct |
3 ms |
5260 KB |
Output is correct |
3 |
Correct |
27 ms |
19372 KB |
Output is correct |
4 |
Correct |
36 ms |
21248 KB |
Output is correct |
5 |
Correct |
46 ms |
21252 KB |
Output is correct |
6 |
Correct |
31 ms |
19900 KB |
Output is correct |
7 |
Correct |
40 ms |
19884 KB |
Output is correct |
8 |
Correct |
37 ms |
20728 KB |
Output is correct |
9 |
Correct |
34 ms |
20584 KB |
Output is correct |
10 |
Incorrect |
27 ms |
17908 KB |
Wrong Answer [6] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
17672 KB |
Output is correct |
2 |
Correct |
3 ms |
5260 KB |
Output is correct |
3 |
Correct |
25 ms |
17256 KB |
Output is correct |
4 |
Correct |
43 ms |
18988 KB |
Output is correct |
5 |
Correct |
36 ms |
18984 KB |
Output is correct |
6 |
Correct |
35 ms |
17748 KB |
Output is correct |
7 |
Correct |
30 ms |
17800 KB |
Output is correct |
8 |
Correct |
35 ms |
18312 KB |
Output is correct |
9 |
Correct |
41 ms |
18352 KB |
Output is correct |
10 |
Correct |
34 ms |
18244 KB |
Output is correct |
11 |
Correct |
31 ms |
18132 KB |
Output is correct |
12 |
Correct |
30 ms |
18188 KB |
Output is correct |
13 |
Correct |
37 ms |
18148 KB |
Output is correct |
14 |
Correct |
34 ms |
18440 KB |
Output is correct |
15 |
Correct |
36 ms |
18552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
17672 KB |
Output is correct |
2 |
Correct |
3 ms |
5260 KB |
Output is correct |
3 |
Correct |
25 ms |
17256 KB |
Output is correct |
4 |
Correct |
43 ms |
18988 KB |
Output is correct |
5 |
Correct |
36 ms |
18984 KB |
Output is correct |
6 |
Correct |
35 ms |
17748 KB |
Output is correct |
7 |
Correct |
30 ms |
17800 KB |
Output is correct |
8 |
Correct |
35 ms |
18312 KB |
Output is correct |
9 |
Correct |
41 ms |
18352 KB |
Output is correct |
10 |
Correct |
34 ms |
18244 KB |
Output is correct |
11 |
Correct |
31 ms |
18132 KB |
Output is correct |
12 |
Correct |
30 ms |
18188 KB |
Output is correct |
13 |
Correct |
37 ms |
18148 KB |
Output is correct |
14 |
Correct |
34 ms |
18440 KB |
Output is correct |
15 |
Correct |
36 ms |
18552 KB |
Output is correct |
16 |
Incorrect |
33 ms |
15916 KB |
Wrong Answer [6] |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
5264 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
7004 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
7024 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |