Submission #134856

# Submission time Handle Problem Language Result Execution time Memory
134856 2019-07-23T10:25:12 Z Just_Solve_The_Problem Amusement Park (JOI17_amusement_park) C++17
18 / 100
34 ms 4224 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++;
  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);
}
#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 cur;

void dfs1(int v) {
  if (cur < 60) {
    if (used[v])
      x |= (1LL << cur);
  } else {
    return ;
  }
  cur++;
  for (int to : gr[v]) {
    if (d[to] != -1) continue;
    used[to] = Move(to);
    d[to] = 0;
    dfs1(to);
    Move(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]);
  }
  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;
  }
  used[P] = V;
  for (int i = 0; i < vec.size(); i++) {
    used[vec[i]] = Move(vec[i]);
  }
  d[0] = 0;
  x = 0;
  dfs1(0);
  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:68: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 Correct 4 ms 1136 KB Output is correct
2 Correct 4 ms 1276 KB Output is correct
3 Correct 4 ms 1404 KB Output is correct
4 Correct 4 ms 1268 KB Output is correct
5 Correct 4 ms 1272 KB Output is correct
6 Correct 4 ms 1140 KB Output is correct
7 Correct 4 ms 1404 KB Output is correct
8 Correct 4 ms 1404 KB Output is correct
9 Correct 4 ms 1408 KB Output is correct
10 Correct 4 ms 1140 KB Output is correct
11 Correct 8 ms 1728 KB Output is correct
12 Correct 4 ms 1280 KB Output is correct
13 Correct 4 ms 1412 KB Output is correct
14 Correct 4 ms 1404 KB Output is correct
15 Correct 4 ms 1520 KB Output is correct
16 Correct 4 ms 1276 KB Output is correct
17 Correct 5 ms 1404 KB Output is correct
18 Correct 4 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 3852 KB Output is correct
2 Correct 31 ms 4096 KB Output is correct
3 Correct 31 ms 4224 KB Output is correct
4 Correct 19 ms 3204 KB Output is correct
5 Correct 20 ms 3252 KB Output is correct
6 Correct 19 ms 3224 KB Output is correct
7 Correct 20 ms 3224 KB Output is correct
8 Correct 19 ms 3224 KB Output is correct
9 Correct 19 ms 3096 KB Output is correct
10 Correct 19 ms 3104 KB Output is correct
11 Correct 19 ms 3100 KB Output is correct
12 Correct 17 ms 2956 KB Output is correct
13 Correct 17 ms 2820 KB Output is correct
14 Correct 19 ms 2964 KB Output is correct
15 Correct 24 ms 3096 KB Output is correct
16 Correct 20 ms 3176 KB Output is correct
17 Correct 19 ms 3136 KB Output is correct
18 Correct 19 ms 3096 KB Output is correct
19 Correct 20 ms 3132 KB Output is correct
20 Correct 17 ms 3320 KB Output is correct
21 Correct 17 ms 3096 KB Output is correct
22 Correct 19 ms 3096 KB Output is correct
23 Correct 23 ms 3360 KB Output is correct
24 Correct 22 ms 3224 KB Output is correct
25 Correct 19 ms 3172 KB Output is correct
26 Correct 23 ms 3096 KB Output is correct
27 Correct 20 ms 3224 KB Output is correct
28 Correct 19 ms 3224 KB Output is correct
29 Correct 20 ms 2952 KB Output is correct
30 Correct 19 ms 3092 KB Output is correct
31 Correct 4 ms 1268 KB Output is correct
32 Correct 4 ms 1140 KB Output is correct
33 Correct 4 ms 1404 KB Output is correct
34 Correct 4 ms 1140 KB Output is correct
35 Correct 4 ms 1268 KB Output is correct
36 Correct 5 ms 1140 KB Output is correct
37 Correct 4 ms 1268 KB Output is correct
38 Correct 4 ms 1140 KB Output is correct
39 Correct 4 ms 1276 KB Output is correct
40 Correct 4 ms 1140 KB Output is correct
41 Correct 4 ms 1276 KB Output is correct
42 Correct 4 ms 1140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1400 KB Output is correct
2 Correct 4 ms 1408 KB Output is correct
3 Correct 4 ms 1140 KB Output is correct
4 Correct 6 ms 1568 KB Output is correct
5 Incorrect 6 ms 1568 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 32 ms 4080 KB Partially correct
2 Partially correct 31 ms 4096 KB Partially correct
3 Partially correct 31 ms 4104 KB Partially correct
4 Partially correct 19 ms 3096 KB Partially correct
5 Incorrect 20 ms 3312 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 3864 KB Output isn't correct
2 Halted 0 ms 0 KB -