#include "Anthony.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<int> graf[20005];
int dist[20005];
queue<int> Q;
int N;
void BFS(int gde){
for(int i=0;i<=N;i++)
dist[i]=-1;
dist[gde]=0;
while(Q.size()){
int tren=Q.front();
Q.pop();
if(dist[tren]!=-1)
continue;
for(int i=0;i<graf[tren].size();i++)
if(dist[graf[tren][i]]==-1){
dist[graf[tren][i]]=dist[tren]+1;
Q.push(graf[tren][i]);
}
}
return;
}
vector<int> Mark(int n, int M, int A, int B, vector<int> U,vector<int> V) {
N=n;
for(int i=0;i<M;i++){
graf[U[i]].push_back(V[i]);
graf[V[i]].push_back(U[i]);
}
BFS(0);
if(B>=6 and M==N-1){
string S="001011";
vector<int> R;
for(int i=0;i<M;i++){
int md=min(dist[U[i]],dist[V[i]]);
R.push_back(S[md%6]);
}
return R;
}
string S="012";
vector<int> R;
for(int i=0;i<M;i++){
int md=min(dist[U[i]],dist[V[i]]);
R.push_back(S[md%3]);
}
return R;
}
#include "Catherine.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int slucaj;
void Init(int A, int B) {
if(A==2)
slucaj=2;
else
slucaj=1;
}
int Move(std::vector<int> y) {
if(slucaj==1){
if(y[0]==0 and y[1]==0)
return 2;
if(y[0]==0 and y[2]==0)
return 1;
if(y[1]==0 and y[2]==0)
return 0;
if(y[0]==0)
return 1;
if(y[1]==0)
return 2;
return 0;
}
}
Compilation message
Anthony.cpp: In function 'void BFS(int)':
Anthony.cpp:18:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
18 | for(int i=0;i<graf[tren].size();i++)
| ~^~~~~~~~~~~~~~~~~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
26 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
14436 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
14436 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
12312 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
12312 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1284 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
10836 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
10920 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |