답안 #341558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
341558 2020-12-30T02:48:08 Z KoD Amusement Park (JOI17_amusement_park) C++17
18 / 100
27 ms 3488 KB
#include "Joi.h"

void Joi(int N, int M, int A[], int B[], long long X, int T) {
  if (T <= 2) {
    for (int i = 0; i < 60; ++i) {
      MessageBoard(i, X >> i & 1);
    }
    for (int i = 60; i < N; ++i) {
      MessageBoard(i, 0);
    }
  }
  if (T == 3) {
    for (int i = 0; i < N; ++i) {
      const auto d = i % 60;
      MessageBoard(i, X >> d & 1);
    }
  }
}
#include "Ioi.h"
#include <vector>

namespace {

template <class T>
using Vec = std::vector<T>;

Vec<Vec<int>> graph;
Vec<int> value;

void write(const int u, const int p) {
  for (const auto v: graph[u]) {
    if (value[v] == -1) {
      value[v] = Move(v);
      write(v, u);
    }
  }
  if (p != -1) {
    Move(p);
  }
}

};

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
  graph.resize(N);
  value.resize(N, -1);
  for (int i = 0; i < M; ++i) {
    graph[A[i]].push_back(B[i]);
    graph[B[i]].push_back(A[i]);
  }
  value[P] = V;
  if (T <= 2) {
    write(P, -1);
    long long X = 0;
    for (int i = 0; i < 60; ++i) {
      if (value[i]) {
        X += (1ll << i);
      }
    }
    return X;
  }
  if (T == 3) {
    int goal = P / 60 * 60;
    if (goal + 60 >= N) {
      goal -= 60;
    }
    while (P > goal) {
      for (const auto v: graph[P]) {
        if (v < P) {
          value[v] = Move(v);
          P = v;
          break;
        }
      }
    } 
    long long X = 0;
    for (int i = 0; i < 60; ++i) {
      if (value[goal + i]) {
        X += (1ll << i);
      }
      return X;
    }
  }
  return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 0 ms 868 KB Output is correct
3 Correct 2 ms 788 KB Output is correct
4 Correct 0 ms 872 KB Output is correct
5 Correct 0 ms 988 KB Output is correct
6 Correct 1 ms 868 KB Output is correct
7 Correct 2 ms 788 KB Output is correct
8 Correct 2 ms 988 KB Output is correct
9 Correct 1 ms 788 KB Output is correct
10 Correct 0 ms 868 KB Output is correct
11 Correct 4 ms 1056 KB Output is correct
12 Correct 0 ms 868 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 2 ms 936 KB Output is correct
15 Correct 2 ms 980 KB Output is correct
16 Correct 1 ms 788 KB Output is correct
17 Correct 1 ms 1028 KB Output is correct
18 Correct 1 ms 748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 3336 KB Output is correct
2 Correct 25 ms 3268 KB Output is correct
3 Correct 25 ms 3488 KB Output is correct
4 Correct 15 ms 2220 KB Output is correct
5 Correct 16 ms 2860 KB Output is correct
6 Correct 16 ms 2588 KB Output is correct
7 Correct 15 ms 2348 KB Output is correct
8 Correct 15 ms 2348 KB Output is correct
9 Correct 15 ms 2420 KB Output is correct
10 Correct 15 ms 2096 KB Output is correct
11 Correct 15 ms 2284 KB Output is correct
12 Correct 14 ms 1948 KB Output is correct
13 Correct 14 ms 1948 KB Output is correct
14 Correct 14 ms 1956 KB Output is correct
15 Correct 15 ms 2332 KB Output is correct
16 Correct 15 ms 2092 KB Output is correct
17 Correct 15 ms 2092 KB Output is correct
18 Correct 15 ms 2332 KB Output is correct
19 Correct 16 ms 2092 KB Output is correct
20 Correct 13 ms 2348 KB Output is correct
21 Correct 13 ms 2468 KB Output is correct
22 Correct 16 ms 2348 KB Output is correct
23 Correct 15 ms 2460 KB Output is correct
24 Correct 15 ms 2348 KB Output is correct
25 Correct 15 ms 2220 KB Output is correct
26 Correct 15 ms 2460 KB Output is correct
27 Correct 15 ms 2348 KB Output is correct
28 Correct 15 ms 2348 KB Output is correct
29 Correct 14 ms 2204 KB Output is correct
30 Correct 15 ms 2212 KB Output is correct
31 Correct 1 ms 980 KB Output is correct
32 Correct 0 ms 740 KB Output is correct
33 Correct 1 ms 988 KB Output is correct
34 Correct 0 ms 868 KB Output is correct
35 Correct 0 ms 868 KB Output is correct
36 Correct 0 ms 980 KB Output is correct
37 Correct 0 ms 868 KB Output is correct
38 Correct 0 ms 740 KB Output is correct
39 Correct 0 ms 740 KB Output is correct
40 Correct 0 ms 1020 KB Output is correct
41 Correct 0 ms 740 KB Output is correct
42 Correct 0 ms 868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 928 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 996 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 996 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -