Submission #481937

# Submission time Handle Problem Language Result Execution time Memory
481937 2021-10-22T09:42:38 Z jesus_coconut Amusement Park (JOI17_amusement_park) C++17
18 / 100
28 ms 4068 KB
#include <bits/stdc++.h>
#include "Joi.h"

using namespace std;
using ll = long long;

void Joi(int N, int M, int A[], int B[], long long X, int T) {
  bool bio[N];
  memset(bio, 0, sizeof bio);
  int p = 0;
  vector<vector<int>> adj(N);
  for (int i = 0; i < M; ++i) {
    adj[A[i]].push_back(B[i]);
    adj[B[i]].push_back(A[i]);
  }
  for (auto &v: adj) sort(begin(v), end(v));
  function<void(int)> dfs = [&](int ver) {
    bio[ver] = true;
    MessageBoard(ver, (X >> p++) & 1);
    p %= 60;
    for (auto u: adj[ver]) if (!bio[u]) {
      dfs(u);
    }
  };
  dfs(0);
}
#include <bits/stdc++.h>
#include "Ioi.h"

using namespace std;

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
  vector<vector<int>> adj(N);
  for (int i = 0; i < M; ++i) {
    adj[A[i]].push_back(B[i]);
    adj[B[i]].push_back(A[i]);
  }
  for (auto &v: adj) sort(begin(v), end(v));
  int col[N];
  bool bio[N];
  memset(bio, 0, sizeof bio);
  int p = 0;
  function<void(int)> dfsfind = [&](int ver) {
    bio[ver] = true;
    col[ver] = p++;
    p %= 60;
    for (auto u: adj[ver]) if (!bio[u]) {
      dfsfind(u);
    }
  };
  dfsfind(0);
  memset(bio, 0, sizeof bio);
  long long ans = (1ll * V) << col[P];
  function<void(int, int)> dfs = [&](int ver, int par) {
    bio[ver] = true;
    for (auto u: adj[ver]) if (!bio[u]) {
      long long v = Move(u);
      ans |= v << col[u];
      dfs(u, ver);
    }
    if (par != -1) Move(par);
  };
  dfs(P, -1);
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 488 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 4 ms 620 KB Output is correct
4 Correct 2 ms 496 KB Output is correct
5 Correct 0 ms 488 KB Output is correct
6 Correct 0 ms 496 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 2 ms 744 KB Output is correct
9 Correct 2 ms 624 KB Output is correct
10 Correct 1 ms 496 KB Output is correct
11 Correct 5 ms 920 KB Output is correct
12 Correct 1 ms 500 KB Output is correct
13 Correct 1 ms 620 KB Output is correct
14 Correct 0 ms 748 KB Output is correct
15 Correct 2 ms 620 KB Output is correct
16 Correct 1 ms 628 KB Output is correct
17 Correct 1 ms 628 KB Output is correct
18 Correct 3 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 4032 KB Output is correct
2 Correct 28 ms 4064 KB Output is correct
3 Correct 24 ms 4044 KB Output is correct
4 Correct 15 ms 2392 KB Output is correct
5 Correct 15 ms 3484 KB Output is correct
6 Correct 15 ms 2936 KB Output is correct
7 Correct 17 ms 3052 KB Output is correct
8 Correct 15 ms 2868 KB Output is correct
9 Correct 18 ms 2908 KB Output is correct
10 Correct 15 ms 2500 KB Output is correct
11 Correct 19 ms 2492 KB Output is correct
12 Correct 13 ms 2216 KB Output is correct
13 Correct 14 ms 2232 KB Output is correct
14 Correct 13 ms 2236 KB Output is correct
15 Correct 15 ms 2324 KB Output is correct
16 Correct 15 ms 2364 KB Output is correct
17 Correct 15 ms 2392 KB Output is correct
18 Correct 16 ms 2588 KB Output is correct
19 Correct 15 ms 2412 KB Output is correct
20 Correct 12 ms 2988 KB Output is correct
21 Correct 13 ms 2896 KB Output is correct
22 Correct 16 ms 2640 KB Output is correct
23 Correct 15 ms 2776 KB Output is correct
24 Correct 15 ms 2848 KB Output is correct
25 Correct 15 ms 2720 KB Output is correct
26 Correct 15 ms 2744 KB Output is correct
27 Correct 15 ms 2764 KB Output is correct
28 Correct 15 ms 2808 KB Output is correct
29 Correct 14 ms 2648 KB Output is correct
30 Correct 16 ms 2740 KB Output is correct
31 Correct 1 ms 496 KB Output is correct
32 Correct 2 ms 496 KB Output is correct
33 Correct 1 ms 756 KB Output is correct
34 Correct 1 ms 496 KB Output is correct
35 Correct 1 ms 488 KB Output is correct
36 Correct 1 ms 492 KB Output is correct
37 Correct 2 ms 608 KB Output is correct
38 Correct 1 ms 496 KB Output is correct
39 Correct 1 ms 500 KB Output is correct
40 Correct 1 ms 492 KB Output is correct
41 Correct 1 ms 488 KB Output is correct
42 Correct 2 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 488 KB Output is correct
2 Correct 0 ms 488 KB Output is correct
3 Correct 1 ms 496 KB Output is correct
4 Incorrect 4 ms 1104 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 3988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 4068 KB Output isn't correct
2 Halted 0 ms 0 KB -