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
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include "cielib.h"
#include <iostream>

using namespace std;

int bounds1[500]; // [dim][lower][upper]
int bounds2[500];
int checks[500];
//int checks2[500];

int main()
{
  int d, k, r;
  int result;
  int result2;

  d = podajD();
  k = podajK();
  r = podajR();

  for(int i = 0; i < d; i++)
  {
    bounds1[i] = 0;
    bounds2[i] = r;
  }

  while(bounds1[0] - bounds2[0] != -2)
  {
    for(int i = 0; i < d; i++)
    {
      for(int j = 0; j < d; j++)
      {
        if(j != i) checks[j] = bounds1[j] + int((bounds2[j] - bounds1[j])/2);
        else checks[j] = bounds1[j];
      }

/*      for(int e = 0; e < d; e++)
      {
        cout << "checks[" << e << "]=" << checks[e] << "\n";

      }
      cout << "----------------------------\n";*/

      result = czyCieplo(checks);
      checks[i] = bounds2[i];
      result = czyCieplo(checks);
//      cout << "inside: b1[" << i << "]=" << bounds1[i] << ", b2[" << i << "]=" << bounds2[i] << "result = " << result<<"\n";
//      cout << "---\n";
      if(result == 0)
      {
          bounds2[i] = bounds2[i] - int((bounds2[i] - bounds1[i])/2);
      }
      else
      {
          bounds1[i] = bounds1[i] + int((bounds2[i] - bounds1[i])/2);
      }
    }
 /*   for(int e = 0; e < d; e++)
    {
      cout << "b1[" << e << "]=" << bounds1[e] << ", b2[" << e << "]=" << bounds2[e] << "\n";

    }
    cout << "----------------------------\n";*/
  }

  for(int i = 0; i < d; i++)
    {
      for(int j = 0; j < d; j++)
      {
        if(j != i) checks[j] = bounds1[j] + int((bounds2[j] - bounds1[j])/2);
        else checks[j] = bounds1[j];
      }

      //for(int e = 0; e < d; e++)
      //{
      //  cout << "checks[" << e << "]=" << checks[e] << "\n";
      //}
      //cout << "----------------------------\n";

      result = czyCieplo(checks);
      checks[i] = bounds2[i];
      result = czyCieplo(checks);
      checks[i] = bounds1[i];
      result2 = czyCieplo(checks);
      //cout << "inside: b1[" << i << "]=" << bounds1[i] << ", b2[" << i << "]=" << bounds2[i] << "result = " << result<<"\n";
      //cout << "---\n";
      if(result == 0)
      {
          if(result2 == 0)
          {
             bounds2[i] = bounds2[i] - 1;
             bounds1[i] = bounds2[i];
          }
          else
          {
            bounds2[i] = bounds1[i];
          }
      }
      else
      {
          bounds1[i] = bounds2[i];
      }
    }

    znalazlem(bounds1);











/*  for(int i = 0; i < d; i++)
  {
      cout << "b1[" << i << "]=" << bounds1[i] << ", b2[" << i << "]=" << bounds2[i] << "\n";
  }
*/

  return 0;
}