Submission #1077571

# Submission time Handle Problem Language Result Execution time Memory
1077571 2024-08-27T08:03:32 Z danikoynov Amusement Park (JOI17_amusement_park) C++14
Compilation error
0 ms 0 KB
#include "Ioi.h"

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int MAXN = 10010, MAXBIT = 60;
vector < int > graph[MAXN];
int marked[MAXN], linked[MAXN];
vector < int > path;

int next_bit;
void dfs(int v)
{
  marked[v] = 1;
  linked[v] = next_bit ++;
  if (next_bit == MAXBIT)
    next_bit = 0;
  //MessageBoard(v, ((X & ((ll)(1) << bit)) > 0));
  path.push_back(v);
  for (int u : graph[v])
  { 
    if (marked[u])
      continue;
    dfs(u);
    path.push_back(v);
  }
}

void build_tree(int N, int M, int A[], int B[])
{
  for (int i = 0; i < M; i ++)
  {
    graph[A[i]].push_back(B[i]);
    graph[B[i]].push_back(A[i]);
  }

  dfs(0);

  path.pop_back();
}

int bit_val[MAXBIT];

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) 
{
  build_tree(N, M, A, B);


  int pos = 0;
  while(path[pos] != P)
    pos ++;

  for (int cur : path)
    cout << cur << " ";
  cout << endl;
  bit_val[linked[P]] = V;
  int ver = P;
  for (int step = 0; step < 120; step ++)
  {
    
    int nxt = (pos + 1) % (int)(path.size());
    //cout << "move from " << ver  << " " << path[nxt] << endl;
    bool fine = false;
    for (int j = 0; j < M; j ++)
    {
      if (A[j] == ver && B[j] == path[nxt])
        fine = true;
      if (A[j] == path[nxt] && B[j] == ver)
        fine = true;
    }
 
    ver = path[nxt];  
    int res = Move(ver);   
    ///assert(step != 119);
    //cout << "linked " << linked[ver] << " " << res << endl;
    bit_val[linked[ver]] = res;
    pos = nxt;
  }

  assert(false);
  ll X = 0;
  for (int bit = 0; bit < MAXBIT; bit ++)
  {
    if (bit_val[bit] > 0)
      X |= ((ll)(1) << bit);
  }
  //cout << "X " << X << endl;
  return X;
}
#include "Ioi.h"

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int MAXN = 10010, MAXBIT = 60;
vector < int > graph[MAXN];
int marked[MAXN], linked[MAXN];
vector < int > path;

int next_bit;
void dfs(int v)
{
  marked[v] = 1;
  linked[v] = next_bit ++;
  if (next_bit == MAXBIT)
    next_bit = 0;
  //MessageBoard(v, ((X & ((ll)(1) << bit)) > 0));
  path.push_back(v);
  for (int u : graph[v])
  { 
    if (marked[u])
      continue;
    dfs(u);
    path.push_back(v);
  }
}

void build_tree(int N, int M, int A[], int B[])
{
  for (int i = 0; i < M; i ++)
  {
    graph[A[i]].push_back(B[i]);
    graph[B[i]].push_back(A[i]);
  }

  dfs(0);

  path.pop_back();
}

int bit_val[MAXBIT];

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) 
{
  build_tree(N, M, A, B);


  int pos = 0;
  while(path[pos] != P)
    pos ++;

  for (int cur : path)
    cout << cur << " ";
  cout << endl;
  bit_val[linked[P]] = V;
  int ver = P;
  for (int step = 0; step < 120; step ++)
  {
    
    int nxt = (pos + 1) % (int)(path.size());
    //cout << "move from " << ver  << " " << path[nxt] << endl;
    bool fine = false;
    for (int j = 0; j < M; j ++)
    {
      if (A[j] == ver && B[j] == path[nxt])
        fine = true;
      if (A[j] == path[nxt] && B[j] == ver)
        fine = true;
    }
 
    ver = path[nxt];  
    int res = Move(ver);   
    assert(step != 119);
    //cout << "linked " << linked[ver] << " " << res << endl;
    bit_val[linked[ver]] = res;
    pos = nxt;
  }

  ll X = 0;
  for (int bit = 0; bit < MAXBIT; bit ++)
  {
    if (bit_val[bit] > 0)
      X |= ((ll)(1) << bit);
  }
  //cout << "X " << X << endl;
  return X;
}

Compilation message

Joi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Joi.cpp:75:15: error: 'Move' was not declared in this scope
   75 |     int res = Move(ver);
      |               ^~~~

Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:65:10: warning: variable 'fine' set but not used [-Wunused-but-set-variable]
   65 |     bool fine = false;
      |          ^~~~