Submission #710444

# Submission time Handle Problem Language Result Execution time Memory
710444 2023-03-15T08:45:51 Z MinhAnhnd Stray Cat (JOI20_stray) C++14
0 / 100
33 ms 14680 KB
#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>

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> adj[20001];
  int index[20001] = {};
  int special[20001] = {};
  int parent[20001] = {};
  std::vector<int> X(M);
  std::queue<int> bfs;
  bfs.push(0);
  index[0] = 1;
  int order[7] = {2,1,2,2,1,1,1};
  for (int i = 0; i < M; ++i) {
    adj[U[i]].push_back(V[i]);
    adj[V[i]].push_back(U[i]);
  }
  while(!bfs.empty()){
    int node = bfs.front();
    int child_num = 0;
    bfs.pop();
    for(auto child:adj[node]){
        if(index[child]==0){
            child_num++;
            parent[child] = node;
        }
    }
    if (child_num>1) for(auto child:adj[node]){
        if(index[child]==0){

            index[child] = index[node] ^ 3;
            //cout<<child<<" "<<index[child]<<" checker"<<endl;
            bfs.push(child);
        }
    }
    else if (child_num==1)for(auto child:adj[node]){
        if(special[parent[node]]==0){
           if (index[node]==1){
                special[node] = 0;
           }else{
                special[node] = 1;
           }
        } else{
           special[node] = special[parent[node]] + 1;
           if (special[node]==7) special[node] = 0;
        }
        long checker = special[node]+1;
        if (checker==7) checker = 0;
        index[child] = order[checker];
        //special[node] = special[parent];
        bfs.push(child);
    }
  }

  for (int i = 0; i < M; ++i) {
    int nodeA = U[i];
    int nodeB = V[i];
    if (parent[nodeA]==nodeB){
        X[i] = index[nodeA]-1; //cout<<i<<" "<<nodeA<<endl;
    }
    else {X[i] = index[nodeB]-1;
    }
    /*if(nodeA > nodeB) std::swap(nodeA,nodeB);
    if((nodeA == 1)&&(nodeB == 2)) X[i] = 0;
    if((nodeA == 2)&&(nodeB == 3)) X[i] = 1;
    if((nodeA == 1)&&(nodeB == 3)) X[i] = 2;
    if((nodeA == 2)&&(nodeB == 2)) X[i] = 1;
    if((nodeA == 3)&&(nodeB == 3)) X[i] = 2;
    if((nodeA == 1)&&(nodeB == 1)) X[i] = 0;*/
  }
  return X;
}
#include "Catherine.h"
#include <vector>

namespace {

int A, B;
int variable_example = 0;
int sum = 0;
int flag = 0;
int previous = -1;
int time_ = 0;
long bit = 0;
}  // namespace

using namespace std;

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

int Move(std::vector<int> y) {

  /*for (int j = 0; j < A; ++j) {
    if (y[j] != 0) {
      return j;
    }
  }*/
  int max_in;
  int min_in;
  int min_val;
  int max_val;
  std::vector<int> temp = y;
  if(previous>=0) temp[previous]++;
  sum = temp[0] + temp[1];
  if(temp[0]>temp[1]){
    max_in = 0;
    min_in = 1;
    max_val= temp[0];
    min_val= temp[1];
  }
  else{
    max_in = 1;
    min_in = 0;
    max_val = temp[1];
    min_val= temp[0];
  }

  if(flag && (y[0]==0)){
    previous = 1;
    return 1;
  }
  if(flag && (y[1]==0)){
    previous = 0;
    return 0;
  }
  if (flag){
    previous = min_in;
    return min_in;
  }

  if((y[0]==0) && (y[1]==0)){
    flag = 1;
    return -1;
  }
  if((min_val==0)&&(max_val==1)){
    flag = 1;
    previous = max_in;
    return max_in;
  }
  if((y[0]==0)&&(sum>2)){
    flag = 1;
    return -1;
  }
  if((y[1]==0)&&(sum>2)){
    flag = 1;
    return -1;
  }
  if((max_val>1)&&(sum>2)){
    flag = 1;
    previous = min_in;
    return min_in;
  }

  time_++;
  if(previous==-1){
    if(min_val == 0){
        bit += max_in;
    } else{
        bit += min_in;
    }

    bit += (max_in << time_);
  } else{
    bit += (max_in << time_);
  }

  if(time_==6){
        if ((bit==88)||(bit==49)||(bit==98)||(bit==69)||(bit==44)||(bit==22)||(bit==11)){
            flag = 1;
            return -1;
        }
        else{
            previous = max_in;
            flag = 1;
            return max_in;
        }
  }
  previous = max_in;
  return max_in;
}

Compilation message

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:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 14680 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 14680 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 12520 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 12520 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1484 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 10876 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10980 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -