Submission #134885

# Submission time Handle Problem Language Result Execution time Memory
134885 2019-07-23T11:27:57 Z Just_Solve_The_Problem Amusement Park (JOI17_amusement_park) C++17
0 / 100
33 ms 4296 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, cur;
static ll x;

void dfs(int v) {
  used[v] = 1;
  MessageBoard(v, (x >> cur) & 1);
  cur++;
  if (cur >= 60) cur -= 60;
  for (int to : gr[v]) {
    if (used[to]) continue;
    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);
  for (int i = 0; i < n; i++) {
    assert(used[i]);
  }
  //cerr << X << endl;
}
#include <bits/stdc++.h>
#include "Ioi.h"

#define ll long long

using namespace std;

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

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

void dfs2(int v) {
  used[v] = 1;
  vec.push_back(v);
  d[v] = cur;
  cur++;
  if (cur >= 60) cur -= 60;
  for (int to : gr[v]) {
    if (used[to]) continue;
    dfs2(to);
    vec.push_back(v);
  }
}

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]);
  }
  for (int i = 0; i < n; i++) {
    used[i] = 0;
  }
  dfs2(0);
  for (int i = 0; i < n; i++) {
    used[i] = 0;
  }
  used[P] = V;
  int ind = 0;
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i] == P) {
      ind = i;
      break;
    }
  }
  int cnt = 0;
  set <int> S;
  cur = P;
  S.clear();
  int i = ind;
  while (1) {
    S.insert(d[vec[i]]);
    if (cur != vec[i]) used[vec[i]] = Move(vec[i]);
    cur = vec[i];
    if (used[vec[i]])
      x |= (1LL << d[vec[i]]);
    if (S.size() >= 60) break;
    i++;
    if (i >= vec.size()) i -= vec.size();
  }
  cout << endl;
  //cerr << x << endl;
  return x;
}

Compilation message

Joi.cpp:11:24: warning: 'd' defined but not used [-Wunused-variable]
 static int used[maxn], d[maxn];
                        ^

Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:44:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < vec.size(); i++) {
                   ~~^~~~~~~~~~~~
Ioi.cpp:63:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (i >= vec.size()) i -= vec.size();
         ~~^~~~~~~~~~~~~
Ioi.cpp:50:7: warning: unused variable 'cnt' [-Wunused-variable]
   int cnt = 0;
       ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1372 KB Do not print anything on standard output.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 4288 KB Do not print anything on standard output.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1272 KB Do not print anything on standard output.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 4296 KB Do not print anything on standard output.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 4160 KB Do not print anything on standard output.
2 Halted 0 ms 0 KB -