Submission #134826

# Submission time Handle Problem Language Result Execution time Memory
134826 2019-07-23T09:47:11 Z Just_Solve_The_Problem Amusement Park (JOI17_amusement_park) C++17
0 / 100
32 ms 4336 KB
#include <bits/stdc++.h>
#include "Joi.h"

#define ll long long

using namespace std;

const int maxn = (int)1e4 + 7;

static vector <int> gr[maxn];
static int used[maxn], d[maxn];
static int n;
static ll x;

void dfs(int v) {
  used[v] = 1;
  MessageBoard(v, (x >> d[v]) & 1);
  for (int to : gr[v]) {
    if (used[to]) continue;
    d[to] = d[v] + 1;
    dfs(to);
  }
}

void Joi(int N, int M, int A[], int B[], long long X, int T) {
  n = N;
  x = X;
  for (int i = 0; i < M; i++) {
    gr[A[i]].push_back(B[i]);
    gr[B[i]].push_back(A[i]);
  }
  dfs(0);
}
#include <bits/stdc++.h>
#include "Ioi.h"

#define ll long long

using namespace std;

const int maxn = (int)1e4 + 7;

static int pr[maxn], used[maxn], d[maxn];
static vector <int> vec, gr[maxn];
static int n;
static ll x;

void bfs(int v) {
  queue <int> q;
  q.push(v);
  used[v] = 1;
  while (!q.empty()) {
    v = q.front();
    q.pop();
    for (int to : gr[v]) {
      if (used[to]) continue;
      used[to] = 1;
      pr[to] = v;
      q.push(to);
    }
  }
}

int ok;

void dfs1(int v) {
  if (ok) return ;
  if (d[v] < 60) {
    x |= (used[v] << d[v]);
    if (d[v] == 59) {
      ok = 1;
    } 
  }
  for (int to : gr[v]) {
    if (d[to] != -1) continue;
    d[to] = d[v] + 1;
    used[to] = Move(to);
    dfs1(to);
  }
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
  n = N;
  for (int i = 0; i < M; i++) {
    gr[A[i]].push_back(B[i]);
    gr[B[i]].push_back(A[i]);
  }
  bfs(P);
  int cur = 0;
  vector <int> vec;
  while (cur != P) {
    vec.push_back(cur);
    cur = pr[cur];
  }
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    used[i] = d[i] = -1;
  }
  for (int i = 0; i < vec.size(); i++) {
    used[vec[i]] = Move(vec[i]);
  }
  d[0] = 0;
  dfs1(0);
  return x;
}

Compilation message

Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:66:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < vec.size(); i++) {
                   ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1396 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 4224 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1140 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 4336 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 4336 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -