#include "Anthony.h"
#include <bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n;i++)
#define vi vector<int>
#define pb push_back
using namespace std;
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
std::vector<int> ret(M, -1);
vector<pair<int,int>>edges;
vector<int>adj[N];
f0r(i, M){
edges.pb({min(U[i], V[i]), max(U[i], V[i])});
adj[U[i]].pb(V[i]);
adj[V[i]].pb(U[i]);
}
map<pair<int,int>,int>m;
f0r(i, M){
m[edges[i]] = i;
}
/*
vi dist(N, 1e9);
dist[0] = 0;
priority_queue<pair<int,int>>q;
q.push({0, 0});
while(!q.empty()){
int node = q.top().second;
q.pop();
for(auto u : adj[node]){
if(dist[u] > dist[node] + 1){
dist[u] = dist[node] + 1;
q.push({-dist[u], u]});
}
}
}
*/
vi dist(N, 1e9);
dist[0] = 0;
queue<int>q;
q.push(0);
while(!q.empty()){
int node = q.front();
q.pop();
for(auto u : adj[node]){
if(dist[u] == 1e9){
ret[m[{min(u, node), max(u, node)}]] = dist[node] % 3;
dist[u] = dist[node] + 1;
q.push(u);
}
}
}
f0r(i, M){
if(ret[i] == -1){
ret[i] = min(dist[edges[i].first], dist[edges[i].second]) % 3;
}
}
return ret;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i< n; i++)
#define pb push_back
#define vi vector<int>
using namespace std;
int A, B;
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(std::vector<int> y) {
//set<int>s;
vector<int>has;
f0r(i, A){
if(y[i] != 0){
has.pb(i);
}
}
sort(has.begin(), has.end());
if(has.size() == 1){
return has[0];
}
else{
if(has[0] == 0 && has[1] == 1)return 0;
if(has[0] == 1 && has[1] == 2)return 1;
return 2;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
16932 KB |
Output is correct |
2 |
Correct |
0 ms |
784 KB |
Output is correct |
3 |
Correct |
28 ms |
16700 KB |
Output is correct |
4 |
Correct |
45 ms |
18296 KB |
Output is correct |
5 |
Correct |
46 ms |
18284 KB |
Output is correct |
6 |
Correct |
34 ms |
16952 KB |
Output is correct |
7 |
Correct |
36 ms |
17080 KB |
Output is correct |
8 |
Correct |
44 ms |
17564 KB |
Output is correct |
9 |
Correct |
43 ms |
17752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
16932 KB |
Output is correct |
2 |
Correct |
0 ms |
784 KB |
Output is correct |
3 |
Correct |
28 ms |
16700 KB |
Output is correct |
4 |
Correct |
45 ms |
18296 KB |
Output is correct |
5 |
Correct |
46 ms |
18284 KB |
Output is correct |
6 |
Correct |
34 ms |
16952 KB |
Output is correct |
7 |
Correct |
36 ms |
17080 KB |
Output is correct |
8 |
Correct |
44 ms |
17564 KB |
Output is correct |
9 |
Correct |
43 ms |
17752 KB |
Output is correct |
10 |
Correct |
32 ms |
15084 KB |
Output is correct |
11 |
Correct |
37 ms |
15236 KB |
Output is correct |
12 |
Correct |
30 ms |
15148 KB |
Output is correct |
13 |
Correct |
35 ms |
15080 KB |
Output is correct |
14 |
Correct |
37 ms |
15268 KB |
Output is correct |
15 |
Correct |
41 ms |
15656 KB |
Output is correct |
16 |
Correct |
36 ms |
17656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
14640 KB |
Output is correct |
2 |
Correct |
0 ms |
796 KB |
Output is correct |
3 |
Correct |
32 ms |
14328 KB |
Output is correct |
4 |
Correct |
38 ms |
15972 KB |
Output is correct |
5 |
Correct |
39 ms |
16000 KB |
Output is correct |
6 |
Correct |
31 ms |
14628 KB |
Output is correct |
7 |
Correct |
33 ms |
14624 KB |
Output is correct |
8 |
Correct |
37 ms |
15396 KB |
Output is correct |
9 |
Correct |
39 ms |
15464 KB |
Output is correct |
10 |
Correct |
38 ms |
15140 KB |
Output is correct |
11 |
Correct |
37 ms |
15172 KB |
Output is correct |
12 |
Correct |
41 ms |
15140 KB |
Output is correct |
13 |
Correct |
34 ms |
15276 KB |
Output is correct |
14 |
Correct |
39 ms |
15340 KB |
Output is correct |
15 |
Correct |
42 ms |
15284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
14640 KB |
Output is correct |
2 |
Correct |
0 ms |
796 KB |
Output is correct |
3 |
Correct |
32 ms |
14328 KB |
Output is correct |
4 |
Correct |
38 ms |
15972 KB |
Output is correct |
5 |
Correct |
39 ms |
16000 KB |
Output is correct |
6 |
Correct |
31 ms |
14628 KB |
Output is correct |
7 |
Correct |
33 ms |
14624 KB |
Output is correct |
8 |
Correct |
37 ms |
15396 KB |
Output is correct |
9 |
Correct |
39 ms |
15464 KB |
Output is correct |
10 |
Correct |
38 ms |
15140 KB |
Output is correct |
11 |
Correct |
37 ms |
15172 KB |
Output is correct |
12 |
Correct |
41 ms |
15140 KB |
Output is correct |
13 |
Correct |
34 ms |
15276 KB |
Output is correct |
14 |
Correct |
39 ms |
15340 KB |
Output is correct |
15 |
Correct |
42 ms |
15284 KB |
Output is correct |
16 |
Correct |
31 ms |
13208 KB |
Output is correct |
17 |
Correct |
36 ms |
13016 KB |
Output is correct |
18 |
Correct |
36 ms |
12996 KB |
Output is correct |
19 |
Correct |
30 ms |
13108 KB |
Output is correct |
20 |
Correct |
33 ms |
13772 KB |
Output is correct |
21 |
Correct |
35 ms |
13764 KB |
Output is correct |
22 |
Correct |
40 ms |
15752 KB |
Output is correct |
23 |
Correct |
31 ms |
13184 KB |
Output is correct |
24 |
Correct |
34 ms |
13344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
800 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
4204 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
4204 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |