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 <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int FunctionExample(int i, int A) {
return i % A;
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
std::vector<int> X(M,-1);
vector<vector<pair<int,int>>> adj(N,vector<pair<int,int>>(0));//node,index of road
for(int i=0;i<M;i++){
adj[U[i]].push_back({V[i],i});
adj[V[i]].push_back({U[i],i});
}
if(A==4 || A==3){
vector<int> dists(N,-1);
dists[0]=0;
queue<int> q;
q.push(0);
while(q.size()>0){
int cur=q.front();
q.pop();
for(pair<int,int>& it:adj[cur]){
if(dists[it.first]==-1){
dists[it.first]=dists[cur]+1;
X[it.second]=dists[cur]%3;
q.push(it.first);
}
}
}
for(int i=0;i<M;i++){
if(X[i]==-1){
vector<int> cur(3,0);
vector<int> cur1(3,0);
for(pair<int,int>& it:adj[U[i]]){
if(X[it.second]!=-1){
cur[X[it.second]]=1;
}
}
for(pair<int,int>& it:adj[V[i]]){
if(X[it.second]!=-1){
cur1[X[it.second]]=1;
}
}
vector<int> a = cur;
for(int p=0;p<3;p++){
if(cur1[p]==1){
a[p]++;
}
}
if(a[0]>0 && a[1]>0 && a[2]>0){
if(a[0]==2){
X[i]=0;
}
else if(a[1]==2){
X[i]=1;
}
else{
X[i]=2;
}
}
if(a[0]==0){
X[i]=2;
}
if(a[1]==0){
X[i]=0;
}
if(a[2]==0){
X[i]=1;
if(a[0]==0){
X[i]=2;
}
}
}
}
}
/**for(int&it:X){
cout<<it<<" ";
}
cout<<endl;**/
return X;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int A, B, out;
int variable_example = 0;
vector<int> cur;
vector<int> pastMoves;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(std::vector<int> y) {
out=0;
cur = vector<int>(4,0);
if(A==4 || A==3){
if(pastMoves.size()>0){
y[pastMoves.back()]++;
}
for(int i=0;i<y.size();i++){
if(y[i]>0){
cur[i]=1;
}
}
if(cur[0]==1 && cur[1]==1){
out=0;
}
else if(cur[1]==1&&cur[2]==1){
out=1;
}
else if(cur[2]==1&&cur[0]==1){
out=2;
}
else if(cur[0]==1){
out=0;
}
else if(cur[1]==1){
out=1;
}
else{
out=2;
}
}
pastMoves.push_back(out);
return out;
}
Compilation message (stderr)
Anthony.cpp:7:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
7 | int FunctionExample(int i, int A) {
| ^~~~~~~~~~~~~~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i=0;i<y.size();i++){
| ~^~~~~~~~~
Catherine.cpp: At global scope:
Catherine.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
7 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# | 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... |