답안 #134891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134891 2019-07-23T11:36:00 Z Just_Solve_The_Problem Amusement Park (JOI17_amusement_park) C++17
0 / 100
36 ms 4436 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++;
  if (cur >= 60) cur -= 60;
  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);
  for (int i = 0; i < n; i++) {
    assert(used[i]);
  }
  //cerr << X << endl;
}
#include <bits/stdc++.h>
#include "Ioi.h"

#define ll long long

using namespace std;

const int maxn = (int)1e4 + 7;

static int used[maxn], d[maxn];
static vector <int> vec, gr[maxn];
static int n;
static ll x;
static int cur;

void dfs2(int v) {
  used[v] = 1;
  vec.push_back(v);
  d[v] = cur;
  cur++;
  if (cur >= 60) cur -= 60;
  for (int to : gr[v]) {
    if (used[to]) continue;
    dfs2(to);
    vec.push_back(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]);
  }
  for (int i = 0; i < n; i++) {
    used[i] = 0;
  }
  dfs2(0);
  for (int i = 0; i < n; i++) {
    used[i] = 0;
  }
  used[P] = V;
  int ind = 0;
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i] == P) {
      ind = i;
      break;
    }
  }
  int cnt = 0;
  set <int> S;
  cur = P;
  S.clear();
  int i = ind;
  bool ok = 1;
  while (1) {
    S.insert(d[vec[i]]);
    if (cur != vec[i]) used[vec[i]] = Move(vec[i]);
    cur = vec[i];
    if (used[vec[i]])
      x |= (1LL << d[vec[i]]);
    if (S.size() >= 60) break;
    if (ok) {
      i--;
    } else {
      i++;
    }
    if (i >= vec.size()) {
      ok = 1;
      i = ind;
    }
  }
  //cerr << x << endl;
  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:44:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < vec.size(); i++) {
                   ~~^~~~~~~~~~~~
Ioi.cpp:68:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (i >= vec.size()) {
         ~~^~~~~~~~~~~~~
Ioi.cpp:50:7: warning: unused variable 'cnt' [-Wunused-variable]
   int cnt = 0;
       ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1140 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 4168 KB Output is correct
2 Correct 33 ms 4332 KB Output is correct
3 Correct 33 ms 4384 KB Output is correct
4 Correct 19 ms 3136 KB Output is correct
5 Correct 19 ms 3264 KB Output is correct
6 Correct 19 ms 3204 KB Output is correct
7 Correct 20 ms 3256 KB Output is correct
8 Correct 19 ms 3256 KB Output is correct
9 Correct 20 ms 3288 KB Output is correct
10 Incorrect 18 ms 3004 KB Wrong Answer [8]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1264 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 4288 KB Output is correct
2 Correct 32 ms 4244 KB Output is correct
3 Partially correct 32 ms 4436 KB Partially correct
4 Partially correct 20 ms 3128 KB Partially correct
5 Correct 20 ms 3568 KB Output is correct
6 Correct 20 ms 3292 KB Output is correct
7 Correct 19 ms 3304 KB Output is correct
8 Correct 19 ms 3136 KB Output is correct
9 Correct 19 ms 3132 KB Output is correct
10 Incorrect 19 ms 3132 KB Wrong Answer [8]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 4288 KB Output is correct
2 Correct 36 ms 4356 KB Output is correct
3 Incorrect 32 ms 4268 KB Output isn't correct
4 Halted 0 ms 0 KB -