#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>
namespace ANTHONY{
#define pii pair<int,int>
#define fs first
#define sc second
using namespace std;
const int mxn = 2e4+10;
int N,M;
vector<pii> paths[mxn];
vector<pii> edges;
namespace S1{
queue<int> q;
int dist[mxn];
void BFS(){
memset(dist,-1,sizeof(dist));
dist[0] = 0;
q.push(0);
while(!q.empty()){
auto now = q.front();
q.pop();
for(auto nxt:paths[now]){
if(dist[nxt.fs] == -1)dist[nxt.fs] = dist[now]+1,q.push(nxt.fs);
}
}
return;
}
vector<int> GO(){
//cout<<"CASE 1"<<endl;
vector<int> ans(M,0);
BFS();
for(int i = 0;i<M;i++){
auto [a,b] = edges[i];
if(dist[a]>dist[b])swap(a,b);
if(dist[a]==dist[b])ans[i] = (dist[a]+1)%3;
else ans[i] = dist[b]%3;
cout<<a<<' '<<b<<" "<<ans[i]<<endl;
}
for(int i = 0;i<N;i++)cout<<dist[i]<<' ';cout<<endl;
//cout<<ans.size()<<endl;
//for(auto &i:ans)cout<<i;cout<<endl;
return ans;
}
}
namespace S2{
void BFS(){
}
vector<int> GO(){
return vector<int>(M);
}
}
vector<int> SOLVE(int n,int m,int a,int b,vector<int> va,vector<int> vb){
N = n,M = m;
for(int i = 0;i<m;i++){
edges.push_back({va[i],vb[i]});
paths[va[i]].push_back({vb[i],i});
paths[vb[i]].push_back({va[i],i});
}
if(a>=3)return S1::GO();
else return S2::GO();
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
return ANTHONY::SOLVE(N,M,A,B,U,V);
}
#include "Catherine.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fs first
#define sc second
namespace NEKO{
int task;
vector<int> route;
} // namespace
void Init(int A, int B) {
NEKO::task = (A<=2);
return;
}
namespace S1{
int GO(vector<int> v){
//cout<<"CAT 1"<<endl;
int sum = 0;
for(auto &i:v)cout<<i;cout<<endl;
for(auto &i:v)sum += (i?1:0);
if(sum == 1)return max_element(v.begin(),v.end())-v.begin();
int s = 0;
for(int i = 0;i<3;i++){
if(v[i])s ^= i;
}
switch(s){
case 1:
return 0;
case 2:
return 2;
case 3:
return 1;
}
assert(false);
return -1;
}
}
namespace S2{
int GO(vector<int> v){
//cout<<"CAT 2"<<endl;
return 0;
}
}
int Move(std::vector<int> y) {
if(NEKO::task)return S2::GO(y);
else return S1::GO(y);
}
Compilation message
Anthony.cpp: In function 'std::vector<int> ANTHONY::S1::GO()':
Anthony.cpp:37:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
37 | auto [a,b] = edges[i];
| ^
Anthony.cpp:43:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
43 | for(int i = 0;i<N;i++)cout<<dist[i]<<' ';cout<<endl;
| ^~~
Anthony.cpp:43:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
43 | for(int i = 0;i<N;i++)cout<<dist[i]<<' ';cout<<endl;
| ^~~~
Catherine.cpp: In function 'int S1::GO(std::vector<int>)':
Catherine.cpp:25:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
25 | for(auto &i:v)cout<<i;cout<<endl;
| ^~~
Catherine.cpp:25:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
25 | for(auto &i:v)cout<<i;cout<<endl;
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
4540 KB |
Program didn't exit properly, or you printed something to stdout. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
4540 KB |
Program didn't exit properly, or you printed something to stdout. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
46 ms |
4644 KB |
Program didn't exit properly, or you printed something to stdout. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
46 ms |
4644 KB |
Program didn't exit properly, or you printed something to stdout. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1572 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
11472 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
11608 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |