Submission #1067167

# Submission time Handle Problem Language Result Execution time Memory
1067167 2024-08-20T12:26:07 Z juicy None (JOI16_snowy) C++17
55 / 100
10 ms 1980 KB
#include "Anyalib.h"

#include <bits/stdc++.h>

using namespace std;

namespace {
  const int N = 500;
  
  int n;
  int pr[N], c[N];
  vector<int> cands;
  vector<array<int, 2>> g[N];

  void dfs(int u, int cur = 11) {
    if (cur == 11) {
      cur = 0;
      cands.push_back(u);
    } else {
      ++cur;
    }
    for (auto [v, i] : g[u]) {
      if (v != pr[u]) {
        pr[v] = u;
        dfs(v, cur);
      }
    }
  }

  void color(int u, int *C) {
    for (auto [v, i] : g[u]) {
      if (v != pr[u]) {
        Save(v, C[i]);
        c[v] = c[u] + C[i];
        color(v, C);
      }
    }
  }
}

void InitAnya(int N, int *A, int *B) {
  n = N;
  for (int i = 0; i < N - 1; ++i) {
    g[A[i]].push_back({B[i], i});
    g[B[i]].push_back({A[i], i});
  }
  dfs(0);
}

void Anya(int *C) {
  c[0] = 0;
  color(0, C);
  for (int i = 0; i < cands.size(); ++i) {
    for (int j = 0; j < 9; ++j) {
      Save(500 + i * 9 + j, c[cands[i]] >> j & 1);
    } 
  }
}
#include "Borislib.h"

#include <bits/stdc++.h>

using namespace std;

namespace {
  const int N = 500;
  
  int n, p = 0;
  int pr[N], c[N], spec[N];
  vector<int> g[N];
  
  void dfs(int u, int cur = 11) {
    if (cur == 11) {
      cur = 0;
      spec[u] = ++p;
    } else {
      ++cur;
    }
    for (int v : g[u]) {
      if (v != pr[u]) {
        pr[v] = u;
        dfs(v, cur);
      }
    }
  }
}


void InitBoris(int N, int *A, int *B) {
  n = N;
  for (int i = 0; i < N - 1; ++i) {
    g[A[i]].push_back(B[i]);
    g[B[i]].push_back(A[i]);
  }
  dfs(0);
}

int Boris(int u) {
  int res = 0;
  while (!spec[u]) {
    res += Ask(u);
    u = pr[u];
  }
  if (spec[u]) {
    for (int j = 0; j < 9; ++j) {
      res += Ask(500 + 9 * (spec[u] - 1) + j) << j;
    }
  }
  return res;
}

Compilation message

Anya.cpp: In function 'void Anya(int*)':
Anya.cpp:53:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |   for (int i = 0; i < cands.size(); ++i) {
      |                   ~~^~~~~~~~~~~~~~

Boris.cpp:11:14: warning: '{anonymous}::c' defined but not used [-Wunused-variable]
   11 |   int pr[N], c[N], spec[N];
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 800 KB Output is correct
2 Correct 1 ms 808 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 2 ms 1132 KB Output is correct
5 Correct 3 ms 1212 KB Output is correct
6 Correct 4 ms 1208 KB Output is correct
7 Correct 4 ms 1212 KB Output is correct
8 Correct 3 ms 1224 KB Output is correct
9 Correct 3 ms 1208 KB Output is correct
10 Correct 3 ms 1212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1236 KB Output is correct
2 Correct 4 ms 1240 KB Output is correct
3 Correct 4 ms 1248 KB Output is correct
4 Correct 5 ms 1248 KB Output is correct
5 Correct 5 ms 1248 KB Output is correct
6 Correct 4 ms 1244 KB Output is correct
7 Correct 5 ms 1256 KB Output is correct
8 Correct 5 ms 1252 KB Output is correct
9 Correct 4 ms 1208 KB Output is correct
10 Correct 4 ms 1344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1728 KB Output is correct
2 Correct 9 ms 1728 KB Output is correct
3 Correct 9 ms 1736 KB Output is correct
4 Correct 9 ms 1724 KB Output is correct
5 Correct 9 ms 1728 KB Output is correct
6 Correct 9 ms 1760 KB Output is correct
7 Correct 9 ms 1728 KB Output is correct
8 Correct 9 ms 1728 KB Output is correct
9 Correct 9 ms 1756 KB Output is correct
10 Correct 10 ms 1728 KB Output is correct
11 Correct 9 ms 1760 KB Output is correct
12 Correct 9 ms 1688 KB Output is correct
13 Correct 9 ms 1732 KB Output is correct
14 Correct 9 ms 1736 KB Output is correct
15 Correct 9 ms 1728 KB Output is correct
16 Correct 10 ms 1724 KB Output is correct
17 Correct 8 ms 1724 KB Output is correct
18 Correct 9 ms 1728 KB Output is correct
19 Correct 9 ms 1980 KB Output is correct
20 Correct 9 ms 1724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 840 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -