답안 #958414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
958414 2024-04-05T18:50:57 Z AkibAzmain 자동 인형 (IOI18_doll) C++17
37 / 100
74 ms 11080 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void create_circuit(int m, std::vector<int> a) {
  int p = 0;
  a.push_back (0);
  vector < int > c (m + 1, -1), x, y;
  x.reserve (a.size () * 2);
  y.reserve (a.size () * 2);
  int vt = 1, vtt = 0;
  while (vt < a.size ()) vt *= 2, ++vtt;
  vector < int > v (vt, -1);
  for (int i = 0; i < a.size (); ++i)
    {
      int j = vt - a.size () + i, k = 0;
      for (int i = 0; i < vtt; ++i) k = k * 2 + j % 2, j /= 2;
      v[k] = a[i];
    }
  auto f = [&] (auto &self, int l, int r) -> int
  {
    if (l + 1 == r) return v[l];
    int m = (l + r) / 2;
    int i = x.size ();
    x.push_back (0), y.push_back (0);
    x[i] = self (self, l, m);
    y[i] = self (self, m, r);
    return -(i + 1);
  };
  c[0] = f (f, 0, vt);
  answer (c, x, y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:13:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   while (vt < a.size ()) vt *= 2, ++vtt;
      |          ~~~^~~~~~~~~~~
doll.cpp:15:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for (int i = 0; i < a.size (); ++i)
      |                   ~~^~~~~~~~~~~
doll.cpp:7:7: warning: unused variable 'p' [-Wunused-variable]
    7 |   int p = 0;
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 60 ms 9572 KB Output is partially correct
3 Partially correct 59 ms 9556 KB Output is partially correct
4 Partially correct 74 ms 10664 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 60 ms 9572 KB Output is partially correct
3 Partially correct 59 ms 9556 KB Output is partially correct
4 Partially correct 74 ms 10664 KB Output is partially correct
5 Partially correct 61 ms 11080 KB Output is partially correct
6 Partially correct 61 ms 10816 KB Output is partially correct
7 Partially correct 65 ms 10928 KB Output is partially correct
8 Partially correct 70 ms 10568 KB Output is partially correct
9 Partially correct 51 ms 9556 KB Output is partially correct
10 Partially correct 62 ms 10544 KB Output is partially correct
11 Partially correct 71 ms 10436 KB Output is partially correct
12 Partially correct 52 ms 9560 KB Output is partially correct
13 Partially correct 52 ms 9780 KB Output is partially correct
14 Partially correct 56 ms 9772 KB Output is partially correct
15 Partially correct 62 ms 9784 KB Output is partially correct
16 Partially correct 2 ms 604 KB Output is partially correct
17 Correct 33 ms 5976 KB Output is correct
18 Partially correct 53 ms 9560 KB Output is partially correct
19 Partially correct 59 ms 9548 KB Output is partially correct
20 Partially correct 58 ms 10572 KB Output is partially correct
21 Partially correct 57 ms 10560 KB Output is partially correct
22 Partially correct 71 ms 10576 KB Output is partially correct