Submission #1078534

# Submission time Handle Problem Language Result Execution time Memory
1078534 2024-08-27T19:41:39 Z avighna Arcade (NOI20_arcade) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

typedef long long ll;

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  ll n, m;
  std::cin >> n >> m;
  std::vector<ll> t(m), a(m);
  for (auto &i : t) {
    std::cin >> i;
  }
  for (auto &i : a) {
    std::cin >> i;
  }

  std::vector<std::vector<ll>> adj(n);
  std::vector<ll> indeg(n), outdeg(n);
  for (ll i = 0; i < n; ++i) {
    for (ll j = 0; j < n; ++j) {
      if (i == j) {
        continue;
      }
      if (std::abs(a[i] - a[j]) <= std::abs(t[i] - t[j])) {
        adj[i].push_back(j);
        outdeg[i]++, indeg[j]++;
      }
    }
  }
  std::function<ll(ll)> dfs;
  dfs = [&](ll node) {
    ll ans = 0;
    for (auto &i : adj[node]) {
      ans += dfs(i);
    }
    return std::max(ans, 1LL);
  };

  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    if (indeg[i] == 0) {
      ans += dfs(i);
    }
  }
  std::cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -