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

#define f first
#define s second

typedef long long int64;
typedef vector <int> VI;
typedef pair <int, int> PII;

const int mod = 1e9 + 7;
const int64 INF = 1000000000000000000LL;

const bool DEBUG = false;
#define DB if(DEBUG)

///////////////////////////////////////



int D, K, R;
int con;

int main() {
	ios_base::sync_with_stdio(0);
  
	D = podajD();
	K = podajK();
  R = podajR();
  
  DB cerr << "d = " << D << endl;
  
  vector <int> LEFT(D, 0);
  vector <int> RIGHT(D, R - 1);
  
  DB cerr << LEFT[0] << " < " << RIGHT[0] << endl;
  
  while(LEFT[0] < RIGHT[0]) {
    int query[D];
    for(int i = 0; i < D; i++) {
      query[i] = (LEFT[i] + RIGHT[i]) / 2;
      DB cerr << i << ": " << LEFT[i] << ", ..., " << RIGHT[i] << endl;
    }
    int longest = 0;
    for(int i = 0; i < D; i++) {
      int len = RIGHT[i] - LEFT[i] + 1;
      query[i] = LEFT[i];
      czyCieplo(query);
      query[i] = RIGHT[i];
      int res = czyCieplo(query);
      query[i] = (LEFT[i] + RIGHT[i]) / 2;
      
      if(len % 2 && len > 3) {
        if(res) { // zmiana na bliżej, jest shit po prawej
          LEFT[i] = (LEFT[i] + RIGHT[i]) / 2 + 1;
        } else { // gdzieś tam na lewo jest
          RIGHT[i] = (LEFT[i] + RIGHT[i]) / 2;
        }
      } else if(len % 2 == 0) {
        if(res) { // na prawo
          LEFT[i] = (LEFT[i] + RIGHT[i]) / 2 + 1;
        } else { // na lewo
          RIGHT[i] = (LEFT[i] + RIGHT[i]) / 2 + 1;
        }
      } else if(len == 3) {
        DB cerr << "No elo dla " << i << endl;
        if(res) { // wynikiem jest ten tu tylko
          LEFT[i] = RIGHT[i];
        } else { // wynikiem mogą być dwie liczby
          query[i] = LEFT[i];
          int res2 = czyCieplo(query);
          query[i] = (LEFT[i] + RIGHT[i]) / 2;
          if(res2) RIGHT[i] = LEFT[i];
          else LEFT[i] = RIGHT[i] = RIGHT[i] - 1;
        }
      }
      longest = max(RIGHT[i] - LEFT[i], longest);
    }
    DB cerr << longest << " to longest" << endl;
    if(longest == 1) longest = 2;
    
    for(int i = 0; i < D; i++) {
      LEFT[i] = RIGHT[i] - longest;
      if(LEFT[i] < 0) {
        RIGHT[i] += -LEFT[i];
        LEFT[i] += -LEFT[i];
      }
    }
  }
	
	int query[D];
  for(int i = 0; i < D; i++)
    query[i] = LEFT[i];
  znalazlem(query);
	
	
	
	
}