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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<pii, int> para;
const int inf = 1e9 + 7;
const int maxN = 1009;

int d, k, r, t[maxN], low[maxN], high[maxN];

void solve() {
	
	for (int i = 0; i < d; i++) {
		low[i] = 0;
		high[i] = r;
		t[i] = r / 2;
	}
	
	while (true) {
		bool done = false;
		for (int i = 0; i < d; i++) {
			if (low[i] < high[i]) {
				if ((high[i] - low[i]) % 2 == 1) low[i]--;
				int mid = (low[i] + high[i]) / 2;
				t[i] = low[i];				
				czyCieplo(t);
				t[i] = high[i];
				bool first = czyCieplo(t);
				if (!first) {
					t[i] = low[i];
					bool second = czyCieplo(t);
					if (!second) {
						t[i] = mid;
						low[i] = high[i] = t[i];
					} else {
						t[i] = (low[i] + mid) / 2;
						high[i] = mid;
						done = true;
					}
				} else {
					t[i] = (high[i] + mid + 1) / 2;
					low[i] = mid + 1;
					done = true;
				}
			}
		}
		
		if (!done) break;
	}
}

int main() {
	d = podajD();
	k = podajK();
	r = podajR();
	
	solve();
	
	for (int i = 0; i < d; i++)
		t[i] = low[i];
	znalazlem(t);
}