1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <string>

#include "cielib.h"

#define PB          push_back
#define ST          first
#define ND          second

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using VII = vector<PII>;
using LL = long long int;
using ULL = unsigned long long int;

const int MAXN = 505;

int N, K, R;

int current_pos[MAXN];
int question[MAXN];

int Solve(int length) {
  vector<int> next_pos(MAXN);
  for (int dim = 0; dim < N; ++dim) {
    for (int i = 0; i < N; ++i) {
      question[i] = current_pos[i] + length / 2;
    }
    question[dim] = current_pos[dim];
    czyCieplo(question);
    question[dim] = current_pos[dim] + length;
    int top_closer = czyCieplo(question);
    if (top_closer == 1) {
      if (length > 2) {
        next_pos[dim] = current_pos[dim] + length / 2;
      } else {
        next_pos[dim] = current_pos[dim] + length;
      }
      continue;
    }
    if (length > 2) {
      next_pos[dim] = current_pos[dim];
      continue;
    }
    question[dim] = current_pos[dim];
    int bottom_closer = czyCieplo(question);
    if (bottom_closer == 1) {
      next_pos[dim] = current_pos[dim];
    } else {
      next_pos[dim] = current_pos[dim] + length / 2;
    }
  }

  for (int i = 0; i < N; ++i) {
    current_pos[i] = next_pos[i];
  }
  if (length == 2) {
    return 0;
  } else {
    return (length + 1) / 2;
  }
}

int main() {
  N = podajD();
  K = podajK();
  R = podajR();
  for (int i = 0; i < N; ++i) {
    current_pos[i] = 0;
  }
  int length = R;
  while (length > 0) {
    length = Solve(length);
  }
  znalazlem(current_pos);
  return 0;
}