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;
vector<int> Mark(int n, int m, int A, int b, vector<int> U, vector<int> V) {
vector<pair<int,int>> adj[n];
// cout << "test" << endl;
for (int i=0;i<m;i++) adj[U[i]].push_back({V[i], i}), adj[V[i]].push_back({U[i], i});
int a[6] = {1, 0, 1, 0, 0, 1};
int vis[n];
for (int i=0;i<n;i++) vis[i] = -1;
queue<int> Q;
vis[0] = 0;
Q.push(0);
vector<int> ans(m);
while (Q.size() > 0) {
int u = Q.front();
for (auto [v, id]:adj[u]) if (vis[v] == -1) {
if (adj[u].size()<=2) vis[v] = (vis[u]+1)%6;
else vis[v] = a[vis[u]];
ans[id] = a[vis[v]];
Q.push(v);
}
Q.pop();
}
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
int A;
void Init(int AA, int B) {
A = AA;
}
int cnt = 0, a[6] = {1, 0, 1, 0, 0, 1};
bool homerun = false;
int last = -1;
vector<int> track;
int Move(vector<int> v) {
cnt++;
if (homerun) {
if (v[0] + v[1] == 1) {
for (int i=0;i<A;i++) if (v[i]) {
last = i;
return i;
}
} else {
v[last]++;
for (int i=0;i<A;i++) if (v[i]==1) {
if (i==last) return -1;
else {
last = i;
return i;
}
}
}
}
if (cnt==1) {
if (v[0] + v[1] == 2) {
if (v[0]==2) {
track = {0, 0};
last = 0;
return 0;
}
if (v[1]==2) {
track = {1, 1};
last = 1;
return 1;
}
if (v[0]==1 && v[1]==1) {
track = {1, 0};
last = 0;
return 0;
}
}
homerun = true;
for (int i=0;i<A;i++) if (v[i]==1) {
last = i;
return i;
}
}
if (v[0] + v[1] != 1) {
homerun = true;
v[last]++;
for (int i=0;i<A;i++) if (v[i]==1) {
if (i==last) return -1;
else {
last = i;
return i;
}
}
}
if (cnt==4) {
homerun = true;
for (int i=0;i<A;i++) if (v[i]) track.push_back(i);
for (int i=0;i<6;i++) {
bool turn = true;
for (int j=0;j<5;j++) if (track[j] != a[(i+j)%6]) turn = false;
if (turn) return -1;
}
for (int i=0;i<A;i++) if (v[i]) {
last = i;
return i;
}
}
for (int i=0;i<A;i++) if (v[i]) {
track.push_back(i);
last = i;
return i;
}
// cout << "wat" << endl;
return 69420;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |