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
#include <bits/stdc++.h>
#include "cielib.h"

const int N = 1000;

int P[N], D, K, R;

int main() {
  D = podajD();
  K = podajK();
  R = podajR();
  for (int i = 0; i < D; ++i) {
    int l = 0, r = R;
    while (l < r) {
      P[i] = l;
      czyCieplo(P);
      P[i] = r;
      int res = czyCieplo(P);
      if (res) l = (l + r) / 2 + 1;
      else r = (l + r) / 2;
    } 
    P[i] = l;
  }
  znalazlem(P);
  return 0;
}