답안 #626125

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
626125 2022-08-11T08:47:23 Z evenvalue 자동 인형 (IOI18_doll) C++17
18 / 100
27 ms 5036 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

template<typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using max_heap = priority_queue<T, vector<T>, less<T>>;

using int64 = long long;
using ld = long double;

constexpr int kInf = 1e9 + 10;
constexpr int64 kInf64 = 1e15 + 10;
constexpr int kMod = 1e9 + 7;

vector<int> C;
vector<int> X;
vector<int> Y;

int calc_elements(const int h) {
  const int x = 32 - __builtin_clz(h);
  return x - (__builtin_popcount(h) == 1);
}

void create_circuit(int m, std::vector<int> A) {
  assert(m == 1);
  int n = A.size();

  function<void(int)> dfs = [&](const int enter) {
    X.push_back(0), Y.push_back(0);
    //set my left child
    if (enter / 2 < n) {
      X.back() = 1;
      n -= enter / 2;
    } else {
      X.back() = -1;
    }
    //set my right child
    if (n == 1 and enter == 2) {
      Y.back() = 0;
    } else {
      Y.back() = -1 * (int)(1 + Y.size());
      dfs(enter / 2);
    }
  };
  dfs(1 << (calc_elements(n)));
  C.resize(2);
  C[0] = 1;
  C[1] = -1;
  answer(C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 428 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 13 ms 2228 KB Output is correct
3 Correct 14 ms 2216 KB Output is correct
4 Correct 27 ms 3228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 13 ms 2228 KB Output is correct
3 Correct 14 ms 2216 KB Output is correct
4 Correct 27 ms 3228 KB Output is correct
5 Runtime error 22 ms 5036 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -