답안 #139726

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139726 2019-08-01T10:20:03 Z win11905 Amusement Park (JOI17_amusement_park) C++14
28 / 100
35 ms 4552 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();
  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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1404 KB Output is correct
2 Correct 4 ms 1272 KB Output is correct
3 Correct 4 ms 1352 KB Output is correct
4 Correct 4 ms 1372 KB Output is correct
5 Correct 4 ms 1268 KB Output is correct
6 Correct 4 ms 1364 KB Output is correct
7 Correct 4 ms 1352 KB Output is correct
8 Correct 5 ms 1540 KB Output is correct
9 Correct 5 ms 1284 KB Output is correct
10 Correct 4 ms 1404 KB Output is correct
11 Correct 8 ms 1648 KB Output is correct
12 Correct 4 ms 1276 KB Output is correct
13 Correct 4 ms 1412 KB Output is correct
14 Correct 5 ms 1360 KB Output is correct
15 Correct 5 ms 1412 KB Output is correct
16 Correct 4 ms 1284 KB Output is correct
17 Correct 5 ms 1488 KB Output is correct
18 Correct 6 ms 1412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 4288 KB Output is correct
2 Correct 32 ms 4288 KB Output is correct
3 Correct 32 ms 4452 KB Output is correct
4 Correct 20 ms 3152 KB Output is correct
5 Correct 20 ms 3492 KB Output is correct
6 Correct 20 ms 3384 KB Output is correct
7 Correct 20 ms 3452 KB Output is correct
8 Correct 20 ms 3520 KB Output is correct
9 Correct 20 ms 3424 KB Output is correct
10 Correct 18 ms 3504 KB Output is correct
11 Correct 19 ms 3392 KB Output is correct
12 Correct 18 ms 3120 KB Output is correct
13 Correct 19 ms 2984 KB Output is correct
14 Correct 19 ms 3124 KB Output is correct
15 Correct 20 ms 3180 KB Output is correct
16 Correct 20 ms 3036 KB Output is correct
17 Correct 20 ms 3128 KB Output is correct
18 Correct 20 ms 3128 KB Output is correct
19 Correct 20 ms 3168 KB Output is correct
20 Correct 17 ms 3744 KB Output is correct
21 Correct 16 ms 3824 KB Output is correct
22 Correct 20 ms 3488 KB Output is correct
23 Correct 20 ms 3688 KB Output is correct
24 Correct 20 ms 3616 KB Output is correct
25 Correct 20 ms 3852 KB Output is correct
26 Correct 20 ms 3744 KB Output is correct
27 Correct 20 ms 3616 KB Output is correct
28 Correct 22 ms 3616 KB Output is correct
29 Correct 19 ms 3488 KB Output is correct
30 Correct 20 ms 3720 KB Output is correct
31 Correct 4 ms 1500 KB Output is correct
32 Correct 4 ms 1276 KB Output is correct
33 Correct 4 ms 1520 KB Output is correct
34 Correct 4 ms 1404 KB Output is correct
35 Correct 4 ms 1404 KB Output is correct
36 Correct 4 ms 1408 KB Output is correct
37 Correct 4 ms 1404 KB Output is correct
38 Correct 4 ms 1268 KB Output is correct
39 Correct 4 ms 1404 KB Output is correct
40 Correct 4 ms 1404 KB Output is correct
41 Correct 4 ms 1372 KB Output is correct
42 Correct 4 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1136 KB Output is correct
2 Correct 5 ms 1264 KB Output is correct
3 Correct 5 ms 1264 KB Output is correct
4 Correct 6 ms 1680 KB Output is correct
5 Correct 6 ms 1688 KB Output is correct
6 Correct 6 ms 1680 KB Output is correct
7 Correct 6 ms 1688 KB Output is correct
8 Correct 6 ms 1820 KB Output is correct
9 Correct 16 ms 3768 KB Output is correct
10 Correct 17 ms 3968 KB Output is correct
11 Correct 16 ms 3896 KB Output is correct
12 Correct 4 ms 1272 KB Output is correct
13 Correct 4 ms 1164 KB Output is correct
14 Correct 4 ms 1136 KB Output is correct
15 Correct 4 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 4424 KB Output is correct
2 Partially correct 35 ms 4500 KB Partially correct
3 Partially correct 33 ms 4516 KB Partially correct
4 Correct 20 ms 3148 KB Output is correct
5 Partially correct 20 ms 3768 KB Partially correct
6 Correct 20 ms 3452 KB Output is correct
7 Correct 20 ms 3556 KB Output is correct
8 Correct 20 ms 3268 KB Output is correct
9 Correct 20 ms 3460 KB Output is correct
10 Correct 18 ms 3372 KB Output is correct
11 Correct 18 ms 3324 KB Output is correct
12 Correct 18 ms 3076 KB Output is correct
13 Correct 18 ms 3112 KB Output is correct
14 Correct 19 ms 2992 KB Output is correct
15 Correct 20 ms 3132 KB Output is correct
16 Correct 20 ms 3132 KB Output is correct
17 Correct 20 ms 3128 KB Output is correct
18 Correct 20 ms 3136 KB Output is correct
19 Correct 20 ms 3008 KB Output is correct
20 Incorrect 16 ms 3744 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 4516 KB Output is correct
2 Correct 35 ms 4460 KB Output is correct
3 Incorrect 33 ms 4552 KB Output isn't correct
4 Halted 0 ms 0 KB -