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;
#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
namespace {
bool st;
int n,m;
vector<int> al[20005];
int w[20005];
queue<int> q;
}
vector<signed> Mark(signed N, signed M, signed A, signed B,
vector<signed> U, vector<signed> V) {
st=(A>=3);
n=N,m=M;
if (st){
rep(x,0,m){
al[U[x]].pub(V[x]);
al[V[x]].pub(U[x]);
}
memset(w,-1,sizeof(w));
q.push(0);
while (!q.empty()){
int u=q.front(); q.pop();
for (auto it:al[u]) if (w[it]==-1){
w[it]=w[u]+1;
q.push(it);
}
}
vector<signed> res;
rep(x,0,m){
int a=w[U[x]],b=w[V[x]];
res.pub(min(w[U[x]],w[V[x]])%3);
}
return res;
}
else{
return {};
}
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
namespace {
bool st;
int PREV=-1;
}
void Init(signed A, signed B) {
st=(A>=3);
}
signed Move(vector<signed> y) {
if (st){
vector<int> v;
rep(x,0,3) if (y[x] || PREV==x) v.pub(x);
sort(all(v));
if (sz(v)==1){
return PREV=v[0];
}
else if (v[1]==1){
return PREV=0;
}
else if (v[0]==1){
return PREV=1;
}
else{
return PREV=2;
}
}
else{
return 69;
}
}
Compilation message (stderr)
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:56:8: warning: unused variable 'a' [-Wunused-variable]
56 | int a=w[U[x]],b=w[V[x]];
| ^
Anthony.cpp:56:18: warning: unused variable 'b' [-Wunused-variable]
56 | int a=w[U[x]],b=w[V[x]];
| ^
# | 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... |