Submission #764479

# Submission time Handle Problem Language Result Execution time Memory
764479 2023-06-23T12:45:16 Z ngrace Stray Cat (JOI20_stray) C++14
0 / 100
27 ms 15040 KB
#include <bits/stdc++.h>
#include "Anthony.h"
using namespace std;
#define v vector
#define ii pair<int,int>
#define fi first
#define se second

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);
  for (int i = 0; i < M; ++i) {
    X[i] = -1;//FunctionExample(i, A);
  }

  v<int> seq = {1,0,1,1,0,0};

  v<v<ii>> adj(N);
  for(int i=0; i<M; i++){
    adj[U[i]].push_back({V[i],i});
    adj[V[i]].push_back({U[i],i});
  }

  queue<ii> q;
  q.push({0,0});
  while(q.size()>0){
    int cur=q.front().fi;
    int dep=q.front().se;
    q.pop();

    int last=-1;
    int lastind=-1;
    for(ii it:adj[cur]){
      if(X[it.se]!=-1){
        last=X[it.se];
        lastind=it.se;
      }
    }

    if(cur==0){
      for(ii it:adj[cur]) X[it.se] = seq[0];
    }else{
      if(adj[cur].size()>2){
        for(ii it:adj[cur]){
          if(it.se!=lastind) X[it.se] = (last+1)%2;
          if(last==1) dep=1;
          else dep=0;
        }
      } else{
        for(ii it:adj[cur]){
          if(it.se!=lastind) X[it.se] = seq[dep%6];
        }
      }
    }

    for(ii it:adj[cur]){
      if(it.se!=lastind) q.push({it.fi, dep+1});
    }
  }

  //for(int i:X) cout<<i<<" ";
  //cout<<endl;

  return X;
}
#include <bits/stdc++.h>
#include "Catherine.h"
using namespace std;
#define v vector
#define ii pair<int,int>
#define fi first
#define se second

namespace {

int A, B;
int lastmark = -1;
v<int> seq = {0,0,1,1,0,1};
v<int> moves;

}  // namespace

void Init(int A, int B) {
  ::A = A;
  ::B = B;
}

int Move(std::vector<int> y) {
  int numedge=y[0]+y[1] + (lastmark!=-1);
  
  //cout<<y[0]<<" "<<y[1]<<" "<<lastmark<<endl;

  if(lastmark==-1){
    if(numedge>2){
      lastmark = (y[0]>y[1]) ? 1 : 0;
      moves.push_back(lastmark);
      return lastmark;
    } else{
      lastmark = (y[0]>0) ? 0 : 1;
      //cout<<"?"<<y[0]<<" "<<y[1]<<" "<<lastmark<<endl;
      if(numedge==2) moves.push_back((y[lastmark]>1) ? lastmark : (lastmark+1)%2);
      moves.push_back(lastmark);
      return lastmark;
    }
  } 
  
  if(numedge>2){
    y[lastmark]++;
    lastmark = (y[0]>y[1]) ? 1 : 0;
    moves.clear();
    moves.push_back(lastmark);
    return (y[lastmark]==1) ? -1 : lastmark;
  }

  if(numedge==1){
    moves.clear();
    moves.push_back(lastmark);
    return -1;
  }

  if(moves.size()==4){
    //cout<<"!"<<moves[0]<<" "<<moves[1]<<" "<<moves[2]<<" "<<moves[3]<<endl;
    bool found=false;
    int next=-1;
    for(int i=0; i<6; i++){
      if(moves[0]==seq[i] && moves[1]==seq[(i+1)%6] && moves[2]==seq[(i+2)%6] && moves[3]==seq[(i+3)%6]){
        found=true;
        next=seq[(i+4)%6];
      }
    }
    if(!found || y[next]==0){
      moves.clear();
      moves.push_back(lastmark);
      return -1;
    }
  }

  lastmark = (y[0]==1) ? 0 : 1;
  moves.push_back(lastmark);
  return lastmark;
}

Compilation message

Anthony.cpp:11:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
   11 | int FunctionExample(int i, int A) {
      |     ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 15040 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 15040 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 12852 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 12852 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 908 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 11248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 11148 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -