Submission #139727

# Submission time Handle Problem Language Result Execution time Memory
139727 2019-08-01T10:24:51 Z win11905 Amusement Park (JOI17_amusement_park) C++14
28 / 100
37 ms 4600 KB
#include <bits/stdc++.h>
#include "Joi.h"
#define long long long
using namespace std;

const int N = 1e4+5;

static int n, m;
static long val;
static vector<int> g[N];
static bool check[N];
static int ptr;

static void dfs(int u) {
  MessageBoard(u, val >> (ptr++) & 1);
  ptr %= 60;
  check[u] = true;
  for(int v : g[u]) if(!check[v]) 
    dfs(v);
}

void Joi(int N, int M, int A[], int B[], long X, int T) {
  n = N, m = M, val = X;
  for(int i = 0; i < m; ++i) {
    g[A[i]].emplace_back(B[i]);
    g[B[i]].emplace_back(A[i]);
  }
  dfs(0);
}
#include <bits/stdc++.h>
#include "Ioi.h"
#define long long long
using namespace std;

const int N = 1e4+5;

static int n, m;
static vector<int> g[N];
static bool check[N];
static int ptr, pos[N];
static vector<int> euler;

static void dfs(int u) {
  pos[u] = ptr++;
  ptr %= 60;
  check[u] = true;
  euler.emplace_back(u);
  for(int v : g[u]) if(!check[v]) {
    dfs(v);
    euler.emplace_back(u);
  }
}

static int cnt;
static long val;
static bool mark[60];

long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
  n = N, m = M;
  for(int i = 0; i < m; ++i) {
    g[A[i]].emplace_back(B[i]);
    g[B[i]].emplace_back(A[i]);
  }
  dfs(0);
  int z = euler.size();
  reverse(euler.begin(), euler.end());
  for(int i = 1; i < z; ++i) euler.emplace_back(euler[i]);
  ptr = -1;
  while(cnt < 60) {
    ptr++;
    if(cnt == 0 && euler[ptr] != P) continue;
    if(cnt != 0) V = Move(euler[ptr]);
    if(!mark[pos[euler[ptr]]]) mark[pos[euler[ptr]]] = true, cnt++;
    if(V) val |= 1ll << pos[euler[ptr]];
  }
  return val;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1376 KB Output is correct
2 Correct 8 ms 1364 KB Output is correct
3 Correct 5 ms 1144 KB Output is correct
4 Correct 3 ms 1508 KB Output is correct
5 Correct 4 ms 1380 KB Output is correct
6 Correct 5 ms 1520 KB Output is correct
7 Correct 4 ms 1280 KB Output is correct
8 Correct 5 ms 1408 KB Output is correct
9 Correct 4 ms 1404 KB Output is correct
10 Correct 4 ms 1264 KB Output is correct
11 Correct 8 ms 1572 KB Output is correct
12 Correct 4 ms 1272 KB Output is correct
13 Correct 6 ms 1360 KB Output is correct
14 Correct 4 ms 1272 KB Output is correct
15 Correct 6 ms 1400 KB Output is correct
16 Correct 6 ms 1408 KB Output is correct
17 Correct 6 ms 1508 KB Output is correct
18 Correct 5 ms 1516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 4460 KB Output is correct
2 Correct 34 ms 4516 KB Output is correct
3 Correct 37 ms 4288 KB Output is correct
4 Correct 20 ms 3132 KB Output is correct
5 Correct 20 ms 3468 KB Output is correct
6 Correct 20 ms 3448 KB Output is correct
7 Correct 20 ms 3476 KB Output is correct
8 Correct 20 ms 3512 KB Output is correct
9 Correct 20 ms 3512 KB Output is correct
10 Correct 19 ms 3128 KB Output is correct
11 Correct 20 ms 3464 KB Output is correct
12 Correct 18 ms 3088 KB Output is correct
13 Correct 19 ms 3184 KB Output is correct
14 Correct 19 ms 3060 KB Output is correct
15 Correct 20 ms 3136 KB Output is correct
16 Correct 20 ms 3168 KB Output is correct
17 Correct 20 ms 3000 KB Output is correct
18 Correct 20 ms 3128 KB Output is correct
19 Correct 20 ms 3156 KB Output is correct
20 Correct 17 ms 3392 KB Output is correct
21 Correct 19 ms 3568 KB Output is correct
22 Correct 20 ms 3256 KB Output is correct
23 Correct 20 ms 3384 KB Output is correct
24 Correct 20 ms 3460 KB Output is correct
25 Correct 20 ms 3256 KB Output is correct
26 Correct 20 ms 3428 KB Output is correct
27 Correct 20 ms 3392 KB Output is correct
28 Correct 20 ms 3648 KB Output is correct
29 Correct 19 ms 3112 KB Output is correct
30 Correct 20 ms 3376 KB Output is correct
31 Correct 4 ms 1488 KB Output is correct
32 Correct 2 ms 1268 KB Output is correct
33 Correct 4 ms 1272 KB Output is correct
34 Correct 4 ms 1264 KB Output is correct
35 Correct 4 ms 1368 KB Output is correct
36 Correct 4 ms 1264 KB Output is correct
37 Correct 4 ms 1504 KB Output is correct
38 Correct 4 ms 1212 KB Output is correct
39 Correct 4 ms 1264 KB Output is correct
40 Correct 4 ms 1260 KB Output is correct
41 Correct 4 ms 1132 KB Output is correct
42 Correct 4 ms 1264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1400 KB Output is correct
2 Correct 4 ms 1268 KB Output is correct
3 Correct 6 ms 1372 KB Output is correct
4 Correct 6 ms 1752 KB Output is correct
5 Correct 7 ms 1660 KB Output is correct
6 Correct 7 ms 1808 KB Output is correct
7 Correct 7 ms 1768 KB Output is correct
8 Correct 7 ms 1680 KB Output is correct
9 Correct 18 ms 3904 KB Output is correct
10 Correct 17 ms 4156 KB Output is correct
11 Correct 17 ms 4024 KB Output is correct
12 Correct 4 ms 1400 KB Output is correct
13 Correct 4 ms 1400 KB Output is correct
14 Correct 4 ms 1264 KB Output is correct
15 Correct 4 ms 1264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 33 ms 4480 KB Partially correct
2 Correct 33 ms 4600 KB Output is correct
3 Partially correct 34 ms 4516 KB Partially correct
4 Partially correct 20 ms 3032 KB Partially correct
5 Correct 20 ms 3640 KB Output is correct
6 Correct 25 ms 3420 KB Output is correct
7 Partially correct 20 ms 3396 KB Partially correct
8 Partially correct 20 ms 3128 KB Partially correct
9 Partially correct 20 ms 3388 KB Partially correct
10 Correct 19 ms 3392 KB Output is correct
11 Correct 19 ms 3380 KB Output is correct
12 Partially correct 18 ms 3120 KB Partially correct
13 Correct 18 ms 3120 KB Output is correct
14 Correct 19 ms 3176 KB Output is correct
15 Partially correct 20 ms 3156 KB Partially correct
16 Correct 20 ms 3136 KB Output is correct
17 Partially correct 20 ms 3136 KB Partially correct
18 Correct 20 ms 3180 KB Output is correct
19 Correct 20 ms 3020 KB Output is correct
20 Incorrect 17 ms 3520 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 4516 KB Output is correct
2 Correct 32 ms 4424 KB Output is correct
3 Incorrect 32 ms 4524 KB Output isn't correct
4 Halted 0 ms 0 KB -