Submission #366630

# Submission time Handle Problem Language Result Execution time Memory
366630 2021-02-14T19:55:34 Z Mamnoon_Siam Amusement Park (JOI17_amusement_park) C++17
0 / 100
33 ms 8964 KB
#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;

/* sorry, this is the bare minimum :'( */
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second

const int N = 1e5 + 5;

namespace {
  int vis[N];
  int cnt = 0;
  int rnk[N];
  vi g[N];void dfs(int u) {
  vis[u] = 1;
  rnk[u] = cnt++;
  for(int v : g[u]) if(!vis[v]) {
    dfs(v);
  }
}
}

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

/* sorry, this is the bare minimum :'( */
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second

const int N = 1e5 + 5;

namespace {
  vi g[N];
  int vis[N], rnk[N];
  int cnt = 0;
  vi tour;
  void dfs(int u) {
    vis[u] = 1;
    rnk[u] = cnt++;
    tour.emplace_back(u);
    for(int v : g[u]) if(!vis[v]) {
      dfs(v);
      tour.emplace_back(u);
    }
  }
}

long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
  for(int i = 0; i < m; ++i) {
    g[A[i]].emplace_back(B[i]);
    g[B[i]].emplace_back(A[i]);
  }
  dfs(0);
  tour.pop_back();
  ll ret = V << (rnk[P] % 60);
  int st = int(find(all(tour), P) - tour.begin());
  for(int _ = 0, i = st+1; _ < 120; i = (i+1) % sz(tour), ++_) {
    ret |= Move(tour[i]) << (rnk[tour[i]] % 60);
  }
  return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 5516 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 8836 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 5480 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 8836 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 8964 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -