# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
925941 | mickey080929 | Stray Cat (JOI20_stray) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
int seq[] = {1, 1, 0, 1, 0, 0};
vector<int> adj[20010];
int dist[20010];
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
for (int i=0; i<M; i++) {
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
memset(dist, -1, sizeof(dist));
queue<int> q;
q.push(0);
dist[0] = 0;
while (!q.empty()) {
int x = q.front();
q.pop();
for (auto &y : adj[x]) {
if (dist[y] != -1) {
dist[y] = dist[x] + 1;
q.push(y);
}
}
}
vector<int> ret(M);
if (A >= 3) {
for (int i=0; i<M; i++) {
ret[i] = min(dist[U[i]], dist[V[i]]) % 3;
assert(ret[i]>=0 && ret[i]<A)
}
}
else {
for (int i=0; i<M; i++) {
ret[i] = seq[min(dist[U[i]], dist[V[i]]) % 6];
}
}
return ret;
}
#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) {
if (A >= 3) {
if (y[0] && y[1]) return 0;
if (y[1] && y[2]) return 1;
if (y[2] && y[0]) return 2;
if (y[0]) return 0;
if (y[1]) return 1;
if (y[2]) return 2;
assert(0);
}
}